Setting the RakeFileUtils.verbose_flag default to false #4858

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
2 participants

aia commented Feb 3, 2012

Running rake assets:precompile produces the following

rake assets:precompile
/Users/artem/.rvm/rubies/ruby-1.9.3-p0/bin/ruby /Users/artem/.rvm/gems/ruby-1.9.3-p0@rails-edge/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets

There is an extra line showing a command that I did not ask for. Looks harmless.

However, when running from Capistrano the result is the following:

cap deploy
[snip]

  * 21:16:28 == Currently executing `deploy:assets:precompile'
  * executing "cd /home/rails/captest/releases/20120203051625 & & bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
    servers: ["192.168.147.17"]
    [192.168.147.17] executing command
*** [err :: 192.168.147.17] /usr/bin/ruby /home/rails/captest/shared/bundle/ruby/1.9.1/bin/rake assets:precompile:nondigest RAILS_ENV=production RAILS_GROUPS=assets
*** [err :: 192.168.147.17] 

[snip]

The output comes out on stderr and Capistrano and automations built on Capistrano treat it as an error.

This small annoyance was big enough for me to actually find out why rake assets:precompile produces stderr output in a deployment mode.

The cause of this is the following commit to rake:
jimweirich/rake@d383d95

By default FileUtilsExt.verbose_flag = DEFAULT = Object.new (not true/false/nil etc) which has the same effect as the default true.

Arguable, Rake's FileUtilsExt default verbose = on setting is there by design and it may be a reasonable default for Rake. However, verbose = on is not a reasonable default for Rails because of deployment tools that treat output on stderr as errors.

With the attached fix the behavior changes to the following:

$ rake assets:precompile
$ rake assets:precompile -v
/Users/artem/.rvm/rubies/ruby-1.9.3-p0/bin/ruby /Users/artem/.rvm/gems/ruby-1.9.3-p0@rails-edge/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
$
Contributor

jeremyf commented May 3, 2012

This did not merge cleanly; Master appears to have deleted actionpack/lib/sprockets/assets.rake

Contributor

jeremyf commented May 4, 2012

@aia Since the target has moved, can you close the pull request?

@aia aia closed this May 4, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment