diff options
Diffstat (limited to 'lib/rubygems/commands/update_command.rb')
-rw-r--r-- | lib/rubygems/commands/update_command.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb index dc924265b0..9ab3b80e96 100644 --- a/lib/rubygems/commands/update_command.rb +++ b/lib/rubygems/commands/update_command.rb @@ -68,8 +68,8 @@ command to remove old versions. "#{program_name} GEMNAME [GEMNAME ...]" end - def check_latest_rubygems version # :nodoc: - if Gem.rubygems_version == version then + def check_latest_rubygems(version) # :nodoc: + if Gem.rubygems_version == version say "Latest version already installed. Done." terminate_interaction end @@ -78,14 +78,14 @@ command to remove old versions. end def check_update_arguments # :nodoc: - unless options[:args].empty? then + unless options[:args].empty? alert_error "Gem names are not allowed with the --system option" terminate_interaction 1 end end def execute - if options[:system] then + if options[:system] update_rubygems return end @@ -111,7 +111,7 @@ command to remove old versions. updated_names = updated.map { |spec| spec.name } not_updated_names = options[:args].uniq - updated_names - if updated.empty? then + if updated.empty? say "Nothing to update" else say "Gems updated: #{updated_names.join(' ')}" @@ -119,7 +119,7 @@ command to remove old versions. end end - def fetch_remote_gems spec # :nodoc: + def fetch_remote_gems(spec) # :nodoc: dependency = Gem::Dependency.new spec.name, "> #{spec.version}" dependency.prerelease = options[:prerelease] @@ -138,7 +138,7 @@ command to remove old versions. hig = {} # highest installed gems Gem::Specification.each do |spec| - if hig[spec.name].nil? or hig[spec.name].version < spec.version then + if hig[spec.name].nil? or hig[spec.name].version < spec.version hig[spec.name] = spec end end @@ -146,7 +146,7 @@ command to remove old versions. hig end - def highest_remote_version spec # :nodoc: + def highest_remote_version(spec) # :nodoc: spec_tuples = fetch_remote_gems spec matching_gems = spec_tuples.select do |g,_| @@ -160,7 +160,7 @@ command to remove old versions. highest_remote_gem.first.version end - def install_rubygems version # :nodoc: + def install_rubygems(version) # :nodoc: args = update_rubygems_arguments update_dir = File.join Gem.dir, 'gems', "rubygems-update-#{version}" @@ -177,7 +177,7 @@ command to remove old versions. version = options[:system] update_latest = version == true - if update_latest then + if update_latest version = Gem::Version.new Gem::VERSION requirement = Gem::Requirement.new ">= #{Gem::VERSION}" else @@ -196,7 +196,7 @@ command to remove old versions. gems_to_update = which_to_update hig, options[:args], :system _, up_ver = gems_to_update.first - target = if update_latest then + target = if update_latest up_ver else version @@ -205,7 +205,7 @@ command to remove old versions. return target, requirement end - def update_gem name, version = Gem::Requirement.default + def update_gem(name, version = Gem::Requirement.default) return if @updated.any? { |spec| spec.name == name } update_options = options.dup @@ -225,7 +225,7 @@ command to remove old versions. end end - def update_gems gems_to_update + def update_gems(gems_to_update) gems_to_update.uniq.sort.each do |(name, version)| update_gem name, version end @@ -264,7 +264,7 @@ command to remove old versions. args end - def which_to_update highest_installed_gems, gem_names, system = false + def which_to_update(highest_installed_gems, gem_names, system = false) result = [] highest_installed_gems.each do |l_name, l_spec| @@ -273,7 +273,7 @@ command to remove old versions. highest_remote_ver = highest_remote_version l_spec - if system or (l_spec.version < highest_remote_ver) then + if system or (l_spec.version < highest_remote_ver) result << [l_spec.name, [l_spec.version, highest_remote_ver].max] end end |