Skip to content

Instantly share code, notes, and snippets.

@aussiegeek
Created August 5, 2008 12:25
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 aussiegeek/4062 to your computer and use it in GitHub Desktop.
Save aussiegeek/4062 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
BASE='/opt/ruby-enterprise-1.8.6-20080624'
# The command to run for your vanila Ruby 'gem' command
OLD_GEM='gem'
# The command to run for REE's 'gem' command
NEW_GEM="#{BASE}/bin/ruby #{BASE}/bin/gem"
output=`#{OLD_GEM} list`
new_list=`#{NEW_GEM} list`
output.each do |line|
# Skip lines that don't look like a gem version
matches=line.match(/([A-Z].+) \(([0-9\., ]+)\)/i)
if matches then
gem_name=matches[1]
versions=matches[2]
versions.split(', ').each do |ver|
cmd="#{NEW_GEM} install #{gem_name} -v #{ver} --no-rdoc --no-ri --backtrace"
# See if this gem is already installed
if new_list =~ /#{gem_name} \(.*#{ver}.*\)/i then
puts "#{gem_name} #{ver} is already installed. Skipping"
else
puts cmd
system(cmd)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment