2012-03-26 90 views
0

有什么办法可以简化我的部署过程?我目前使用这些Git和Capistrano的命令:简化部署与Capistrano

git add . 
git commit -am 'Comment...' 
git push [name] 

cap deploy:setup 
cap deploy 
cap deploy:cleanup 

所以,如果我想使小的变化,我必须输入密码四次(一次推,一次设置,并两次部署)。有什么办法可以减少命令的数量吗?

回答

1

你的git工作流程非常标准,你不会简化它很多。我想,你不需要推动每个提交,并且许多小的原子提交没有任何问题。

尽管如此,为什么每次都要运行设置和清理?你不能只跑cap deploy?如果您每次需要运行cleanup,请尝试重新定义deploy的默认值以包含它。在您的deploy.rb

 
namespace :deploy do 
    desc <<-DESC 
    Deploys your project. This calls both `update' and `restart'. Note that \ 
    this will generally only work for applications that have already been deployed \ 
    once. For a "cold" deploy, you'll want to take a look at the `deploy:cold' \ 
    task, which handles the cold start specifically. 
    DESC 
    task :default do 
    update 
    restart 
    cleanup # <-- this is added 
    end 
end 

如果你有一个很好的理由,每次运行setup,您可以添加到重新定义默认任务为好。