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

后端 未结 2 1408
失恋的感觉
失恋的感觉 2020-12-31 18:53

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

2条回答
  •  死守一世寂寞
    2020-12-31 19:44

    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

提交回复
热议问题