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

ruby-changes:67458

From: David <ko1@a...>
Date: Tue, 31 Aug 2021 19:07:38 +0900 (JST)
Subject: [ruby-changes:67458] f6803d2411 (master): [rubygems/rubygems] Fix `bundle check` showing duplicated gems

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

From f6803d2411de002c00f1bacc756e412407bc61ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Wed, 18 Aug 2021 11:02:13 +0200
Subject: [rubygems/rubygems] Fix `bundle check` showing duplicated gems

If the lockfile contains multiple platforms, `bundle check` would show
duplicated missing gems.

https://github.com/rubygems/rubygems/commit/6ac5931783
---
 lib/bundler/spec_set.rb             |  2 +-
 spec/bundler/commands/check_spec.rb | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index 7be4fcc..26d41cb 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -24,7 +24,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/spec_set.rb#L24
 
         specs_for_dep = spec_for_dependency(dep, match_current_platform)
         if specs_for_dep.any?
-          specs += specs_for_dep
+          match_current_platform ? specs += specs_for_dep : specs |= specs_for_dep
 
           specs_for_dep.first.dependencies.each do |d|
             next if d.type == :development
diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb
index 7eb3fec..419deae 100644
--- a/spec/bundler/commands/check_spec.rb
+++ b/spec/bundler/commands/check_spec.rb
@@ -332,6 +332,42 @@ RSpec.describe "bundle check" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/check_spec.rb#L332
     end
   end
 
+  describe "when locked under multiple platforms" do
+    before :each do
+      build_repo4 do
+        build_gem "rack"
+      end
+
+      gemfile <<-G
+        source "#{file_uri_for(gem_repo4)}"
+        gem "rack"
+      G
+
+      lockfile <<-L
+        GEM
+          remote: #{file_uri_for(gem_repo4)}/
+          specs:
+            rack (1.0)
+
+        PLATFORMS
+          ruby
+          #{specific_local_platform}
+
+        DEPENDENCIES
+          rack
+
+        BUNDLED WITH
+           #{Bundler::VERSION}
+      L
+    end
+
+    it "shows what is missing with the current Gemfile without duplications" do
+      bundle :check, :raise_on_error => false
+      expect(err).to match(/The following gems are missing/)
+      expect(err).to include("* rack (1.0").once
+    end
+  end
+
   describe "when using only scoped rubygems sources" do
     before do
       gemfile <<~G
-- 
cgit v1.1


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

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