From aaf59610548d9b0fd01acfd50e831cbe519ecba2 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 18 Mar 2020 15:09:45 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- config/application.rb | 2 + config/environments/development.rb | 2 +- config/environments/test.rb | 2 +- config/initializers/2_gitlab.rb | 1 - .../initializers_before_autoloader/002_zeitwerk.rb | 59 ++++++++++++++++++++++ config/settings.rb | 6 --- 6 files changed, 63 insertions(+), 9 deletions(-) delete mode 100644 config/initializers/2_gitlab.rb create mode 100644 config/initializers_before_autoloader/002_zeitwerk.rb (limited to 'config') diff --git a/config/application.rb b/config/application.rb index 14e92bf5905..e1be913b5c3 100644 --- a/config/application.rb +++ b/config/application.rb @@ -32,6 +32,8 @@ module Gitlab config.active_record.sqlite3.represent_boolean_as_integer = true + config.autoloader = :zeitwerk + # Sidekiq uses eager loading, but directories not in the standard Rails # directories must be added to the eager load paths: # https://github.com/mperham/sidekiq/wiki/FAQ#why-doesnt-sidekiq-autoload-my-rails-application-code diff --git a/config/environments/development.rb b/config/environments/development.rb index 25d57467060..c42d7127a22 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -42,7 +42,7 @@ Rails.application.configure do config.action_mailer.raise_delivery_errors = true # Don't make a mess when bootstrapping a development environment config.action_mailer.perform_deliveries = (ENV['BOOTSTRAP'] != '1') - config.action_mailer.preview_path = 'app/mailers/previews' + config.action_mailer.preview_path = Rails.root.join('app', 'mailers', 'previews') config.eager_load = false diff --git a/config/environments/test.rb b/config/environments/test.rb index 71cd5200415..f8fb7f60f0d 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -43,7 +43,7 @@ Rails.application.configure do # Print deprecation notices to the stderr config.active_support.deprecation = :stderr - config.eager_load = true + config.eager_load = false config.cache_store = :null_store diff --git a/config/initializers/2_gitlab.rb b/config/initializers/2_gitlab.rb deleted file mode 100644 index 8b7f245b7b0..00000000000 --- a/config/initializers/2_gitlab.rb +++ /dev/null @@ -1 +0,0 @@ -require_dependency 'gitlab' diff --git a/config/initializers_before_autoloader/002_zeitwerk.rb b/config/initializers_before_autoloader/002_zeitwerk.rb new file mode 100644 index 00000000000..df0c16b0bc0 --- /dev/null +++ b/config/initializers_before_autoloader/002_zeitwerk.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +Rails.autoloaders.each do |autoloader| + # We need to ignore these since these are non-Ruby files + # that do not define Ruby classes / modules + autoloader.ignore(Rails.root.join('lib/support')) + # Ignore generators since these are loaded manually by Rails + autoloader.ignore(Rails.root.join('lib/generators')) + autoloader.ignore(Rails.root.join('ee/lib/generators')) if Gitlab.ee? + # Mailer previews are also loaded manually by Rails + autoloader.ignore(Rails.root.join('app/mailers/previews')) + autoloader.ignore(Rails.root.join('ee/app/mailers/previews')) if Gitlab.ee? + # Ignore these files because these are only used in Rake tasks + # and are not available in production + autoloader.ignore(Rails.root.join('lib/gitlab/graphql/docs')) + + autoloader.inflector.inflect( + 'authenticates_2fa_for_admin_mode' => 'Authenticates2FAForAdminMode', + 'api' => 'API', + 'api_guard' => 'APIGuard', + 'group_api_compatibility' => 'GroupAPICompatibility', + 'project_api_compatibility' => 'ProjectAPICompatibility', + 'cte' => 'CTE', + 'recursive_cte' => 'RecursiveCTE', + 'cidr' => 'CIDR', + 'cli' => 'CLI', + 'dn' => 'DN', + 'hmac_token' => 'HMACToken', + 'html' => 'HTML', + 'html_parser' => 'HTMLParser', + 'html_gitlab' => 'HTMLGitlab', + 'http' => 'HTTP', + 'http_connection_adapter' => 'HTTPConnectionAdapter', + 'http_clone_enabled_check' => 'HTTPCloneEnabledCheck', + 'chunked_io' => 'ChunkedIO', + 'http_io' => 'HttpIO', + 'json' => 'JSON', + 'json_formatter' => 'JSONFormatter', + 'json_web_token' => 'JSONWebToken', + 'as_json' => 'AsJSON', + 'ldap_key' => 'LDAPKey', + 'mr_note' => 'MRNote', + 'pdf' => 'PDF', + 'rsa_token' => 'RSAToken', + 'san_extension' => 'SANExtension', + 'sca' => 'SCA', + 'spdx' => 'SPDX', + 'sql' => 'SQL', + 'ssh_key' => 'SSHKey', + 'ssh_key_with_user' => 'SSHKeyWithUser', + 'ssh_public_key' => 'SSHPublicKey', + 'git_push_ssh_proxy' => 'GitPushSSHProxy', + 'git_user_default_ssh_config_check' => 'GitUserDefaultSSHConfigCheck', + 'binary_stl' => 'BinarySTL', + 'text_stl' => 'TextSTL', + 'svg' => 'SVG', + 'function_uri' => 'FunctionURI' + ) +end diff --git a/config/settings.rb b/config/settings.rb index 144a068ef2a..a9e91ce22d7 100644 --- a/config/settings.rb +++ b/config/settings.rb @@ -3,12 +3,6 @@ require 'settingslogic' require 'digest/md5' -# We can not use `Rails.root` here, as this file might be loaded without the -# full Rails environment being loaded. We can not use `require_relative` either, -# as Rails uses `load` for `require_dependency` (used when loading the Rails -# environment). This could then lead to this file being loaded twice. -require_dependency File.expand_path('../lib/gitlab', __dir__) - class Settings < Settingslogic source ENV.fetch('GITLAB_CONFIG') { Pathname.new(File.expand_path('..', __dir__)).join('config/gitlab.yml') } namespace ENV.fetch('GITLAB_ENV') { Rails.env } -- cgit v1.2.3