Skip to content

Instantly share code, notes, and snippets.

@apsoto
Forked from adamhjk/rvm-your-chef.rb
Created July 7, 2010 23:46
Show Gist options
  • Save apsoto/467452 to your computer and use it in GitHub Desktop.
Save apsoto/467452 to your computer and use it in GitHub Desktop.
Chef - Invoke rvm and inherit the environment updates
# Check this out, rvm use rbx
ruby_block "rvm use rbx" do
block do
Chef::Mixin::Command.popen4('bash -l -c "rvm use 1.9.1 && env"') do |p,i,o,e|
o.each_line do |line|
env_bits = line.split("=")
ENV[env_bits[0]] = env_bits[1]
end
end
end
end
# All future stuff should get the rvm environment
gem_package "rails"
@ryansch
Copy link

ryansch commented Apr 19, 2011

You need a chomp on line 7 to prevent newlines from getting into your env vars. See my fork.

@apsoto
Copy link
Author

apsoto commented Apr 19, 2011

thx for the notice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment