From 3ec2fefcee6d21cbc07cc84ddfc2b32f21783015 Mon Sep 17 00:00:00 2001 From: Edouard CHIN Date: Wed, 13 Nov 2024 19:59:09 +0100 Subject: [PATCH] Put back the quiet assets in development: - This was removed in 0f43feda04d45aec064aedc312d265a529e4915d. This option is supported by propshaft. Currently, the terminal is clutted with assets request log. --- .../app/templates/config/environments/development.rb.tt | 5 +++++ railties/test/generators/app_generator_test.rb | 5 +++++ railties/test/generators/plugin_generator_test.rb | 4 +--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt index f73de40e71753..7a13395d9a285 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt @@ -64,6 +64,11 @@ Rails.application.configure do # Highlight code that enqueued background job in logs. config.active_job.verbose_enqueue_logs = true + <%- end -%> + <%- unless options[:skip_asset_pipeline] -%> + # Suppress logger output for asset requests. + config.assets.quiet = true + <%- end -%> # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 0dcf3374812d0..a938788684123 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -600,6 +600,11 @@ def test_inclusion_of_rubocop assert_file "config/environments/development.rb", %r|# Apply autocorrection by RuboCop to files generated by `bin/rails generate`\.| end + def test_quiet_assets_in_development + run_generator + assert_file "config/environments/development.rb", /config\.assets\.quiet = true/ + end + def test_rubocop_is_skipped_if_required run_generator [destination_root, "--skip-rubocop"] diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index 014fd1facb4ca..4ab564934331b 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -659,9 +659,7 @@ def test_dummy_application_configures_asset_pipeline_when_full assert_gem "propshaft" assert_file "test/dummy/config/initializers/assets.rb" - assert_file "test/dummy/config/environments/development.rb" do |content| - assert_no_match "config.assets", content - end + assert_file "test/dummy/config/environments/development.rb" end def test_dummy_application_skips_asset_pipeline_when_flag_skip_asset_pipeline