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.
92 93 94 |
# File 'cask/dsl/depends_on.rb', line 92 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.
140 |
# File 'cask/dsl/depends_on.rb', line 140 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.
87 88 89 |
# File 'cask/dsl/depends_on.rb', line 87 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 |
# 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) __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:) 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.
143 |
# File 'cask/dsl/depends_on.rb', line 143 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.
175 176 177 178 179 180 181 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 |
# File 'cask/dsl/depends_on.rb', line 175 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.
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'cask/dsl/depends_on.rb', line 154 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.
151 |
# File 'cask/dsl/depends_on.rb', line 151 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.
146 147 148 |
# File 'cask/dsl/depends_on.rb', line 146 def requires_macos? @macos_bare_set_top_level || @macos_version_set_top_level || @maximum_macos_set_top_level end |