brew/Library/Homebrew/commands.rb
Mike McQuaid 7a68b4a3f9 Refactor command handling code
Don’t rely on having external commands always present in the PATH in
order to find them. Instead, provide an accessory method to Tap so
they can be added and used when needed.

While we’re here, do some general refactoring and cleanup of the
command code in these places.
2017-11-05 15:37:57 +00:00

11 lines
262 B
Ruby

module Commands
def self.path(cmd)
[
HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh",
HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh",
HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb",
HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb",
].find(&:exist?)
end
end