[前][次][番号順一覧][スレッド一覧]

ruby-changes:72433

From: Brian <ko1@a...>
Date: Wed, 6 Jul 2022 02:59:28 +0900 (JST)
Subject: [ruby-changes:72433] 6eab8095fa (master): [rubygems/rubygems] output gems already up-to-date regardless if any gems were updated

https://git.ruby-lang.org/ruby.git/commit/?id=6eab8095fa

From 6eab8095fa13ba6137f3807ed04188a53d587875 Mon Sep 17 00:00:00 2001
From: Brian Le <brian.le@s...>
Date: Thu, 30 Jun 2022 16:20:02 -0700
Subject: [rubygems/rubygems] output gems already up-to-date regardless if any
 gems were updated

https://github.com/rubygems/rubygems/commit/4ec608a573
---
 lib/rubygems/commands/update_command.rb           | 5 ++++-
 test/rubygems/test_gem_commands_update_command.rb | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb
index 422fdd4e81..59e020fd63 100644
--- a/lib/rubygems/commands/update_command.rb
+++ b/lib/rubygems/commands/update_command.rb
@@ -118,15 +118,18 @@ command to remove old versions. https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/update_command.rb#L118
 
     updated = update_gems gems_to_update
 
+    installed_names = highest_installed_gems.keys
     updated_names = updated.map {|spec| spec.name }
     not_updated_names = options[:args].uniq - updated_names
+    not_installed_names = not_updated_names - installed_names
+    up_to_date_names = not_updated_names - not_installed_names
 
     if updated.empty?
       say "Nothing to update"
     else
       say "Gems updated: #{updated_names.join(' ')}"
-      say "Gems already up-to-date: #{not_updated_names.join(' ')}" unless not_updated_names.empty?
     end
+    say "Gems already up-to-date: #{up_to_date_names.join(' ')}" unless up_to_date_names.empty?
   end
 
   def fetch_remote_gems(spec) # :nodoc:
diff --git a/test/rubygems/test_gem_commands_update_command.rb b/test/rubygems/test_gem_commands_update_command.rb
index b5e9f004d1..acb60a7583 100644
--- a/test/rubygems/test_gem_commands_update_command.rb
+++ b/test/rubygems/test_gem_commands_update_command.rb
@@ -535,6 +535,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_update_command.rb#L535
     out = @ui.output.split "\n"
     assert_equal "Updating installed gems", out.shift
     assert_equal "Nothing to update", out.shift
+    assert_equal "Gems already up-to-date: a", out.shift
 
     assert_empty out
   end
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]