summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/update_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/commands/update_command.rb')
-rw-r--r--lib/rubygems/commands/update_command.rb33
1 files changed, 27 insertions, 6 deletions
diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb
index 28d3a5d382..9974b2b54b 100644
--- a/lib/rubygems/commands/update_command.rb
+++ b/lib/rubygems/commands/update_command.rb
@@ -16,9 +16,9 @@ class Gem::Commands::UpdateCommand < Gem::Command
super 'update',
'Update the named gems (or all installed gems) in the local repository',
:generate_rdoc => true,
- :generate_ri => true,
- :force => false,
- :test => false
+ :generate_ri => true,
+ :force => false,
+ :test => false
add_install_update_options
@@ -80,20 +80,27 @@ class Gem::Commands::UpdateCommand < Gem::Command
gems_to_update.uniq.sort.each do |name|
next if updated.any? { |spec| spec.name == name }
+ success = false
say "Updating #{name}"
- installer.install name
+ begin
+ installer.install name
+ success = true
+ rescue Gem::InstallError => e
+ alert_error "Error installing #{name}:\n\t#{e.message}"
+ success = false
+ end
installer.installed_gems.each do |spec|
updated << spec
- say "Successfully installed #{spec.full_name}"
+ say "Successfully installed #{spec.full_name}" if success
end
end
if gems_to_update.include? "rubygems-update" then
Gem.source_index.refresh!
- update_gems = Gem.source_index.search 'rubygems-update'
+ update_gems = Gem.source_index.find_name 'rubygems-update'
latest_update_gem = update_gems.sort_by { |s| s.version }.last
@@ -106,6 +113,20 @@ class Gem::Commands::UpdateCommand < Gem::Command
say "Nothing to update"
else
say "Gems updated: #{updated.map { |spec| spec.name }.join ', '}"
+
+ if options[:generate_ri] then
+ updated.each do |gem|
+ Gem::DocManager.new(gem, options[:rdoc_args]).generate_ri
+ end
+
+ Gem::DocManager.update_ri_cache
+ end
+
+ if options[:generate_rdoc] then
+ updated.each do |gem|
+ Gem::DocManager.new(gem, options[:rdoc_args]).generate_rdoc
+ end
+ end
end
end
end