开发者

How can I run rake with --trace within capistrano?

开发者 https://www.devze.com 2023-03-28 20:04 出处:网络
I want capistrano to invoke rake with --trace so I can figure out why it\'s failing. How do开发者_JAVA技巧 I do this? set :rake \'rake --trace\' doesn\'t work.The best way I found is:

I want capistrano to invoke rake with --trace so I can figure out why it's failing. How do开发者_JAVA技巧 I do this? set :rake 'rake --trace' doesn't work.


The best way I found is:

set :rake, "#{rake} --trace"

This way you don't overwrite the rake variable.

For example if you use bundler this is set before to:

"bundle exec rake"

and after to:

"bundle exec rake --trace"


The chances are your custom tasks aren't using the rake variables, but instead hard-coding rake, here's an example:

run("rake sass:compile")

This is hard-coded, and won't care about your setting set :rake, 'rake --trace', here's the correct way:

run("#{fetch(:rake)} sass:compile")

Or, shorthand:

run("#{rake} sass:compile")

You can see this in practice in the Capistrano source code, in the one place that the default recipes actually invoke rake, in the migrations task: https://github.com/capistrano/capistrano/blob/master/lib/capistrano/recipes/deploy.rb#L387

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号