aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2018-05-07 07:56:00 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2018-05-07 07:56:00 +0900
commit9a1b99eb01eab3de4ab5c357058da0ecc38e434b (patch)
treefcda178127f8ccdfd3c7917b5f2f8b947f6dc7cc /railties
parent1c70756e1afc11d3f50e9f735ef60119a7e9da5f (diff)
downloadrails-9a1b99eb01eab3de4ab5c357058da0ecc38e434b.tar.gz
rails-9a1b99eb01eab3de4ab5c357058da0ecc38e434b.tar.bz2
rails-9a1b99eb01eab3de4ab5c357058da0ecc38e434b.zip
Skip `bootsnap` contents in `app:update` task if `bootsnap` is not used
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/app_updater.rb1
-rw-r--r--railties/test/generators/app_generator_test.rb13
2 files changed, 14 insertions, 0 deletions
diff --git a/railties/lib/rails/app_updater.rb b/railties/lib/rails/app_updater.rb
index a076d082d5..5e2ea93c5e 100644
--- a/railties/lib/rails/app_updater.rb
+++ b/railties/lib/rails/app_updater.rb
@@ -27,6 +27,7 @@ module Rails
options[:skip_action_cable] = !defined?(ActionCable::Engine)
options[:skip_sprockets] = !defined?(Sprockets::Railtie)
options[:skip_puma] = !defined?(Puma)
+ options[:skip_bootsnap] = !defined?(Bootsnap)
options
end
end
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 938d545219..bcfbcdfd80 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -323,6 +323,19 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
end
+ def test_app_update_does_not_generate_bootsnap_contents_when_skip_bootsnap_is_given
+ app_root = File.join(destination_root, "myapp")
+ run_generator [app_root, "--skip-bootsnap"]
+
+ FileUtils.cd(app_root) do
+ quietly { system("bin/rails app:update") }
+ end
+
+ assert_file "#{app_root}/config/boot.rb" do |content|
+ assert_no_match(/require 'bootsnap\/setup'/, content)
+ end
+ end
+
def test_gem_for_active_storage
run_generator
assert_file "Gemfile", /^# gem 'image_processing'/