Skip to content

Commit

Permalink
Fixes #37625 - Fix the plugin to support zeitwerk
Browse files Browse the repository at this point in the history
  • Loading branch information
ShimShtein authored and ekohl committed Sep 10, 2024
1 parent 6c877d2 commit 2bb74a1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/foreman_azure_rm/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ class Engine < ::Rails::Engine

#autoloading all files inside lib dir
config.eager_load_paths += Dir["#{config.root}/lib"]
config.eager_load_paths += Dir["#{config.root}/app/models/concerns/foreman_azure_rm/vm_extensions/"]
config.eager_load_paths += Dir["#{config.root}/app/models/concerns/"]
config.eager_load_paths += Dir["#{config.root}/app/helpers/"]

initializer 'foreman_azure_rm.register_plugin', :before => :finisher_hook do
Foreman::Plugin.register :foreman_azure_rm do
requires_foreman '>= 3.7'
requires_foreman '>= 3.13'
register_gettext
compute_resource ForemanAzureRm::AzureRm
parameter_filter ComputeResource, :azure_vm, :tenant, :app_ident, :secret_key, :sub_id, :region, :cloud
Expand All @@ -29,6 +29,14 @@ class Engine < ::Rails::Engine
end
end

initializer "foreman_azure_rm.zeitwerk" do
Rails.autoloaders.each do |loader|
loader.ignore(
ForemanAzureRm::Engine.root.join('lib/foreman_azure_rm/version.rb')
)
end
end

config.to_prepare do
require 'azure_mgmt_resources'
require 'azure_mgmt_network'
Expand Down

0 comments on commit 2bb74a1

Please sign in to comment.