-
-
Save svenfuchs/921492 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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