aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/commands.rb
diff options
context:
space:
mode:
authorMike McQuaid2016-09-07 20:09:08 +0100
committerMike McQuaid2016-09-08 20:46:55 +0100
commit0bb7fda143f3a609fdfed27e84422ff55f85db02 (patch)
tree97185442cc9dbba0bc081ffc355166dca699ec91 /Library/Homebrew/commands.rb
parent9514d1f8f522057a336eb1c3c5a48fb4206ebd84 (diff)
downloadbrew-0bb7fda143f3a609fdfed27e84422ff55f85db02.tar.bz2
commands: add commands module for path lookup.
Diffstat (limited to 'Library/Homebrew/commands.rb')
-rw-r--r--Library/Homebrew/commands.rb13
1 files changed, 13 insertions, 0 deletions
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