From 0bb7fda143f3a609fdfed27e84422ff55f85db02 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 7 Sep 2016 20:09:08 +0100 Subject: commands: add commands module for path lookup. --- Library/Homebrew/commands.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Library/Homebrew/commands.rb (limited to 'Library/Homebrew/commands.rb') diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb new file mode 100644 index 000000000..caf356b43 --- /dev/null +++ b/Library/Homebrew/commands.rb @@ -0,0 +1,13 @@ +module Commands + def self.path(cmd) + if File.exist?(HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh") + HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh" + elsif File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh") + HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh" + elsif File.exist?(HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb") + HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb" + elsif File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb") + HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb" + end + end +end -- cgit v1.2.3