Class: Cask::DSL::DependsOn Private

Inherits:
SimpleDelegator
  • Object
show all
Includes:
DependsOn::DSL, Kernel
Defined in:
cask/dsl/depends_on.rb,
cask/dsl/depends_on.rbi

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.

Constant Summary collapse

VALID_KEYS =

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.let(Set.new([
  :formula,
  :cask,
  :macos,
  :maximum_macos,
  :linux,
  :arch,
]).freeze, T::Set[Symbol])
VALID_ARCHES =

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.let({
  intel:  { type: :intel, bits: 64 },
  # specific
  x86_64: { type: :intel, bits: 64 },
  arm64:  { type: :arm, bits: 64 },
}.freeze, T::Hash[Symbol, T::Hash[Symbol, T.any(Symbol, Integer)]])

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Kernel

#which, #with_env

Methods included from DependsOn::DSL

#depends_on_linux_set_top_level?, #depends_on_macos_set_in_block?, #depends_on_macos_set_top_level?, #requires_linux?, #requires_macos?

Constructor Details

#initialize ⇒ void

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.



43
44
45
46
47
48
49
50
51
# File 'cask/dsl/depends_on.rb', line 43

def initialize
  super({})
  @arch = T.let(nil, T.nilable(T::Array[T::Hash[Symbol, T.any(Symbol, Integer)]]))
  @cask = T.let(nil, T.nilable(T::Array[String]))
  @formula = T.let(nil, T.nilable(T::Array[String]))
  @macos = T.let(nil, T.nilable(MacOSRequirement))
  @maximum_macos = T.let(nil, T.nilable(MacOSRequirement))
  @linux = T.let(nil, T.nilable(LinuxRequirement))
end

Instance Attribute Details

#arch ⇒ Array<Hash{Symbol => Symbol, Integer}>?

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:



31
32
33
# File 'cask/dsl/depends_on.rb', line 31

def arch
  @arch
end

#linux ⇒ LinuxRequirement?

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:



40
41
42
# File 'cask/dsl/depends_on.rb', line 40

def linux
  @linux
end

#macos ⇒ MacOSRequirement?

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:



34
35
36
# File 'cask/dsl/depends_on.rb', line 34

def macos
  @macos
end

#maximum_macos ⇒ MacOSRequirement?

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:



37
38
39
# File 'cask/dsl/depends_on.rb', line 37

def maximum_macos
  @maximum_macos
end

Instance Method Details

#cask ⇒ Array<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:



54
55
56
# File 'cask/dsl/depends_on.rb', line 54

def cask
  @cask ||= []
end

#cask=(*args) ⇒ void

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 returns an undefined value.

Parameters:



94
95
96
# File 'cask/dsl/depends_on.rb', line 94

def cask=(*args)
  cask.concat(args)
end

#empty? ⇒ 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)


141
# File 'cask/dsl/depends_on.rb', line 141

def empty? = T.let(__getobj__, T::Hash[Symbol, T.untyped]).empty?

#formula ⇒ Array<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:



59
60
61
# File 'cask/dsl/depends_on.rb', line 59

def formula
  @formula ||= []
end

#formula=(*args) ⇒ void

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 returns an undefined value.

Parameters:



89
90
91
# File 'cask/dsl/depends_on.rb', line 89

def formula=(*args)
  formula.concat(args)
end

#load(pairs, set_in_block: false, os_scoped: false) ⇒ void

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 returns an undefined value.

Parameters:



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'cask/dsl/depends_on.rb', line 70

def load(pairs, set_in_block: false, os_scoped: false)
  pairs.each do |key, value|
    raise "invalid depends_on key: '#{key.inspect}'" unless VALID_KEYS.include?(key)

    previous_macos = @macos if key == :macos
    public_send(:"#{key}=", *value)
    dependency = public_send(key)
    record_os_requirement(dependency, set_in_block:, os_scoped:) if dependency.is_a?(Requirement)
    __getobj__[key] = dependency
    next if key != :macos
    next if value != :any
    next unless previous_macos&.version_specified?

    @macos = previous_macos
    __getobj__[key] = previous_macos
  end
end

#present? ⇒ 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)


144
# File 'cask/dsl/depends_on.rb', line 144

def present? = !empty?