Class: Cask::DSL::DependsOn Private
- Includes:
- 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)]])
Constants included from Kernel
Kernel::IGNORE_INTERRUPTS_MUTEX
Instance Attribute Summary collapse
- #arch ⇒ Array<Hash{Symbol => Symbol, Integer}>? private
- #linux ⇒ LinuxRequirement? private
- #macos ⇒ MacOSRequirement? private
- #maximum_macos ⇒ MacOSRequirement? private
Instance Method Summary collapse
- #cask ⇒ Array<String> private
- #cask=(*args) ⇒ Array<String> private
- #empty? ⇒ Boolean private
- #formula ⇒ Array<String> private
- #formula=(*args) ⇒ Array<String> private
- #initialize ⇒ void constructor private
- #load(pairs, set_in_block: false) ⇒ void private
- #present? ⇒ Boolean private
- #record_macos_requirement(requirement, set_in_block:) ⇒ void private
- #record_os_requirement(key, set_in_block:) ⇒ void private
- #requires_linux? ⇒ Boolean private
- #requires_macos? ⇒ Boolean 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
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.
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'cask/dsl/depends_on.rb', line 42 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)) @macos_bare_set_top_level = T.let(false, T::Boolean) @macos_version_set_top_level = T.let(false, T::Boolean) @maximum_macos_set_top_level = T.let(false, T::Boolean) @linux_set_top_level = T.let(false, T::Boolean) 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.
30 31 32 |
# File 'cask/dsl/depends_on.rb', line 30 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.
39 40 41 |
# File 'cask/dsl/depends_on.rb', line 39 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.
33 34 35 |
# File 'cask/dsl/depends_on.rb', line 33 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.
36 37 38 |
# File 'cask/dsl/depends_on.rb', line 36 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.
57 58 59 |
# File 'cask/dsl/depends_on.rb', line 57 def cask @cask ||= [] end |
#cask=(*args) ⇒ 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.
99 100 101 |
# File 'cask/dsl/depends_on.rb', line 99 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.
147 |
# File 'cask/dsl/depends_on.rb', line 147 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.
62 63 64 |
# File 'cask/dsl/depends_on.rb', line 62 def formula @formula ||= [] end |
#formula=(*args) ⇒ 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.
94 95 96 |
# File 'cask/dsl/depends_on.rb', line 94 def formula=(*args) formula.concat(args) end |
#load(pairs, set_in_block: 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.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'cask/dsl/depends_on.rb', line 72 def load(pairs, set_in_block: false) pairs.each do |key, value| raise "invalid depends_on key: '#{key.inspect}'" unless VALID_KEYS.include?(key) previous_macos = @macos if key == :macos __getobj__[key] = case key when :macos, :maximum_macos send(:"#{key}=", *value, set_in_block:) else send(:"#{key}=", *value) end record_os_requirement(key, set_in_block:) 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.
150 |
# File 'cask/dsl/depends_on.rb', line 150 def present? = !empty? |
#record_macos_requirement(requirement, set_in_block:) ⇒ 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.
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'cask/dsl/depends_on.rb', line 182 def record_macos_requirement(requirement, set_in_block:) return if set_in_block raise "`depends_on :linux` cannot be combined with `depends_on macos:`" if requires_linux? if !requirement.version_specified? raise "`depends_on :macos` cannot be combined with another macOS `depends_on`" if @macos_bare_set_top_level if @macos_version_set_top_level || @maximum_macos_set_top_level # odeprecated "`depends_on :macos` with `depends_on macos:`" end @macos_bare_set_top_level = true elsif requirement.comparator == "<=" if @macos_bare_set_top_level # odeprecated "`depends_on :macos` with `depends_on maximum_macos:`" end if @maximum_macos_set_top_level raise "`depends_on maximum_macos:` cannot be combined with another macOS `depends_on`" end @maximum_macos_set_top_level = true else if @macos_bare_set_top_level # odeprecated "`depends_on :macos` with `depends_on macos:`" end if @macos_version_set_top_level raise "`depends_on macos:` cannot be combined with another macOS `depends_on`" end @macos_version_set_top_level = true end end |
#record_os_requirement(key, set_in_block:) ⇒ 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.
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'cask/dsl/depends_on.rb', line 161 def record_os_requirement(key, set_in_block:) case key when :macos macos = @macos raise "invalid 'depends_on macos' value" unless macos record_macos_requirement(macos, set_in_block:) when :maximum_macos maximum_macos = @maximum_macos raise "invalid 'depends_on maximum_macos' value" unless maximum_macos record_macos_requirement(maximum_macos, set_in_block:) when :linux return if set_in_block raise "`depends_on :linux` cannot be combined with `depends_on macos:`" if requires_macos? @linux_set_top_level = true end end |
#requires_linux? ⇒ 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.
158 |
# File 'cask/dsl/depends_on.rb', line 158 def requires_linux? = @linux_set_top_level |
#requires_macos? ⇒ 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.
153 154 155 |
# File 'cask/dsl/depends_on.rb', line 153 def requires_macos? @macos_bare_set_top_level || @macos_version_set_top_level || @maximum_macos_set_top_level end |