aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorYuji Yaginuma <yuuji.yaginuma@gmail.com>2018-05-14 07:29:03 +0900
committerGitHub <noreply@github.com>2018-05-14 07:29:03 +0900
commitdf850b8d7126044a820291bbfd2bce80636a442c (patch)
tree83a9ef2dd01030e1366d53b4ba242a431fdc9526 /railties
parent448cb2148c1cfcef25b2c8964d8320f613e19c7c (diff)
parent8efa112ca625cf8e895ed5af1433dce430929970 (diff)
downloadrails-df850b8d7126044a820291bbfd2bce80636a442c.tar.gz
rails-df850b8d7126044a820291bbfd2bce80636a442c.tar.bz2
rails-df850b8d7126044a820291bbfd2bce80636a442c.zip
Merge pull request #32837 from ttanimichi/app-update-skip-spring
Don't generate `config/spring.rb` in `app:update` task when spring isn't loaded
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG.md6
-rw-r--r--railties/lib/rails/app_updater.rb1
-rw-r--r--railties/test/generators/app_generator_test.rb11
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"]