Skip to content

Commit

Permalink
Add Zeitwerk loader support
Browse files Browse the repository at this point in the history
  • Loading branch information
nadjaheitmann committed Oct 8, 2024
1 parent 6f66bde commit 8ecc5e2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/controllers/ui_acd_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# Controller to create JSON data to be used in react app
class UiAcdController < ::Api::V2::BaseController
class UIAcdController < ::Api::V2::BaseController
include ::ForemanAcd::Concerns::AppInstanceMixins

def app
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# Add git_url column to ansible_playbook
class AddGitUrlToAnsiblePlaybooks < ActiveRecord::Migration[6.0]
class AddGitURLToAnsiblePlaybooks < ActiveRecord::Migration[6.0]
def change
add_column :acd_ansible_playbooks, :git_url, :string
end
Expand Down
14 changes: 4 additions & 10 deletions lib/foreman_acd/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ module ForemanAcd
class Engine < ::Rails::Engine
engine_name 'foreman_acd'

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

# Add any db migrations
initializer 'foreman_acd.load_app_instance_data' do |app|
ForemanAcd::Engine.paths['db/migrate'].existent.each do |path|
Expand All @@ -40,8 +32,10 @@ class Engine < ::Rails::Engine
Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
end

initializer 'foreman_acd.register_plugin', :before => :finisher_hook do
require 'foreman_acd/plugin'
initializer 'foreman_acd.register_plugin', :before => :finisher_hook do |app|
app.reloader.to_prepare do
require 'foreman_acd/plugin'
end
end

initializer 'foreman_acd.register_actions', :before => :finisher_hook do |_app|
Expand Down
2 changes: 1 addition & 1 deletion lib/foreman_acd/plugin.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

Foreman::Plugin.register :foreman_acd do
requires_foreman '>= 2.1'
requires_foreman '>= 3.13'

apipie_documented_controllers ["#{ForemanAcd::Engine.root}/app/controllers/foreman_acd/api/v2/*.rb"]

Expand Down
2 changes: 1 addition & 1 deletion test/controllers/ui_acd_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def self.all
end

# UI Controller tests
class UiAcdControllerTest < ActionController::TestCase
class UIAcdControllerTest < ActionController::TestCase
test 'get app json' do
app_def = FactoryBot.create(:app_definition)
get :app, :params => { :id => app_def.id }, :session => set_session_user
Expand Down

0 comments on commit 8ecc5e2

Please sign in to comment.