2

During my deploy, I want to create a .rvmrc file in the /current folder during a capistrano deployment.

How can I do this?

Blankman
  • 2,891
  • 10
  • 39
  • 68

2 Answers2

1

You can add tasks to a Capistrano deploy using syntax shown below :

task :gitinstall do
   run "apt-get update"
   run "apt-get -y install git-core"
end
before "deploy:update", :gitinstall

This example has each machine install git before running the deploy. All you have to do is modify this to wget the file in question or do a bash echo.

Antoine Benkemoun
  • 7,314
  • 3
  • 42
  • 60
0

I'll leave this here as reference. Should work with newer versions of rbenv or 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'

or, if you're using capistrano/bundler, you need this hook instead:

before 'bundle:install', 'deploy:set_ruby_version'