Skip to content

Commit

Permalink
Add quiet_assets as development dependency
Browse files Browse the repository at this point in the history
I typically search the logs to find parameters, response codes and
stacktraces. Although we don't need to see what assets have been loaded,
those logs take up more space than the aforementioned ones.

`quiet_assets` hide the assets logs in development, making the log for
the landing page on my current suspenders project go from 64 lines
detailing assets, to 13 relevant lines.

We also add explicit quiet_assets configuration in
`config/application.rb` file so that way we can easily disable this gem
when we need to debug assets in development.
  • Loading branch information
tute committed Oct 23, 2015
1 parent bfd75f9 commit 3a06edf
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ And development gems like:
pre-loading
* [Web Console](https://github.com/rails/web-console) for better debugging via
in-browser IRB consoles.
* [Quiet Assets](https://github.com/evrone/quiet_assets) for muting assets
pipeline log messages

And testing gems like:

Expand Down
8 changes: 8 additions & 0 deletions lib/suspenders/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ def raise_on_unpermitted_parameters
inject_into_class "config/application.rb", "Application", config
end

def configure_quiet_assets
config = <<-RUBY
config.quiet_assets = true
RUBY

inject_into_class "config/application.rb", "Application", config
end

def provide_setup_script
template "bin_setup.erb", "bin/setup", force: true
run "chmod a+x bin/setup"
Expand Down
1 change: 1 addition & 0 deletions lib/suspenders/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def setup_development_environment
build :provide_dev_prime_task
build :configure_generators
build :configure_i18n_for_missing_translations
build :configure_quiet_assets
end

def setup_test_environment
Expand Down
8 changes: 8 additions & 0 deletions spec/features/new_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@
)
end

it "adds explicit quiet_assets configuration" do
result = IO.read("#{project_path}/config/application.rb")

expect(result).to match(
/^ +config.quiet_assets = true$/
)
end

it "raises on missing translations in development and test" do
%w[development test].each do |environment|
environment_file =
Expand Down
1 change: 1 addition & 0 deletions templates/Gemfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ gem "title"
gem "uglifier"

group :development do
gem "quiet_assets"
gem "refills"
gem "spring"
gem "spring-commands-rspec"
Expand Down

0 comments on commit 3a06edf

Please sign in to comment.