diff --git a/app/registries/foreman/settings.rb b/app/registries/foreman/settings.rb deleted file mode 100644 index 45cace1de57..00000000000 --- a/app/registries/foreman/settings.rb +++ /dev/null @@ -1,9 +0,0 @@ -require_relative 'setting_manager' - -require_relative 'settings/general' -require_relative 'settings/auth' -require_relative 'settings/email' -require_relative 'settings/notification' -require_relative 'settings/provisioning' -require_relative 'settings/facts' -require_relative 'settings/cfgmgmt' diff --git a/config/initializers/6_zeitwerk.rb b/config/initializers/6_zeitwerk.rb new file mode 100644 index 00000000000..f3b31717463 --- /dev/null +++ b/config/initializers/6_zeitwerk.rb @@ -0,0 +1,4 @@ +Rails.autoloaders.main.ignore( + Rails.root.join('lib/generators'), + Rails.root.join('lib/tasks') +) diff --git a/app/registries/foreman/access_permissions.rb b/config/initializers/f_foreman_permissions.rb similarity index 100% rename from app/registries/foreman/access_permissions.rb rename to config/initializers/f_foreman_permissions.rb diff --git a/app/registries/foreman/settings/auth.rb b/config/initializers/f_foreman_settings_auth.rb similarity index 99% rename from app/registries/foreman/settings/auth.rb rename to config/initializers/f_foreman_settings_auth.rb index 0db7b257041..2d6a76f95b1 100644 --- a/app/registries/foreman/settings/auth.rb +++ b/config/initializers/f_foreman_settings_auth.rb @@ -87,7 +87,7 @@ setting('websockets_encrypt', type: :boolean, description: N_("VNC/SPICE websocket proxy console access encryption (websockets_ssl_key/cert setting required)"), - default: !!SETTINGS[:require_ssl], + default: !!SETTINGS[:require_ssl], # rubocop:disable Style/DoubleNegation full_name: N_('Websockets encryption')) validates('websockets_encrypt', ->(value) { !value || !(Setting["websockets_ssl_key"].empty? || Setting["websockets_ssl_cert"].empty?) }, message: N_("Unable to turn on websockets_encrypt, either websockets_ssl_key or websockets_ssl_cert is missing")) validates('websockets_ssl_key', ->(value) { !Setting["websockets_encrypt"] || !value.empty? }, message: N_("Unable to unset websockets_ssl_key when websockets_encrypt is on")) diff --git a/app/registries/foreman/settings/cfgmgmt.rb b/config/initializers/f_foreman_settings_cfgmgmt.rb similarity index 100% rename from app/registries/foreman/settings/cfgmgmt.rb rename to config/initializers/f_foreman_settings_cfgmgmt.rb diff --git a/app/registries/foreman/settings/email.rb b/config/initializers/f_foreman_settings_email.rb similarity index 100% rename from app/registries/foreman/settings/email.rb rename to config/initializers/f_foreman_settings_email.rb diff --git a/app/registries/foreman/settings/facts.rb b/config/initializers/f_foreman_settings_facts.rb similarity index 100% rename from app/registries/foreman/settings/facts.rb rename to config/initializers/f_foreman_settings_facts.rb diff --git a/app/registries/foreman/settings/general.rb b/config/initializers/f_foreman_settings_general.rb similarity index 100% rename from app/registries/foreman/settings/general.rb rename to config/initializers/f_foreman_settings_general.rb diff --git a/app/registries/foreman/settings/notification.rb b/config/initializers/f_foreman_settings_notification.rb similarity index 100% rename from app/registries/foreman/settings/notification.rb rename to config/initializers/f_foreman_settings_notification.rb diff --git a/app/registries/foreman/settings/provisioning.rb b/config/initializers/f_foreman_settings_provisioning.rb similarity index 100% rename from app/registries/foreman/settings/provisioning.rb rename to config/initializers/f_foreman_settings_provisioning.rb diff --git a/config/initializers/foreman.rb b/config/initializers/foreman.rb index 66eb1d86dff..868b00deaf4 100644 --- a/config/initializers/foreman.rb +++ b/config/initializers/foreman.rb @@ -1,11 +1,6 @@ # stdlib dependencies require 'English' -# Registries from app/registries/ that do not create a namespace -# should be loaded manually due to Zeitwerk -require 'foreman/access_permissions' -require 'foreman/settings' - Rails.application.config.before_initialize do # load topbar Menu::Loader.load diff --git a/config/initializers/zeitwerk.rb b/config/initializers/zeitwerk.rb deleted file mode 100644 index f8bcd75b14d..00000000000 --- a/config/initializers/zeitwerk.rb +++ /dev/null @@ -1,9 +0,0 @@ -Rails.autoloaders.main.ignore( - Rails.root.join('lib/generators'), - Rails.root.join('lib/tasks') -) -Rails.autoloaders.once.ignore( - Rails.root.join('app/registries/foreman/access_permissions.rb'), - Rails.root.join('app/registries/foreman/settings.rb'), - Rails.root.join('app/registries/foreman/settings') -) diff --git a/test/unit/shared/access_permissions_test_base.rb b/test/unit/shared/access_permissions_test_base.rb index 319ea2dead3..5f697389ae8 100644 --- a/test/unit/shared/access_permissions_test_base.rb +++ b/test/unit/shared/access_permissions_test_base.rb @@ -1,5 +1,4 @@ require 'foreman/access_control' -require 'foreman/access_permissions' module AccessPermissionsTestBase extend ActiveSupport::Concern