Skip to content

Instantly share code, notes, and snippets.

@nathmisaki
Created June 4, 2010 17:58
Show Gist options
  • Save nathmisaki/425733 to your computer and use it in GitHub Desktop.
Save nathmisaki/425733 to your computer and use it in GitHub Desktop.
versions = Dir[File.join('/home/nelson/.rvm/rubies', "ruby*")]
versions.each do |version|
version.match(/-([\d\.]\+)-/)
ruby_version_string = version.split('/').last
ruby_version = $1
ENV['GEM_PATH'] = Dir["/home/nelson/.rvm/gems/#{ruby_version_string}*/"].join(':')
Dir.chdir '/home/nelson/projects/morpheus'
system(%&#{File.join(version, 'bin/ruby')} -r 'rubygems' -e "STDOUT.puts Gem.source_index.spec_dirs ;STDOUT.puts RUBY_VERSION; load Gem.bin_path('rspec', 'spec')" spec &)
end
@tomas-stefano
Copy link

Result

$ ruby rvm_gist.rb

/Users/tomas/.rvm/gems/ruby-1.8.7-p249/specifications

/Users/tomas/.rvm/gems/ruby-1.8.7-p249@global/specifications

/Users/tomas/.rvm/gems/ruby-1.8.7-p249/specifications

1.8.7
.............................................................................................................................

Finished in 0.182365 seconds

125 examples, 0 failures

/Users/tomas/.rvm/gems/ruby-1.9.1-p378/specifications

/Users/tomas/.rvm/gems/ruby-1.9.1-p378@a-new-gemset-where-no-gems-are-installed/specifications

/Users/tomas/.rvm/gems/ruby-1.9.1-p378@global/specifications

/Users/tomas/.rvm/gems/ruby-1.8.7-p249/specifications

1.9.1
.............................................................................................................................

Finished in 0.205788 seconds

125 examples, 0 failures

/Users/tomas/.rvm/gems/ruby-1.9.2-preview1/specifications

/Users/tomas/.rvm/gems/ruby-1.9.2-preview1@global/specifications

/Users/tomas/.rvm/gems/ruby-1.8.7-p249/specifications

1.9.2
.............................................................................................................................

Finished in 0.1815 seconds

125 examples, 0 failures

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