lib/bundler/rubygems_integration.rb in bundler-2.5.22 vs lib/bundler/rubygems_integration.rb in bundler-2.5.23
- old
+ new
@@ -218,13 +218,11 @@
# backwards compatibility shim, see https://github.com/rubygems/bundler/issues/5102
kernel_class.send(:public, :gem) if Bundler.feature_flag.setup_makes_kernel_gem_public?
end
end
- # Used to make bin stubs that are not created by bundler work
- # under bundler. The new Gem.bin_path only considers gems in
- # +specs+
+ # Used to give better error messages when activating specs outside of the current bundle
def replace_bin_path(specs_by_name)
gem_class = (class << Gem; self; end)
redefine_method(gem_class, :find_spec_for_exe) do |gem_name, *args|
exec_name = args.first
@@ -259,35 +257,10 @@
"If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names."
end
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_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
-
- 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
# Replace or hook into RubyGems to provide a bundlerized view
# of the world.
def replace_entrypoints(specs)
@@ -300,10 +273,10 @@
rescue LoadError
else
Gem::BUNDLED_GEMS.replace_require(specs) if Gem::BUNDLED_GEMS.respond_to?(:replace_require)
end
replace_gem(specs, specs_by_name)
- stub_rubygems(specs)
+ stub_rubygems(specs_by_name.values)
replace_bin_path(specs_by_name)
Gem.clear_paths
end