部署 capistrano 部署的 task 应该写在 capfile 还是 config/deploy.rb

luoping0425 · August 15, 2012 · Last by luoping0425 replied at August 29, 2012 · 3306 hits

求问:capistrano 部署的 task 应该写在 capfile 还是 config/deploy.rb。

我们现在的部署脚本一直是写在 config/deploy.rb 中,之前忘记哪里看到可以写到 Capfile 中,capistrano 中的 wiki 中也说到:

The Capfile is where you will tell Capistrano about the servers you want to connect to and the tasks you want to perform on those servers. 

https://github.com/capistrano/capistrano/wiki/2.x-Getting-Started

想知道大家平常是怎么写的,还有为什么这样写?

一般全写在config/deploy.rb里,已经够用。 Capfile 一般是用来加载其它文件,包括'config/deploy',所以config/deploy里的都可以写在这里。 如果你需要多个部署文件,可以在Capfile里 load 进来

#1 楼 @camel 非常感谢,参考过 ruby-china 的东西,也是放在 config/deploy.rb 中。

You need to Sign in before reply, if you don't have an account, please Sign up first.