Revert "FIX: deprecation warning - initialization autoloaded the constant (#12347)" (#12381)

This reverts commit 9a5a38a529.

This change was preventing `rake multisite:migrate` from working
This commit is contained in:
David Taylor 2021-03-12 13:48:46 +00:00 committed by GitHub
parent c3865659e7
commit 1533cbb38b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 163 additions and 176 deletions

View File

@ -55,8 +55,6 @@ require 'pry-rails' if Rails.env.development?
require 'discourse_fonts' require 'discourse_fonts'
require_relative '../lib/zeitwerk_config.rb'
if defined?(Bundler) if defined?(Bundler)
bundler_groups = [:default] bundler_groups = [:default]
@ -118,7 +116,6 @@ module Discourse
config.autoload_paths += Dir["#{config.root}/lib/validators/"] config.autoload_paths += Dir["#{config.root}/lib/validators/"]
Rails.autoloaders.main.ignore(Dir["#{config.root}/app/models/reports"]) Rails.autoloaders.main.ignore(Dir["#{config.root}/app/models/reports"])
Rails.autoloaders.main.ignore(Dir["#{config.root}/lib/freedom_patches"])
# Only load the plugins named here, in the order given (default is alphabetical). # Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named. # :all can be used as a placeholder for all plugins not explicitly named.

View File

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
Rails.application.reloader.to_prepare do
Dir["#{Rails.root}/lib/freedom_patches/*.rb"].each do |f| Dir["#{Rails.root}/lib/freedom_patches/*.rb"].each do |f|
require(f) require(f)
end end
end

View File

@ -16,7 +16,6 @@ if GlobalSetting.skip_redis?
return return
end end
Rails.application.reloader.to_prepare do
reload_settings = lambda { reload_settings = lambda {
RailsMultisite::ConnectionManagement.safe_each_connection do RailsMultisite::ConnectionManagement.safe_each_connection do
begin begin
@ -38,4 +37,3 @@ Rails.application.reloader.to_prepare do
reload_settings.call reload_settings.call
end end
end end
end

View File

@ -5,7 +5,6 @@
require 'i18n/backend/discourse_i18n' require 'i18n/backend/discourse_i18n'
require 'i18n/backend/fallback_locale_list' require 'i18n/backend/fallback_locale_list'
Rails.application.reloader.to_prepare do
I18n.backend = I18n::Backend::DiscourseI18n.new I18n.backend = I18n::Backend::DiscourseI18n.new
I18n.fallbacks = I18n::Backend::FallbackLocaleList.new I18n.fallbacks = I18n::Backend::FallbackLocaleList.new
I18n.config.missing_interpolation_argument_handler = proc { throw(:exception) } I18n.config.missing_interpolation_argument_handler = proc { throw(:exception) }
@ -18,4 +17,3 @@ Rails.application.reloader.to_prepare do
ExtraLocalesController.clear_cache! ExtraLocalesController.clear_cache!
end end
end end
end

View File

@ -1,15 +1,12 @@
# frozen_string_literal: true # frozen_string_literal: true
if GlobalSetting.skip_redis? if GlobalSetting.skip_redis?
Rails.application.reloader.to_prepare do
if Rails.logger.respond_to? :chained if Rails.logger.respond_to? :chained
Rails.logger = Rails.logger.chained.first Rails.logger = Rails.logger.chained.first
end end
end
return return
end end
Rails.application.reloader.to_prepare do
if Rails.env.development? && RUBY_VERSION.match?(/^2\.5\.[23]/) if Rails.env.development? && RUBY_VERSION.match?(/^2\.5\.[23]/)
STDERR.puts "WARNING: Discourse development environment runs slower on Ruby 2.5.3 or below" STDERR.puts "WARNING: Discourse development environment runs slower on Ruby 2.5.3 or below"
STDERR.puts "We recommend you upgrade to Ruby 2.6.1 for the optimal development performance" STDERR.puts "We recommend you upgrade to Ruby 2.6.1 for the optimal development performance"
@ -149,4 +146,3 @@ Rails.application.reloader.to_prepare do
url: plugin.metadata.url url: plugin.metadata.url
} }
end end
end