formula: add runtime_installed_formula_dependents method.

This commit is contained in:
Mike McQuaid 2019-11-05 20:34:24 +00:00
parent ddcbdbe0c0
commit 7d77a9e97d
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -1570,6 +1570,23 @@ class Formula
end.compact end.compact
end end
def runtime_installed_formula_dependents
# `opt_or_installed_prefix_keg` and `runtime_dependencies` `select`s ensure
# that we don't end up with something `Formula#runtime_dependencies` can't
# read from a `Tab`.
Formula.cache[:runtime_installed_formula_dependents] = {}
Formula.cache[:runtime_installed_formula_dependents][name] ||= Formula.installed
.select(&:opt_or_installed_prefix_keg)
.select(&:runtime_dependencies)
.select do |f|
f.runtime_formula_dependencies.any? do |dep|
full_name == dep.full_name
rescue
name == dep.name
end
end
end
# Returns a list of formulae depended on by this formula that aren't # Returns a list of formulae depended on by this formula that aren't
# installed # installed
def missing_dependencies(hide: nil) def missing_dependencies(hide: nil)