diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-08-07 17:17:46 +0200 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-09-26 10:38:51 +0200 |
commit | 10582925a9a03db938912bbfcc9511fff3eeae41 (patch) | |
tree | ee8eeb405736c53dfc7c29c51a0e8d84642a7660 | |
parent | 4e461c4de6439763c5de826da6fc5689e9dc39a9 (diff) | |
download | bundler-revert_bin_activation_rubygems_monkeypatches.tar.gz |
Restore hack for old rubygems that still need itrevert_bin_activation_rubygems_monkeypatches
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 62afdd9e91..3bda562c0a 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -396,6 +396,20 @@ module Bundler spec end + + if provides?("< 2.6.2") + redefine_method(gem_class, :bin_path) do |name, *args| + exec_name = args.first + return ENV["BUNDLE_BIN_PATH"] if exec_name == "bundle" + + spec = find_spec_for_exe(name, *args) + exec_name ||= spec.default_executable + + gem_bin = File.join(spec.full_gem_path, spec.bindir, exec_name) + gem_from_path_bin = File.join(File.dirname(spec.loaded_from), spec.bindir, exec_name) + File.exist?(gem_bin) ? gem_bin : gem_from_path_bin + end + end end # Replace or hook into RubyGems to provide a bundlerized view |