mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #32780 from ttanimichi/tmp
Don't generate assets' initializer in `app:update` task if sprockets is skipped
This commit is contained in:
commit
42b9e7e50c
4 changed files with 22 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
* Don't generate assets' initializer in `app:update` task if sprockets is skipped
|
||||
|
||||
*Tsukuru Tanimichi*
|
||||
|
||||
* Make the master.key file read-only for the owner upon generation on
|
||||
POSIX-compliant systems.
|
||||
|
||||
|
|
|
@ -146,6 +146,10 @@ module Rails
|
|||
template "config/storage.yml"
|
||||
end
|
||||
|
||||
if options[:skip_sprockets] && !assets_config_exist
|
||||
remove_file "config/initializers/assets.rb"
|
||||
end
|
||||
|
||||
unless rack_cors_config_exist
|
||||
remove_file "config/initializers/cors.rb"
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace :app do
|
|||
namespace :update do
|
||||
require "rails/app_updater"
|
||||
|
||||
# desc "Update config/boot.rb from your current rails install"
|
||||
# desc "Update config files from your current rails install"
|
||||
task :configs do
|
||||
Rails::AppUpdater.invoke_from_app_generator :create_boot_file
|
||||
Rails::AppUpdater.invoke_from_app_generator :update_config_files
|
||||
|
|
|
@ -296,6 +296,19 @@ class AppGeneratorTest < Rails::Generators::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_app_update_does_not_generate_assets_initializer_when_skip_sprockets_is_given
|
||||
app_root = File.join(destination_root, "myapp")
|
||||
run_generator [app_root, "--skip-sprockets"]
|
||||
|
||||
stub_rails_application(app_root) do
|
||||
generator = Rails::Generators::AppGenerator.new ["rails"], { update: true, skip_sprockets: true }, { destination_root: app_root, shell: @shell }
|
||||
generator.send(:app_const)
|
||||
quietly { generator.send(:update_config_files) }
|
||||
|
||||
assert_no_file "#{app_root}/config/initializers/assets.rb"
|
||||
end
|
||||
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"]
|
||||
|
|
Loading…
Reference in a new issue