Class: Utils::Bottles::Tag Private
Overview
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.
Denotes the arch and OS of a bottle.
Instance Attribute Summary collapse
- #arch ⇒ Object readonly private
- #system ⇒ Object readonly private
Class Method Summary collapse
Instance Method Summary collapse
- #default_cellar ⇒ String private
- #default_prefix ⇒ String private
- #initialize(system:, arch:) ⇒ void constructor private
- #linux? ⇒ Boolean private
- #macos? ⇒ Boolean private
- #standardized_arch ⇒ Symbol private
- #to_macos_version ⇒ MacOSVersion private
- #to_sym ⇒ Symbol private
- #to_unstandardized_sym ⇒ Object private
- #valid_combination? ⇒ Boolean private
Constructor Details
#initialize(system:, arch:) ⇒ 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.
165 166 167 168 |
# File 'utils/bottles.rb', line 165 def initialize(system:, arch:) @system = system @arch = arch end |
Instance Attribute Details
#arch ⇒ Object (readonly)
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 144 145 |
# File 'utils/bottles.rb', line 143 def arch @arch end |
#system ⇒ Object (readonly)
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 144 145 |
# File 'utils/bottles.rb', line 143 def system @system end |
Class Method Details
.from_symbol(value) ⇒ T.attached_class
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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'utils/bottles.rb', line 146 def self.from_symbol(value) return new(system: :all, arch: :all) if value == :all @all_archs_regex ||= begin all_archs = Hardware::CPU::ALL_ARCHS.map(&:to_s) / ^((?<arch>#{Regexp.union(all_archs)})_)? (?<system>[\w.]+)$ /x end match = @all_archs_regex.match(value.to_s) raise ArgumentError, "Invalid bottle tag symbol" unless match system = match[:system].to_sym arch = match[:arch]&.to_sym || :x86_64 new(system:, arch:) end |
Instance Method Details
#default_cellar ⇒ 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.
248 249 250 251 252 253 254 255 256 |
# File 'utils/bottles.rb', line 248 def default_cellar if linux? Homebrew::DEFAULT_LINUX_CELLAR elsif standardized_arch == :arm64 Homebrew::DEFAULT_MACOS_ARM_CELLAR else Homebrew::DEFAULT_MACOS_CELLAR end end |
#default_prefix ⇒ 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.
237 238 239 240 241 242 243 244 245 |
# File 'utils/bottles.rb', line 237 def default_prefix if linux? HOMEBREW_LINUX_DEFAULT_PREFIX elsif standardized_arch == :arm64 HOMEBREW_MACOS_ARM_DEFAULT_PREFIX else HOMEBREW_DEFAULT_PREFIX end end |
#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.
218 219 220 |
# File 'utils/bottles.rb', line 218 def linux? system == :linux end |
#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.
223 224 225 |
# File 'utils/bottles.rb', line 223 def macos? MacOSVersion::SYMBOLS.key?(system) end |
#standardized_arch ⇒ Symbol
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.
187 188 189 190 191 192 |
# File 'utils/bottles.rb', line 187 def standardized_arch return :x86_64 if [:x86_64, :intel].include? arch return :arm64 if [:arm64, :arm, :aarch64].include? arch arch end |
#to_macos_version ⇒ MacOSVersion
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.
213 214 215 |
# File 'utils/bottles.rb', line 213 def to_macos_version @to_macos_version ||= MacOSVersion.from_symbol(system) end |
#to_sym ⇒ Symbol
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.
195 196 197 |
# File 'utils/bottles.rb', line 195 def to_sym arch_to_symbol(standardized_arch) end |
#to_unstandardized_sym ⇒ Object
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.
204 205 206 207 208 209 210 |
# File 'utils/bottles.rb', line 204 def to_unstandardized_sym # Never allow these generic names return to_sym if [:intel, :arm].include? arch # Backwards compatibility with older bottle names arch_to_symbol(arch) end |
#valid_combination? ⇒ 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.
228 229 230 231 232 233 234 |
# File 'utils/bottles.rb', line 228 def valid_combination? return true unless [:arm64, :arm, :aarch64].include? arch return true unless macos? # Big Sur is the first version of macOS that runs on ARM to_macos_version >= :big_sur end |