Skip to content

Commit

Permalink
Fix bundle check showing duplicated gems
Browse files Browse the repository at this point in the history
If the lockfile contains multiple platforms, `bundle check` would show
duplicated missing gems.
  • Loading branch information
deivid-rodriguez committed Aug 18, 2021
1 parent ff9028c commit 6ac5931
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bundler/lib/bundler/spec_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def for(dependencies, check = false, match_current_platform = false)

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
Expand Down
36 changes: 36 additions & 0 deletions bundler/spec/commands/check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,42 @@
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
Expand Down

0 comments on commit 6ac5931

Please sign in to comment.