Created
September 16, 2018 10:45
-
-
Save colby-swandale/003d7274067613db360b6ead9de84322 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment