diff options
author | Tsukuru Tanimichi <info+git@ttanimichi.com> | 2018-05-07 17:25:01 +0900 |
---|---|---|
committer | Tsukuru Tanimichi <info+git@ttanimichi.com> | 2018-05-13 21:51:10 +0900 |
commit | 8efa112ca625cf8e895ed5af1433dce430929970 (patch) | |
tree | f925fb97db1dd171fa996f219b950045633b1776 /railties | |
parent | 9a1b99eb01eab3de4ab5c357058da0ecc38e434b (diff) | |
download | rails-8efa112ca625cf8e895ed5af1433dce430929970.tar.gz rails-8efa112ca625cf8e895ed5af1433dce430929970.tar.bz2 rails-8efa112ca625cf8e895ed5af1433dce430929970.zip |
Don't generate `config/spring.rb` in `app:update` task when spring isn't loaded
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG.md | 6 | ||||
-rw-r--r-- | railties/lib/rails/app_updater.rb | 1 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 11 |
3 files changed, 17 insertions, 1 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 5d5ab61ef2..cf780940d1 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,4 +1,8 @@ -* Don't generate assets' initializer in `app:update` task if sprockets is skipped +* Don't generate unused files in `app:update` task + + Skip the assets' initializer when sprockets isn't loaded. + + Skip `config/spring.rb` when spring isn't loaded. *Tsukuru Tanimichi* diff --git a/railties/lib/rails/app_updater.rb b/railties/lib/rails/app_updater.rb index 5e2ea93c5e..e37839bf11 100644 --- a/railties/lib/rails/app_updater.rb +++ b/railties/lib/rails/app_updater.rb @@ -28,6 +28,7 @@ module Rails options[:skip_sprockets] = !defined?(Sprockets::Railtie) options[:skip_puma] = !defined?(Puma) options[:skip_bootsnap] = !defined?(Bootsnap) + options[:skip_spring] = !defined?(Spring) options end end diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index bcfbcdfd80..f73747208b 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -309,6 +309,17 @@ class AppGeneratorTest < Rails::Generators::TestCase end end + def test_app_update_does_not_generate_spring_contents_when_skip_spring_is_given + app_root = File.join(destination_root, "myapp") + run_generator [app_root, "--skip-spring"] + + FileUtils.cd(app_root) do + quietly { system("bin/rails app:update") } + end + + assert_no_file "#{app_root}/config/spring.rb" + end + def test_app_update_does_not_generate_action_cable_contents_when_skip_action_cable_is_given app_root = File.join(destination_root, "myapp") run_generator [app_root, "--skip-action-cable"] |