Created
February 12, 2010 22:14
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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