aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2009-11-16 15:35:58 -0800
committerAdam Vandenberg2009-11-19 14:03:07 -0800
commit62cef2341985a412f688a42a823c81128f5ae6ef (patch)
tree7e1461f89767017dc0b3b193a51620a1643a0793 /Library
parent626de37c28bf52720dde3addb83e7038b1ea3826 (diff)
downloadhomebrew-62cef2341985a412f688a42a823c81128f5ae6ef.tar.bz2
Add brew command 'uses'
'uses' shows the formulas that depend on a formula given on the command-line.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 247d67824..0cc084705 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -201,6 +201,22 @@ class Formula
name.capitalize.gsub(/[-_.\s]([a-zA-Z0-9])/) { $1.upcase } \
.gsub('+', 'x')
end
+
+ def self.get_used_by
+ used_by = {}
+ Formulary.read_all do |name, klass|
+ deps = klass.deps
+ next if deps == nil
+
+ deps.each do |dep|
+ _deps = used_by[dep] || []
+ _deps << name unless _deps.include? name
+ used_by[dep] = _deps
+ end
+ end
+
+ return used_by
+ end
def self.factory name
return name if name.kind_of? Formula