Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.
  • Loading branch information...
commit b898f237d6b35144fb1c585a550d79f89461cb9d 1 parent edffb4f
@jacknagel authored
Showing with 21 additions and 5 deletions.
  1. +21 −5 Library/Homebrew/formula.rb
View
26 Library/Homebrew/formula.rb
@@ -444,19 +444,35 @@ def conflicts
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 }
Please sign in to comment.
Something went wrong with that request. Please try again.