Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svenfuchs/921492 to your computer and use it in GitHub Desktop.
Save svenfuchs/921492 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# How to run a system command from ruby within a clean bash that has never sourced rvm using a custom ruby version
# 1) install rvm as the correct user
# 2) do NOT follow the instructions about sourcing and adding this to your .bashrc
# 3) run the following (change the versions accordingly)
ruby_versions = %w(ruby-1.8.7-p330 rbx-head)
ruby_versions.each do |version|
puts ('>' * 20) + " #{version}"
%w(true false).each do |bool|
puts %Q~the following should output "#{bool}"~
p system(%Q~bash -c 'FOO=#{version}; source "/home/niklas/.rvm/scripts/rvm"; rvm use #{version}; ruby -v; echo "echo $FOO"; #{bool}'~)
puts ('=' * 20)
end
puts ('<' * 20)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment