Skip to content

Instantly share code, notes, and snippets.

@pcreux
Created February 12, 2010 22:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcreux/303038 to your computer and use it in GitHub Desktop.
Save pcreux/303038 to your computer and use it in GitHub Desktop.
Migrate rubygems to Ruby Enterprise Edition (REE) - Make REE install the gems used by your default ruby environment.
#!/usr/bin/ruby
# Migrate rubygems to Ruby Enterprise Edition (REE)
# Make REE install the gems used by your default ruby environment.
REE_PATH = ENV['REE_PATH'] || Dir.glob('/opt/ruby-enterprise-*').last
unless REE_PATH
puts "Can't find path to ruby enterprise edition. Please use the following command:"
puts "REE_PATH=/path/to/ruby-enterprise ruby migrate-rubygems-to-ree"
exit 1
end
gem_cmd = REE_PATH + '/bin/gem'
options = 'install --no-rdoc --no-ri'
require 'rubygems'
# gem_list = ['activerecord-2.3.5', ...]
gem_list = Gem.source_index.map { |a| a.first }.sort
# gem_list_cmd = ['activerecord -v 2.3.5', ...]
gem_list_cmd = gem_list.map { |g|
a = g.split('-')
a[0..-2].join('-') + ' -v ' + a[-1]
}
# install command
gem_list_cmd.each do |gem|
puts cmd = [gem_cmd, options, gem].join(' ')
system cmd
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment