summaryrefslogtreecommitdiff
path: root/lib/bundler/rubygems_integration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/rubygems_integration.rb')
-rw-r--r--lib/bundler/rubygems_integration.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 23ae95aa04..1c44ef3ddd 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -397,6 +397,17 @@ module Bundler
spec
end
+ redefine_method(gem_class, :activate_bin_path) do |name, *args|
+ exec_name = args.first
+ return ENV["BUNDLE_BIN_PATH"] if exec_name == "bundle"
+
+ # Copy of Rubygems activate_bin_path impl
+ requirement = args.last
+ spec = find_spec_for_exe name, exec_name, [requirement]
+ Gem::LOADED_SPECS_MUTEX.synchronize { spec.activate }
+ spec.bin_file exec_name
+ end
+
redefine_method(gem_class, :bin_path) do |name, *args|
exec_name = args.first
return ENV["BUNDLE_BIN_PATH"] if exec_name == "bundle"