Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Setting the RakeFileUtils.verbose_flag default to false #4858

Closed
wants to merge 3 commits into from

2 participants

@aia
aia commented

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
$
@jeremyf

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

@jeremyf

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

@aia aia closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 3, 2012
  1. @aia
Commits on Feb 9, 2012
  1. @aia
Commits on Feb 24, 2012
  1. @aia
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  actionpack/lib/sprockets/assets.rake
View
1  actionpack/lib/sprockets/assets.rake
@@ -6,6 +6,7 @@ namespace :assets do
groups = ENV['RAILS_GROUPS'] || 'assets'
args = [$0, task,"RAILS_ENV=#{env}","RAILS_GROUPS=#{groups}"]
args << "--trace" if Rake.application.options.trace
+ RakeFileUtils.verbose_flag = false if RakeFileUtils.verbose_flag == RakeFileUtils::DEFAULT
if $0 =~ /rake\.bat\Z/i
Kernel.exec $0, *args
else
Something went wrong with that request. Please try again.