joerichsen (owner)

Revisions

  • 8857b9 joerichsen Sat Dec 06 23:04:54 -0800 2008
  • abbcb3 joerichsen Sat Dec 06 23:04:08 -0800 2008
gist: 33052 Download_button fork
public
Public Clone URL: git://gist.github.com/33052.git
Embed All Files: show embed
Text only #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/ruby
 
# Adapted version of http://griffin.oobleyboo.com/archive/ruby-enterprise-edition-gem-install-script/
 
# 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-20081205/bin/ruby /opt/ruby-enterprise-1.8.6-20081205/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