在部署期间,我想在capistrano部署期间在/ current文件夹中创build一个.rvmrc文件。
我怎样才能做到这一点?
您可以使用以下语法将任务添加到Capistrano部署中:
task :gitinstall do run "apt-get update" run "apt-get -y install git-core" end before "deploy:update", :gitinstall
这个例子让每台机器在运行deploy之前安装git。 所有你需要做的是修改这个wget有问题的文件或做一个bash回声。
我会把这个留在这里作为参考。 应该使用新版本的rbenv或rvm。
namespace :deploy do desc 'Sets the ruby version' task :set_ruby_version do put "2.0.0-p0", "#{latest_release}/.ruby-version" end end after 'deploy:update_code', 'deploy:set_ruby_version'
或者,如果您使用的是capistrano / bundler,则需要使用此钩子:
before 'bundle:install', 'deploy:set_ruby_version'