Skip to content

Commit

Permalink
Integrate zeitwerk autoload
Browse files Browse the repository at this point in the history
  • Loading branch information
bastian-src committed Oct 2, 2024
1 parent b30ad9e commit 2d0b0c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
13 changes: 4 additions & 9 deletions lib/foreman_resource_quota/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ module ForemanResourceQuota
class Engine < ::Rails::Engine
engine_name 'foreman_resource_quota'

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

# Add db migrations
initializer 'foreman_resource_quota.load_app_instance_data' do |app|
ForemanResourceQuota::Engine.paths['db/migrate'].existent.each do |path|
Expand All @@ -34,8 +27,10 @@ class Engine < ::Rails::Engine
end

# Plugin extensions
initializer 'foreman_resource_quota.register_plugin', before: :finisher_hook do |_app|
require 'foreman_resource_quota/register'
initializer 'foreman_resource_quota.register_plugin', before: :finisher_hook do |app|
app.reloader.to_prepare do
require 'foreman_resource_quota/register'
end
end

# Include concerns in this config.to_prepare block
Expand Down
2 changes: 1 addition & 1 deletion lib/foreman_resource_quota/register.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# rubocop: disable Metrics/BlockLength
Foreman::Plugin.register :foreman_resource_quota do
requires_foreman '>= 3.5.0'
requires_foreman '>= 3.7'
# Apipie
apipie_documented_controllers ["#{ForemanResourceQuota::Engine.root}" \
'/app/controllers/foreman_resource_quot/api/v2/*.rb']
Expand Down

0 comments on commit 2d0b0c7

Please sign in to comment.