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.

[:build, :optional, :recommended, :run, :test, :linked, :implicit, :no_linkage].freeze

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)


37
38
39
# File 'dependable.rb', line 37

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)


57
58
59
# File 'dependable.rb', line 57

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)


62
63
64
# File 'dependable.rb', line 62

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:



34
# File 'dependable.rb', line 34

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:



72
73
74
# File 'dependable.rb', line 72

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)


42
43
44
# File 'dependable.rb', line 42

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:



77
78
79
# File 'dependable.rb', line 77

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)


82
83
84
85
86
# File 'dependable.rb', line 82

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)


89
90
91
92
93
94
95
96
97
98
99
# File 'dependable.rb', line 89

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)


47
48
49
# File 'dependable.rb', line 47

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)


67
68
69
# File 'dependable.rb', line 67

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:



29
30
31
# File 'dependable.rb', line 29

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)


52
53
54
# File 'dependable.rb', line 52

def test?
  tags.include? :test
end