aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-06-25 08:43:41 +0900
committerSamuel Giddins <segiddins@segiddins.me>2016-06-27 16:17:38 -0500
commit9585f87217e89e4f4776f6f20d5369a7d8e7313d (patch)
tree4133b2c2a14db7c709a0ad934deabaed7362e957 /lib
parent5712f9705a46f9cb2ea2775d53a90671499ecc60 (diff)
downloadbundler-9585f87217e89e4f4776f6f20d5369a7d8e7313d.tar.gz
Auto merge of #4711 - bundler:seg-spec-for-exe-match-spec-name, r=segiddins
Prefer spec name matches when searching for an exe Closes #4705. (cherry picked from commit d497e04e336fcb54f6f92acbb6665b84d11ca396)
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/rubygems_integration.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 28259b72..af2e2f2f 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -362,19 +362,21 @@ module Bundler
def replace_bin_path(specs)
gem_class = (class << Gem; self; end)
- redefine_method(gem_class, :find_spec_for_exe) do |name, *args|
+ redefine_method(gem_class, :find_spec_for_exe) do |gem_name, *args|
exec_name = args.first
spec = if exec_name
- specs.find {|s| s.executables.include?(exec_name) }
+ specs.find {|s| s.name == gem_name && s.executables.include?(exec_name) } ||
+ specs.find {|s| s.executables.include?(exec_name) }
else
- specs.find {|s| s.name == name }
+ specs.find {|s| s.name == gem_name }
end
raise(Gem::Exception, "can't find executable #{exec_name}") unless spec
raise Gem::Exception, "no default executable for #{spec.full_name}" unless exec_name ||= spec.default_executable
unless spec.name == name
- warn "Bundler is using a binstub that was created for a different gem.\n" \
- "This is deprecated, in future versions you may need to `bundle binstub #{name}` " \
+ Bundler::SharedHelpers.major_deprecation \
+ "Bundler is using a binstub that was created for a different gem.\n" \
+ "You should run `bundle binstub #{gem_name}` " \
"to work around a system/bundle conflict."
end
spec