aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-01-23 00:26:24 -0600
committerJack Nagel2013-01-26 12:14:43 -0600
commita569261a9bdc16c76ef8b2b709c4a311206bbfdf (patch)
tree91b48e284e5925ffa871ee07200e778447144e12 /Library
parent02b8d343399dcc367c04da1838ef3e4df3131495 (diff)
downloadbrew-a569261a9bdc16c76ef8b2b709c4a311206bbfdf.tar.bz2
Formula#recursive_dependencies
This behaves like recursive_deps, but the resulting list consists of Dependency objects instead of Formula objects. The list maintains the installable order property of recursive_deps. While in the area, add some comments clarifying the purpose of related methods.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb26
1 files changed, 21 insertions, 5 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index e3d199718..453a06ef7 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -444,19 +444,35 @@ class Formula
requirements.select { |r| r.is_a? ConflictRequirement }
end
+ # for Formula objects
+ def self.expand_deps f
+ f.deps.map do |dep|
+ f_dep = Formula.factory dep.to_s
+ expand_deps(f_dep) << f_dep
+ end
+ end
+
+ # for Dependency objects
+ def self.expand_dependencies f
+ f.deps.map do |dep|
+ f_dep = Formula.factory dep.to_s
+ expand_dependencies(f_dep) << dep
+ end
+ end
+
# deps are in an installable order
# which means if a depends on b then b will be ordered before a in this list
def recursive_deps
Formula.expand_deps(self).flatten.uniq
end
- def self.expand_deps f
- f.deps.map do |dep|
- f_dep = Formula.factory dep.to_s
- expand_deps(f_dep) << f_dep
- end
+ # Like recursive_deps, but returns a list of Dependency objects instead
+ # of Formula objects.
+ def recursive_dependencies
+ Formula.expand_dependencies(self).flatten.uniq
end
+ # The full set of Requirements for this formula's dependency tree.
def recursive_requirements
reqs = ComparableSet.new
recursive_deps.each { |dep| reqs.merge dep.requirements }