Class: Utils::TopologicalHash Private
- Extended by:
- T::Generic
- Includes:
- TSort
- Defined in:
- utils/topological_hash.rb
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Topologically sortable hash map.
Constant Summary collapse
- CaskOrFormula =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
T.type_alias { T.any(Cask::Cask, Formula) }
- K =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
type_member { { fixed: CaskOrFormula } }
- V =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
type_member { { fixed: T::Array[CaskOrFormula] } }
- Elem =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
type_member(:out) { { fixed: [CaskOrFormula, T::Array[CaskOrFormula]] } }
Class Method Summary collapse
Methods inherited from Hash
#assert_valid_keys, #blank?, #compact_blank, #deep_dup, #deep_merge, #deep_merge!, #deep_stringify_keys, #deep_stringify_keys!, #deep_symbolize_keys, #deep_symbolize_keys!, #deep_transform_keys, #deep_transform_keys!, #deep_transform_values, #deep_transform_values!, #present?
Class Method Details
.graph_package_dependencies(packages, accumulator = TopologicalHash.new) ⇒ TopologicalHash
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'utils/topological_hash.rb', line 24 def self.graph_package_dependencies(packages, accumulator = TopologicalHash.new) packages = Array(packages) packages.each do |cask_or_formula| next if accumulator.key?(cask_or_formula) case cask_or_formula when Cask::Cask formula_deps = cask_or_formula.depends_on .formula .map { |f| Formula[f] } cask_deps = cask_or_formula.depends_on .cask .map { |c| Cask::CaskLoader.load(c, config: nil) } when Formula formula_deps = cask_or_formula.deps .reject(&:build?) .reject(&:test?) .map(&:to_formula) cask_deps = cask_or_formula.requirements .filter_map(&:cask) .map { |c| Cask::CaskLoader.load(c, config: nil) } else T.absurd(cask_or_formula) end accumulator[cask_or_formula] = formula_deps + cask_deps graph_package_dependencies(formula_deps, accumulator) graph_package_dependencies(cask_deps, accumulator) end accumulator end |