diff options
author | Xavier Noria <fxn@hashref.com> | 2019-02-13 10:41:28 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2019-02-13 12:27:53 -0800 |
commit | c36b6c8d38c33fd03594ba54aaed0e945ddfe0ec (patch) | |
tree | 0946312983391ba1178a081eaa09f66e62f5efb6 /railties | |
parent | b4dd69e59b3cb5c34bd58339d5b9a749e2cd82f3 (diff) | |
download | rails-c36b6c8d38c33fd03594ba54aaed0e945ddfe0ec.tar.gz rails-c36b6c8d38c33fd03594ba54aaed0e945ddfe0ec.tar.bz2 rails-c36b6c8d38c33fd03594ba54aaed0e945ddfe0ec.zip |
Let Zeitwerk be a dependency of Active Support
Zeitwerk is a strong dependency, planned to replace AS::Dependencies. A
line in the generated Gemfile does not convey this as much.
Diffstat (limited to 'railties')
4 files changed, 7 insertions, 18 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 16fbc99e7a..af3ec36064 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -271,7 +271,11 @@ module Rails end def autoloader=(autoloader) - if %i(classic zeitwerk).include?(autoloader) + case autoloader + when :classic + @autoloader = autoloader + when :zeitwerk + require "zeitwerk" @autoloader = autoloader else raise ArgumentError, "config.autoloader may be :classic or :zeitwerk, got #{autoloader.inspect} instead" diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile.tt b/railties/lib/rails/generators/rails/app/templates/Gemfile.tt index a1f1224a45..783254b54d 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile.tt +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile.tt @@ -36,9 +36,7 @@ gem 'bootsnap', '>= 1.4.0', require: false # gem 'rack-cors' <%- end -%> -<% if RUBY_ENGINE == "ruby" -%> -gem "zeitwerk", ">= 1.0.0" - +<% if RUBY_ENGINE == 'ruby' -%> group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 937b8eb427..1ee9e43e89 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -660,15 +660,6 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_gem "jbuilder" end - def test_inclusion_of_zeitwerk - run_generator - if RUBY_ENGINE == "ruby" - assert_gem "zeitwerk" - else - assert_no_gem "zeitwerk" - end - end - def test_inclusion_of_a_debugger run_generator if defined?(JRUBY_VERSION) || RUBY_ENGINE == "rbx" diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 47d42645c6..4442cdf4bf 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -491,11 +491,7 @@ Module.new do # Fake 'Bundler.require' -- we run using the repo's Gemfile, not an # app-specific one: we don't want to require every gem that lists. contents = File.read("#{app_template_path}/config/application.rb") - if RUBY_ENGINE == "ruby" - contents.sub!(/^Bundler\.require.*/, "%w(turbolinks webpacker zeitwerk).each { |r| require r }") - else - contents.sub!(/^Bundler\.require.*/, "%w(turbolinks webpacker).each { |r| require r }") - end + contents.sub!(/^Bundler\.require.*/, "%w(turbolinks webpacker).each { |r| require r }") File.write("#{app_template_path}/config/application.rb", contents) require "rails" |