Last active
September 16, 2018 11:42
-
-
Save colby-swandale/5d842389a76c5a4f5dbc2e4d3a2ad89e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def self.bin_path(name, exec_name = nil, *requirements) | |
# TODO: fails test_self_bin_path_bin_file_gone_in_latest | |
# Gem::Specification.find_by_name(name, *requirements).bin_file exec_name | |
raise ArgumentError, "you must supply exec_name" unless exec_name | |
requirements = Gem::Requirement.default if | |
requirements.empty? | |
find_spec_for_exe(name, exec_name, requirements).bin_file exec_name | |
end | |
def self.find_spec_for_exe name, exec_name, requirements | |
dep = Gem::Dependency.new name, requirements | |
loaded = Gem.loaded_specs[name] | |
return loaded if loaded && dep.matches_spec?(loaded) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment