Module: DependenciesHelpers Private
- Includes:
- Kernel
- Included in:
- Homebrew::Cmd::Deps, Homebrew::Cmd::Uses
- Defined in:
- dependencies_helpers.rb,
dependencies_helpers.rbi
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Constant Summary
Constants included from Kernel
Kernel::IGNORE_INTERRUPTS_MUTEX
Instance Method Summary collapse
-
#args_includes_ignores(args) ⇒ Array<(Array<Symbol>, Array<Symbol>)>
private
This sig is in an RBI to avoid both circular dependencies and unnecessary requires.
- #dependents(formulae_or_casks) ⇒ Array<Formula, CaskDependent> private
- #recursive_dep_includes(root_dependent, includes, ignores) ⇒ Array<Dependency> private
- #recursive_includes(klass, root_dependent, includes, ignores) ⇒ Array<Dependency>, Requirements private
- #recursive_req_includes(root_dependent, includes, ignores) ⇒ Requirements private
- #select_includes(dependables, ignores, includes) ⇒ Array<Dependency, Requirement> private
Methods included from Kernel
#ensure_executable!, #exec_browser, #exec_editor, #ignore_interrupts, #interactive_shell, #quiet_system, #redirect_stdout, #safe_system, #which, #which_editor, #with_env, #with_homebrew_path
Instance Method Details
#args_includes_ignores(args) ⇒ Array<(Array<Symbol>, Array<Symbol>)>
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.
This sig is in an RBI to avoid both circular dependencies and unnecessary requires
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'dependencies_helpers.rb', line 8 def args_includes_ignores(args) includes = [:required?, :recommended?] # included by default includes << :implicit? if args.include_implicit? includes << :build? if args.include_build? includes << :test? if args.include_test? includes << :optional? if args.include_optional? ignores = [] ignores << :recommended? if args.skip_recommended? ignores << :satisfied? if args.missing? [includes, ignores] end |
#dependents(formulae_or_casks) ⇒ Array<Formula, CaskDependent>
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.
83 84 85 86 87 88 89 90 91 92 |
# File 'dependencies_helpers.rb', line 83 def dependents(formulae_or_casks) formulae_or_casks.map do |formula_or_cask| case formula_or_cask when Formula then formula_or_cask when Cask::Cask then CaskDependent.new(formula_or_cask) else raise TypeError, "Unsupported type: #{formula_or_cask.class}" end end end |
#recursive_dep_includes(root_dependent, includes, ignores) ⇒ Array<Dependency>
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.
26 27 28 |
# File 'dependencies_helpers.rb', line 26 def recursive_dep_includes(root_dependent, includes, ignores) T.cast(recursive_includes(Dependency, root_dependent, includes, ignores), T::Array[Dependency]) end |
#recursive_includes(klass, root_dependent, includes, ignores) ⇒ Array<Dependency>, Requirements
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.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'dependencies_helpers.rb', line 46 def recursive_includes(klass, root_dependent, includes, ignores) cache_key = "recursive_includes_#{includes}_#{ignores}" klass.(root_dependent, cache_key:) do |dependent, dep| next Dependable::PRUNE if ignores.any? { |ignore| dep.public_send(ignore) } next Dependable::PRUNE if includes.none? do |include| # Ignore indirect test dependencies next if include == :test? && dependent != root_dependent dep.public_send(include) end # If a tap isn't installed, we can't find the dependencies of one of # its formulae and an exception will be thrown if we try. next Dependable::KEEP_BUT_PRUNE_RECURSIVE_DEPS if klass == Dependency && (tap = dep.tap) && !tap.installed? end end |
#recursive_req_includes(root_dependent, includes, ignores) ⇒ Requirements
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.
34 35 36 |
# File 'dependencies_helpers.rb', line 34 def recursive_req_includes(root_dependent, includes, ignores) T.cast(recursive_includes(Requirement, root_dependent, includes, ignores), Requirements) end |
#select_includes(dependables, ignores, includes) ⇒ Array<Dependency, Requirement>
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.
71 72 73 74 75 76 77 |
# File 'dependencies_helpers.rb', line 71 def select_includes(dependables, ignores, includes) dependables.select do |dep| next false if ignores.any? { |ignore| dep.public_send(ignore) } includes.any? { |include| dep.public_send(include) } end end |