欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

还是记录一下吧。。。capistrano for Rails3 cacapistranorails3 

程序员文章站 2022-05-10 16:57:38
...
最新的文章看这里: http://siwei.me/blog/posts/capistrano-basics

参考这个文章:

http://*.com/questions/4294970/rails-3-capistrano-tutorial-to-deploy-to-server-using-git


http://www.aaginskiy.com/technology/2011/02/deploying-rails-3-apps-with-capistrano/


1. vim Gemfile, 增加:

gem 'capistrano'

2. $ bundle install

3. $ capify .
会生成两个文件: Capfile ,  config/deploy.rb

4. 编辑后者,然后 $ cap deploy.

5. $ cap deploy:setup 会建立必须的 文件夹

6. 编辑 $ shared/config/database.yml

7. 加入下面几行:

  1 load 'deploy/assets'
  2 set :rake,      "bundle exec rake"
32 namespace :assets do
33   task :precompile do
34     run "cd #{release_path} && bundle exec rake RAILS_ENV=production RAILS_GROUPS=a
35   end
36 end
37
38 desc "Copy database.yml to release_path"
39   task :cp_database_yml do
40     puts "executing my customized command: "
41     puts "cp -r #{shared_path}/config/* #{release_path}/config/"
42     run "cp -r #{shared_path}/config/* #{release_path}/config/"
43   end
44
45 before "deploy:assets:symlink", :cp_database_yml
46


这里是一个完整的deploy.rb :

https://github.com/beijing-rubyist/bjrubyist/blob/master/config/deploy.rb