summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2018-10-17 12:00:52 +0000
committerColby Swandale <me@colby.fyi>2019-03-24 01:59:34 +1100
commit560e922d2221136a933f318d543489ec54d8e550 (patch)
tree9a23d918223f81f56ea6a1e39caa2b1c56eb694c
parent01b898cd41e9a2f3eca924c2321611f8ce8c9770 (diff)
downloadbundler-560e922d2221136a933f318d543489ec54d8e550.tar.gz
Merge #6739
6739: Remove the duplicate gems from suggestions r=colby-swandale a=y-yagi ### What was the end-user problem that led to this PR? If the lock file has the same gems for different platforms, the suggestion includes all those gems. For example, using the [Rails's lock file](https://github.com/rails/rails/blob/4a51cbba58435bbba65ca50670bd6ae4887942bd/Gemfile.lock), it shows like this: ``` $ bundle update mai Could not find gem 'mai'. Did you mean ffi, ffi, ffi, ffi, mail, ast, jwt, que or wdm? ``` ### What was your diagnosis of the problem? Missing consideration when lock file contains the same gem. ### What is your fix for the problem, implemented in this PR? I removed the same name using `uniq`. Co-authored-by: yuuji.yaginuma <yuuji.yaginuma@gmail.com> (cherry picked from commit a144e72484ee16fb57a13fb1ba1a54ebefaf5b2e)
-rw-r--r--lib/bundler/cli/common.rb2
-rw-r--r--spec/commands/update_spec.rb5
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb
index 9d40ee9dfd..0490453538 100644
--- a/lib/bundler/cli/common.rb
+++ b/lib/bundler/cli/common.rb
@@ -72,7 +72,7 @@ module Bundler
end
def self.ensure_all_gems_in_lockfile!(names, locked_gems = Bundler.locked_gems)
- locked_names = locked_gems.specs.map(&:name)
+ locked_names = locked_gems.specs.map(&:name).uniq
names.-(locked_names).each do |g|
raise GemNotFound, gem_not_found_message(g, locked_names)
end
diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb
index 1effba6526..786719f50d 100644
--- a/spec/commands/update_spec.rb
+++ b/spec/commands/update_spec.rb
@@ -8,6 +8,7 @@ RSpec.describe "bundle update" do
source "file://#{gem_repo2}"
gem "activesupport"
gem "rack-obama"
+ gem "platform_specific"
G
end
@@ -116,8 +117,8 @@ RSpec.describe "bundle update" do
expect(out).to include "Could not find gem 'halting-problem-solver'"
end
it "should suggest alternatives" do
- bundle "update active-support"
- expect(out).to include "Did you mean activesupport?"
+ bundle "update platformspecific"
+ expect(out).to include "Did you mean platform_specific?"
end
end