Skip to content

Instantly share code, notes, and snippets.

@wayneeseguin
Created November 12, 2010 20:47
Show Gist options
  • Save wayneeseguin/674648 to your computer and use it in GitHub Desktop.
Save wayneeseguin/674648 to your computer and use it in GitHub Desktop.
Simple example of using the RVM Ruby API
#
# 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