1

我是 Capistrano 的新手,我想知道如何控制特定名称空间中任务的执行顺序。

例如,我的部署命名空间中有一些额外的任务。我希望 deploy:bundle 和 deploy:assets 在 deploy:restart 之前运行,所以我添加了这些行

after 'deploy:update_code', 'deploy:bundle'
after 'deploy:bundle', 'deploy:assets'
after 'deploy:assets', 'deploy:restart'

我不确定你是否应该这样做。如果你们对我有什么建议,请告诉我!

namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true }
do
    run "touch #{current_path}/tmp/restart.txt"
  end

 task :bundle do
   run "cd #{current_path} && bundle install"
 end

 task :assets do
    run "cd #{current_path} && bundle exec rake assets:precompile"
 end

 end

after 'deploy:update_code', 'deploy:bundle'
after 'deploy:bundle', 'deploy:assets'
after 'deploy:assets', 'deploy:restart'
4

0 回答 0