Module: Dependable Abstract Private

Extended by:
T::Helpers
Included in:
Dependency, Requirement
Defined in:
dependable.rb

Overview

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.

This module is abstract.

Subclasses must implement the abstract methods below.

Shared functions for classes which can be depended upon.

Constant Summary collapse

PRUNE =

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.

Return from an Dependency.expand or Requirement.expand block to remove a dependency/requirement and all of its recursive dependencies from the result list.

:prune
SKIP =

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.

Return from a Dependency.expand block to omit a dependency from the result list but continue expanding its children.

:skip
KEEP_BUT_PRUNE_RECURSIVE_DEPS =

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.

Return from a Dependency.expand block to keep a dependency in the result list but stop recursing into its own dependencies.

:keep_but_prune_recursive_deps
RESERVED_TAGS =

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.

:run and :linked are no longer used but keep them here to avoid their misuse in future.

T.let(
  [:build, :optional, :recommended, :run, :test, :linked, :implicit, :no_linkage].freeze,
  T::Array[Symbol],
)

Instance Method Summary collapse

Instance Method Details

#build?Boolean

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.

Returns:

  • (Boolean)


40
41
42
# File 'dependable.rb', line 40

def build?
  tags.include? :build
end

#implicit?Boolean

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.

Returns:

  • (Boolean)


60
61
62
# File 'dependable.rb', line 60

def implicit?
  tags.include? :implicit
end

#no_linkage?Boolean

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.

Returns:

  • (Boolean)


65
66
67
# File 'dependable.rb', line 65

def no_linkage?
  tags.include? :no_linkage
end

#option_namesArray<String>

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 method is abstract.

Returns:



37
# File 'dependable.rb', line 37

def option_names; end

#option_tagsArray<String>

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.

Returns:



75
76
77
# File 'dependable.rb', line 75

def option_tags
  tags.grep(String)
end

#optional?Boolean

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.

Returns:

  • (Boolean)


45
46
47
# File 'dependable.rb', line 45

def optional?
  tags.include? :optional
end

#optionsOptions

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.

Returns:



80
81
82
# File 'dependable.rb', line 80

def options
  Options.create(option_tags)
end

#prune_from_option?(build) ⇒ Boolean

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.

Parameters:

Returns:

  • (Boolean)


85
86
87
88
89
# File 'dependable.rb', line 85

def prune_from_option?(build)
  return false if !optional? && !recommended?

  build.without?(self)
end

#prune_if_build_and_not_dependent?(dependent, formula = nil) ⇒ Boolean

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.

Parameters:

Returns:

  • (Boolean)


92
93
94
95
96
97
98
99
100
101
102
# File 'dependable.rb', line 92

def prune_if_build_and_not_dependent?(dependent, formula = nil)
  return false unless build?

  if formula
    dependent != formula
  else
    raise "dependent is not a formula or cask dependent" unless dependent.is_a?(Dependency)

    dependent.installed?
  end
end

#recommended?Boolean

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.

Returns:

  • (Boolean)


50
51
52
# File 'dependable.rb', line 50

def recommended?
  tags.include? :recommended
end

#required?Boolean

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.

Returns:

  • (Boolean)


70
71
72
# File 'dependable.rb', line 70

def required?
  !build? && !test? && !optional? && !recommended?
end

#tagsArray<Symbol, String, Array<T.untyped>>

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.

Returns:



32
33
34
# File 'dependable.rb', line 32

def tags
  @tags ||= T.let([], T.nilable(T::Array[T.any(Symbol, String, T::Array[T.untyped])]))
end

#test?Boolean

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.

Returns:

  • (Boolean)


55
56
57
# File 'dependable.rb', line 55

def test?
  tags.include? :test
end