Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

How can I do this?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
thanks, but why 'bash echo', I need a command to create a file on the fly and add something like ruby-version@gemset_name no? –  Blankman Dec 18 '10 at 17:04
1  
If you need to add that in the file you can do : echo "ruby-version@gemset_name no" >> ~/.rvmrc –  Antoine Benkemoun Dec 18 '10 at 22:24
add comment

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'
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.