Skip to content

Commit

Permalink
Fixes #37807 - Support Zeitwerk loader
Browse files Browse the repository at this point in the history
  • Loading branch information
ofedoren authored and ekohl committed Sep 11, 2024
1 parent 58390e2 commit 8a1bfc4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
3 changes: 3 additions & 0 deletions config/initializers/zeitwerk.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Rails.autoloaders.main.ignore(
ForemanSalt::Engine.root.join('lib/tasks')
)
4 changes: 2 additions & 2 deletions foreman_salt.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |s|
s.test_files = Dir['test/**/*']

s.add_dependency 'deface', '< 2.0'
s.add_dependency 'foreman_remote_execution', '>= 9.0', '< 14'
s.add_dependency 'foreman-tasks', '>= 7.0', '< 10'
s.add_dependency 'foreman_remote_execution', '>= 14.0', '< 15'
s.add_dependency 'foreman-tasks', '>= 10.0', '< 11'
s.add_development_dependency 'theforeman-rubocop', '~> 0.0.6'
end
13 changes: 5 additions & 8 deletions lib/foreman_salt/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ module ForemanSalt
class Engine < ::Rails::Engine
engine_name 'foreman_salt'

config.autoload_paths += Dir["#{config.root}/app/controllers/foreman_salt/concerns"]
config.autoload_paths += Dir["#{config.root}/app/helpers"]
config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
config.autoload_paths += Dir["#{config.root}/app/overrides"]
config.autoload_paths += Dir["#{config.root}/app/services"]
config.autoload_paths += Dir["#{config.root}/app/lib"]

config.paths['config/routes.rb'].unshift('config/api_routes.rb')
Expand Down Expand Up @@ -42,12 +37,14 @@ class Engine < ::Rails::Engine
Apipie.configuration.checksum_path += ['/salt/api/']
end

initializer 'foreman_salt.register_plugin', before: :finisher_hook do
require 'foreman_salt/plugin'
initializer 'foreman_salt.register_plugin', before: :finisher_hook do |app|
app.reloader.to_prepare do
require_relative 'plugin'
end
end

config.to_prepare do
require 'foreman_salt/extensions'
require_relative 'extensions'

RemoteExecutionProvider.register(:Salt, SaltProvider)
ForemanSalt.register_rex_feature
Expand Down
2 changes: 1 addition & 1 deletion lib/foreman_salt/plugin.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

Foreman::Plugin.register :foreman_salt do
requires_foreman '>= 3.7'
requires_foreman '>= 3.13'
register_gettext

settings do
Expand Down

0 comments on commit 8a1bfc4

Please sign in to comment.