Class: Utils::Bottles::Tag Private
- Inherits:
-
Object
- Object
- Utils::Bottles::Tag
- Extended by:
- T::Sig
- Defined in:
- utils/bottles.rb
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
-
#==(other) ⇒ Object
private
-
#default_cellar ⇒ String
private
-
#default_prefix ⇒ String
private
-
#initialize(system:, arch:) ⇒ void
constructor
private
-
#linux? ⇒ Boolean
private
-
#macos? ⇒ Boolean
private
-
#to_macos_version ⇒ OS::Mac::Version
private
-
#to_s ⇒ String
private
-
#to_sym ⇒ Symbol
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.
131 132 133 134 |
# File 'utils/bottles.rb', line 131 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.
109 110 111 |
# File 'utils/bottles.rb', line 109 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.
109 110 111 |
# File 'utils/bottles.rb', line 109 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.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'utils/bottles.rb', line 112 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: system, arch: arch) end |
Instance Method Details
#==(other) ⇒ 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.
136 137 138 139 140 141 142 |
# File 'utils/bottles.rb', line 136 def ==(other) if other.is_a?(Symbol) to_sym == other else self.class == other.class && system == other.system && arch == other.arch end end |
#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.
190 191 192 193 194 195 196 197 198 |
# File 'utils/bottles.rb', line 190 def default_cellar if linux? Homebrew::DEFAULT_LINUX_CELLAR elsif 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.
179 180 181 182 183 184 185 186 187 |
# File 'utils/bottles.rb', line 179 def default_prefix if linux? HOMEBREW_LINUX_DEFAULT_PREFIX elsif 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.
166 167 168 |
# File 'utils/bottles.rb', line 166 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.
171 172 173 174 175 176 |
# File 'utils/bottles.rb', line 171 def macos? to_macos_version true rescue MacOSVersionError false end |
#to_macos_version ⇒ OS::Mac::Version
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.
161 162 163 |
# File 'utils/bottles.rb', line 161 def to_macos_version @to_macos_version ||= OS::Mac::Version.from_symbol(system) end |
#to_s ⇒ 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.
156 157 158 |
# File 'utils/bottles.rb', line 156 def to_s to_sym.to_s 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.
145 146 147 148 149 150 151 152 153 |
# File 'utils/bottles.rb', line 145 def to_sym if system == :all && arch == :all :all elsif macos? && arch == :x86_64 system else "#{arch}_#{system}".to_sym end end |