Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- # The command to run for your vanila Ruby 'gem' command
- OLD_GEM='gem'
- # The command to run for REE's 'gem' command
- NEW_GEM='/opt/ruby-enterprise-1.8.6-20080507/bin/ruby /opt/ruby-enterprise-1.8.6-20080507/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 -y"
- # 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
Add Comment
Please, Sign In to add comment