public
Last active

  • Download Gist
chef-rvm-ruby.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
deploy_user = node[:deploy][:user]
deploy_user_home = File.join('/', 'home', deploy_user)
rvm_version = "head"
 
execute "install_rvm_for_deploy_user" do
user deploy_user
command "curl -L https://get.rvm.io | bash -s #{rvm_version}"
environment "HOME" => deploy_user_home
creates "#{deploy_user_home}/.rvm"
end
 
node['buildpack']['ruby_versions'].each do |ruby_version|
execute "install_rvm_ruby_#{ruby_version}" do
user deploy_user
environment "HOME" => deploy_user_home
command "#{deploy_user_home}/.rvm/bin/rvm install #{ruby_version} --autolibs=3"
end
end
 
file "#{deploy_user_home}/.rvmrc" do
content 'export rvm_trust_rvmrcs_flag=1'
owner deploy_user
mode 0644
end

Hi Artur, thanks for the gist!

I wanted also to set the default ruby after all, i.e. rvm --default use ruby-X.Y.Z. The command did not fail but no default ruby was set and the RVM suggested to use a login shell thing for the invocation, i.e. /bin/bash --login...

No matter what I tried to do I could not manage it to work properly. If you were to set default ruby, how would you do that?

Thanks!

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.