Guest User

Untitled

a guest
May 27th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #!/usr/bin/ruby
  2.  
  3. # The command to run for your vanila Ruby 'gem' command
  4. OLD_GEM='gem'
  5. # The command to run for REE's 'gem' command
  6. NEW_GEM='/opt/ruby-enterprise-1.8.6-20080507/bin/ruby /opt/ruby-enterprise-1.8.6-20080507/bin/gem'
  7.  
  8. output=`#{OLD_GEM} list`
  9. new_list=`#{NEW_GEM} list`
  10. output.each do |line|
  11. # Skip lines that don't look like a gem version
  12. matches=line.match(/([A-Z].+) \(([0-9\., ]+)\)/i)
  13. if matches then
  14. gem_name=matches[1]
  15. versions=matches[2]
  16. versions.split(', ').each do |ver|
  17. cmd="#{NEW_GEM} install #{gem_name} -v #{ver} --no-rdoc --no-ri --backtrace -y"
  18. # See if this gem is already installed
  19. if new_list =~ /#{gem_name} \(.*#{ver}.*\)/i then
  20. puts "#{gem_name} #{ver} is already installed. Skipping"
  21. else
  22. puts cmd
  23. system(cmd)
  24. end
  25. end
  26. end
  27. end
Add Comment
Please, Sign In to add comment