aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-06-24 12:27:19 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-06-24 14:17:06 -0500
commit38d381f58c9c877f57338c1ffec9408bce6bda4a (patch)
treeefde1234748f07cf694bab0093ec239c11123e39 /lib
parentdca6d26833ddd9d9de658bef7274c8fa21014c44 (diff)
downloadbundler-38d381f58c9c877f57338c1ffec9408bce6bda4a.tar.gz
Prefer spec name matches when searching for an exe
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