1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Update to RubyGems 1.3.0 r1891

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2008-09-25 10:13:50 +00:00
parent 788001a9c8
commit d478c7a734
60 changed files with 2174 additions and 1049 deletions

View file

@ -45,6 +45,8 @@ class Gem::Commands::UpdateCommand < Gem::Command
end
def execute
hig = {}
if options[:system] then
say "Updating RubyGems"
@ -52,16 +54,22 @@ class Gem::Commands::UpdateCommand < Gem::Command
fail "No gem names are allowed with the --system option"
end
options[:args] = ["rubygems-update"]
spec = Gem::Specification.new
spec.name = 'rubygems-update'
spec.version = Gem::Version.new Gem::RubyGemsVersion
spec.version = Gem::Version.new '1.1.1'
hig['rubygems-update'] = spec
options[:user_install] = false
else
say "Updating installed gems"
end
hig = {} # highest installed gems
hig = {} # highest installed gems
Gem.source_index.each do |name, spec|
if hig[spec.name].nil? or hig[spec.name].version < spec.version then
hig[spec.name] = spec
Gem.source_index.each do |name, spec|
if hig[spec.name].nil? or hig[spec.name].version < spec.version then
hig[spec.name] = spec
end
end
end
@ -84,14 +92,14 @@ class Gem::Commands::UpdateCommand < Gem::Command
end
if gems_to_update.include? "rubygems-update" then
latest_ruby_gem = remote_gemspecs.select do |s|
s.name == 'rubygems-update'
end
Gem.source_index.refresh!
latest_ruby_gem = latest_ruby_gem.sort_by { |s| s.version }.last
update_gems = Gem.source_index.search 'rubygems-update'
say "Updating version of RubyGems to #{latest_ruby_gem.version}"
installed = do_rubygems_update latest_ruby_gem.version
latest_update_gem = update_gems.sort_by { |s| s.version }.last
say "Updating RubyGems to #{latest_update_gem.version}"
installed = do_rubygems_update latest_update_gem.version
say "RubyGems system software updated" if installed
else
@ -103,6 +111,9 @@ class Gem::Commands::UpdateCommand < Gem::Command
end
end
##
# Update the RubyGems software to +version+.
def do_rubygems_update(version)
args = []
args.push '--prefix', Gem.prefix unless Gem.prefix.nil?
@ -112,8 +123,6 @@ class Gem::Commands::UpdateCommand < Gem::Command
update_dir = File.join Gem.dir, 'gems', "rubygems-update-#{version}"
success = false
Dir.chdir update_dir do
say "Installing RubyGems #{version}"
setup_cmd = "#{Gem.ruby} setup.rb #{args.join ' '}"