diff options
-rw-r--r-- | lib/rubygems/commands/update_command.rb | 58 |
1 files changed, 22 insertions, 36 deletions
@@ -1,10 +1,12 @@ require 'rubygems/command' require 'rubygems/command_manager' require 'rubygems/install_update_options' require 'rubygems/local_remote_options' require 'rubygems/spec_fetcher' require 'rubygems/version_option' -require 'rubygems/commands/install_command' class Gem::Commands::UpdateCommand < Gem::Command @@ -13,11 +15,9 @@ class Gem::Commands::UpdateCommand < Gem::Command include Gem::VersionOption def initialize - super 'update', - 'Update the named gems (or all installed gems) in the local repository', - :generate_rdoc => true, - :generate_ri => true, - :force => false add_install_update_options @@ -37,6 +37,9 @@ class Gem::Commands::UpdateCommand < Gem::Command add_local_remote_options add_platform_option add_prerelease_option "as update targets" end def arguments # :nodoc: @@ -44,7 +47,7 @@ class Gem::Commands::UpdateCommand < Gem::Command end def defaults_str # :nodoc: - "--rdoc --ri --no-force --install-dir #{Gem.dir}" end def usage # :nodoc: @@ -52,9 +55,6 @@ class Gem::Commands::UpdateCommand < Gem::Command end def execute - @installer = Gem::DependencyInstaller.new options - @updated = [] - hig = {} if options[:system] then @@ -79,21 +79,7 @@ class Gem::Commands::UpdateCommand < Gem::Command if updated.empty? then 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 @@ -112,7 +98,6 @@ class Gem::Commands::UpdateCommand < Gem::Command @installer.installed_gems.each do |spec| @updated << spec - say "Successfully installed #{spec.full_name}" if success end end @@ -178,8 +163,9 @@ class Gem::Commands::UpdateCommand < Gem::Command args = [] args << '--prefix' << Gem.prefix if Gem.prefix - args << '--no-rdoc' unless options[:generate_rdoc] - args << '--no-ri' unless options[:generate_ri] args << '--no-format-executable' if options[:no_format_executable] update_dir = File.join Gem.dir, 'gems', "rubygems-update-#{version}" @@ -205,20 +191,20 @@ class Gem::Commands::UpdateCommand < Gem::Command gem_names.all? { |name| /#{name}/ !~ l_spec.name } dependency = Gem::Dependency.new l_spec.name, "> #{l_spec.version}" fetcher = Gem::SpecFetcher.fetcher - spec_tuples = fetcher.find_matching dependency - matching_gems = spec_tuples.select do |(name, _, platform),| - name == l_name and Gem::Platform.match platform end - highest_remote_gem = matching_gems.sort_by do |(_, version),| - version - end.last - highest_remote_gem ||= [[nil, Gem::Version.new(0), nil]] # "null" object - highest_remote_ver = highest_remote_gem.first[1] if system or (l_spec.version < highest_remote_ver) then result << [l_spec.name, [l_spec.version, highest_remote_ver].max] |