Created
November 12, 2010 20:47
-
-
Save wayneeseguin/674648 to your computer and use it in GitHub Desktop.
Simple example of using the RVM Ruby API
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
# | |
# NOTE: You may require ~/.rvm/lib/rvm after adding ~/.rvm/lib to the load path $: | |
# OR 'gem install rvm' and require the RVM API as a gem! | |
# | |
require "rvm" | |
results = [] | |
# | |
# Iterate over an RVM Environment object for each interpreter | |
# NOTE: to use gemset simply use "1.9.2@gemsetname" for example. | |
# | |
RVM.environments("1.8.7","1.9.2").each do |environment| | |
# Collect the standard output of each ruby command run, | |
results << environment.ruby("test.rb").stdout | |
end | |
# Now iterate printing a nice and purty output | |
results.each do |result| | |
puts "=" * 80 | |
puts result | |
puts "=" * 80 | |
puts | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment