Class: SoftwareSpec
- Extended by:
- Forwardable
- Includes:
- Downloadable, OnSystem::MacOSAndLinux
- Defined in:
- software_spec.rb,
sorbet/rbi/dsl/software_spec.rbi
Direct Known Subclasses
Instance Attribute Summary collapse
- #bottle_specification ⇒ BottleSpecification readonly private
- #build ⇒ BuildOptions readonly private
- #compiler_failures ⇒ Array<CompilerFailure> readonly private
- #dependency_collector ⇒ DependencyCollector readonly private
- #deprecated_flags ⇒ Array<DeprecatedOption> readonly private
- #deprecated_options ⇒ Array<DeprecatedOption> readonly private
- #full_name ⇒ String? readonly private
- #name ⇒ String? readonly private
- #options ⇒ Options readonly private
- #owner ⇒ Formula, ... private
- #patches ⇒ Array<EmbeddedPatch, ExternalPatch> readonly private
- #resources ⇒ Hash{String => Resource} readonly private
Attributes included from Downloadable
Instance Method Summary collapse
- #add_dep_option(dep) ⇒ void private
- #bottle(&block) ⇒ void private
- #bottle_defined? ⇒ Boolean private
- #bottle_tag?(tag = nil) ⇒ Boolean private
- #bottled?(tag = nil) ⇒ Boolean private
- #cached_download(*args, &block) ⇒ T.untyped private
- #checksum(*args, &block) ⇒ T.untyped private
- #clear_cache(*args, &block) ⇒ T.untyped private
- #declared_deps ⇒ Dependencies private
- #depends_on(spec) ⇒ void private
- #deprecated_option(hash) ⇒ void private
- #deps ⇒ Dependencies private
- #download_queue_name(*args, &block) ⇒ T.untyped private
- #download_queue_type(*args, &block) ⇒ T.untyped private
- #downloader(*args, &block) ⇒ T.untyped private
- #fails_with(compiler, &block) ⇒ void private
- #fetch(*args, &block) ⇒ T.untyped private
- #freeze ⇒ T.self_type private
- #initialize(flags: []) ⇒ void constructor private
- #initialize_dup(other) ⇒ void private
- #mirror(*args, &block) ⇒ T.untyped private
- #mirrors(*args, &block) ⇒ T.untyped private
- #option(name, description = "") ⇒ void private
- #option_defined?(name) ⇒ Boolean private
- #patch(strip = :p1, src = T.unsafe(nil), &block) ⇒ void private
- #recursive_dependencies ⇒ Array<Dependable> private
- #recursive_requirements ⇒ Requirements private
- #requirements ⇒ Requirements private
- #resource(name = T.unsafe(nil), klass = Resource, &block) ⇒ Resource? private
- #resource_defined?(name) ⇒ Boolean private
- #sha256(*args, &block) ⇒ T.untyped private
- #source_modified_time(*args, &block) ⇒ T.untyped private
- #specs(*args, &block) ⇒ T.untyped private
- #stage(*args, &block) ⇒ T.untyped private
- #url(val = nil, specs = {}) ⇒ String? private
- #uses_from_macos(dep, bounds = {}) ⇒ void private
- #using(*args, &block) ⇒ T.untyped private
- #verify_download_integrity(*args, &block) ⇒ T.untyped private
- #version(*args, &block) ⇒ T.untyped private
Methods included from OnSystem::MacOSAndLinux
included, #on_arch_conditional, #on_macos, #on_system_conditional
Methods included from Downloadable
#download_strategy, #downloaded!, #downloaded?, #downloading!, #extracting!, #fetched_size, #total_size, #verified!, #verifying!
Methods included from Utils::Output::Mixin
#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled
Methods included from Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Constructor Details
#initialize(flags: []) ⇒ 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.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'software_spec.rb', line 66 def initialize(flags: []) super() @name = T.let(nil, T.nilable(String)) @full_name = T.let(nil, T.nilable(String)) @owner = T.let(nil, T.nilable(T.any(Formula, Cask::Cask))) # Ensure this is synced with `initialize_dup` and `freeze` (excluding simple objects like integers and booleans) @resource = T.let(Resource::Formula.new, Resource::Formula) @resources = T.let({}, T::Hash[String, Resource]) @dependency_collector = T.let(DependencyCollector.new, DependencyCollector) @bottle_specification = T.let(BottleSpecification.new, BottleSpecification) @patches = T.let([], T::Array[T.any(EmbeddedPatch, ExternalPatch)]) @options = T.let(Options.new, Options) @flags = T.let(flags, T::Array[String]) @deprecated_flags = T.let([], T::Array[DeprecatedOption]) @deprecated_options = T.let([], T::Array[DeprecatedOption]) @build = T.let(BuildOptions.new(Options.create(@flags), ), BuildOptions) @compiler_failures = T.let([], T::Array[CompilerFailure]) end |
Instance Attribute Details
#bottle_specification ⇒ BottleSpecification (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.
54 55 56 |
# File 'software_spec.rb', line 54 def bottle_specification @bottle_specification end |
#build ⇒ BuildOptions (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.
33 34 35 |
# File 'software_spec.rb', line 33 def build @build end |
#compiler_failures ⇒ Array<CompilerFailure> (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.
57 58 59 |
# File 'software_spec.rb', line 57 def compiler_failures @compiler_failures end |
#dependency_collector ⇒ DependencyCollector (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.
51 52 53 |
# File 'software_spec.rb', line 51 def dependency_collector @dependency_collector end |
#deprecated_flags ⇒ Array<DeprecatedOption> (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.
45 46 47 |
# File 'software_spec.rb', line 45 def deprecated_flags @deprecated_flags end |
#deprecated_options ⇒ Array<DeprecatedOption> (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.
48 49 50 |
# File 'software_spec.rb', line 48 def @deprecated_options end |
#full_name ⇒ String? (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.
27 28 29 |
# File 'software_spec.rb', line 27 def full_name @full_name end |
#name ⇒ String? (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.
24 25 26 |
# File 'software_spec.rb', line 24 def name @name end |
#options ⇒ Options (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.
42 43 44 |
# File 'software_spec.rb', line 42 def @options end |
#owner ⇒ Formula, ...
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 'software_spec.rb', line 30 def owner @owner end |
#patches ⇒ Array<EmbeddedPatch, ExternalPatch> (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.
39 40 41 |
# File 'software_spec.rb', line 39 def patches @patches end |
#resources ⇒ Hash{String => Resource} (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.
36 37 38 |
# File 'software_spec.rb', line 36 def resources @resources end |
Instance Method Details
#add_dep_option(dep) ⇒ 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.
319 320 321 322 323 324 325 326 327 |
# File 'software_spec.rb', line 319 def add_dep_option(dep) dep.option_names.each do |name| if dep.optional? && !option_defined?("with-#{name}") << Option.new("with-#{name}", "Build with #{name} support") elsif dep.recommended? && !option_defined?("without-#{name}") << Option.new("without-#{name}", "Build without #{name} support") end end end |
#bottle(&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.
169 170 171 |
# File 'software_spec.rb', line 169 def bottle(&block) bottle_specification.instance_eval(&block) end |
#bottle_defined? ⇒ 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 'software_spec.rb', line 146 def bottle_defined? !bottle_specification.collector..empty? end |
#bottle_tag?(tag = nil) ⇒ 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 152 153 |
# File 'software_spec.rb', line 151 def bottle_tag?(tag = nil) bottle_specification.tag?(Utils::Bottles.tag(tag)) end |
#bottled?(tag = nil) ⇒ 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.
156 157 158 159 160 161 162 163 164 165 166 |
# File 'software_spec.rb', line 156 def bottled?(tag = nil) return false unless bottle_tag?(tag) return true if tag.present? return true if bottle_specification.compatible_locations? owner = self.owner return false unless owner.is_a?(Formula) owner.force_bottle end |
#cached_download(*args, &block) ⇒ T.untyped
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.
10 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 10 def cached_download(*args, &block); end |
#checksum(*args, &block) ⇒ T.untyped
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.
13 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 13 def checksum(*args, &block); end |
#clear_cache(*args, &block) ⇒ T.untyped
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.
16 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 16 def clear_cache(*args, &block); end |
#declared_deps ⇒ Dependencies
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.
269 270 271 |
# File 'software_spec.rb', line 269 def declared_deps dependency_collector.deps end |
#depends_on(spec) ⇒ 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.
238 239 240 241 |
# File 'software_spec.rb', line 238 def depends_on(spec) dep = dependency_collector.add(spec) add_dep_option(dep) if dep end |
#deprecated_option(hash) ⇒ 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.
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'software_spec.rb', line 215 def deprecated_option(hash) raise ArgumentError, "deprecated_option hash must not be empty" if hash.empty? hash.each do |, | Array().each do |old_option| Array().each do |new_option| deprecated_option = DeprecatedOption.new(old_option, new_option) << deprecated_option old_flag = deprecated_option.old_flag new_flag = deprecated_option.current_flag next unless @flags.include? old_flag @flags -= [old_flag] @flags |= [new_flag] @deprecated_flags << deprecated_option end end end @build = BuildOptions.new(Options.create(@flags), ) end |
#deps ⇒ Dependencies
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.
264 265 266 |
# File 'software_spec.rb', line 264 def deps dependency_collector.deps.dup_without_system_deps end |
#download_queue_name(*args, &block) ⇒ T.untyped
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.
19 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 19 def download_queue_name(*args, &block); end |
#download_queue_type(*args, &block) ⇒ T.untyped
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.
22 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 22 def download_queue_type(*args, &block); end |
#downloader(*args, &block) ⇒ T.untyped
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.
25 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 25 def downloader(*args, &block); end |
#fails_with(compiler, &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.
314 315 316 |
# File 'software_spec.rb', line 314 def fails_with(compiler, &block) compiler_failures << CompilerFailure.create(compiler, &block) end |
#fetch(*args, &block) ⇒ T.untyped
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.
28 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 28 def fetch(*args, &block); end |
#freeze ⇒ T.self_type
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.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'software_spec.rb', line 104 def freeze @resource.freeze @resources.freeze @dependency_collector.freeze @bottle_specification.freeze @patches.freeze @options.freeze @flags.freeze @deprecated_flags.freeze @deprecated_options.freeze @build.freeze @compiler_failures.freeze super end |
#initialize_dup(other) ⇒ 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.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'software_spec.rb', line 88 def initialize_dup(other) super @resource = @resource.dup @resources = @resources.dup @dependency_collector = @dependency_collector.dup @bottle_specification = @bottle_specification.dup @patches = @patches.dup @options = @options.dup @flags = @flags.dup @deprecated_flags = @deprecated_flags.dup @deprecated_options = @deprecated_options.dup @build = @build.dup @compiler_failures = @compiler_failures.dup end |
#mirror(*args, &block) ⇒ T.untyped
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.
31 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 31 def mirror(*args, &block); end |
#mirrors(*args, &block) ⇒ T.untyped
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.
34 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 34 def mirrors(*args, &block); end |
#option(name, description = "") ⇒ 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.
206 207 208 209 210 211 212 |
# File 'software_spec.rb', line 206 def option(name, description = "") raise ArgumentError, "option name is required" if name.empty? raise ArgumentError, "option name must be longer than one character: #{name}" if name.length <= 1 raise ArgumentError, "option name must not start with dashes: #{name}" if name.start_with?("-") << Option.new(name, description) end |
#option_defined?(name) ⇒ 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.
201 202 203 |
# File 'software_spec.rb', line 201 def option_defined?(name) .include?(name) end |
#patch(strip = :p1, src = T.unsafe(nil), &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.
305 306 307 308 309 310 311 |
# File 'software_spec.rb', line 305 def patch(strip = :p1, src = T.unsafe(nil), &block) p = Patch.create(strip, src, &block) return if p.is_a?(ExternalPatch) && p.url.blank? dependency_collector.add(p.resource) if p.is_a? ExternalPatch patches << p end |
#recursive_dependencies ⇒ Array<Dependable>
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.
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'software_spec.rb', line 274 def recursive_dependencies deps_f = [] recursive_dependencies = deps.filter_map do |dep| deps_f << dep.to_formula dep rescue TapFormulaUnavailableError # Don't complain about missing cross-tap dependencies next end.uniq deps_f.compact.each do |f| f.recursive_dependencies.each do |dep| recursive_dependencies << dep unless recursive_dependencies.include?(dep) end end recursive_dependencies end |
#recursive_requirements ⇒ Requirements
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.
297 298 299 |
# File 'software_spec.rb', line 297 def recursive_requirements Requirement.(self) end |
#requirements ⇒ Requirements
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.
292 293 294 |
# File 'software_spec.rb', line 292 def requirements dependency_collector.requirements end |
#resource(name = T.unsafe(nil), klass = Resource, &block) ⇒ Resource?
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.
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'software_spec.rb', line 182 def resource(name = T.unsafe(nil), klass = Resource, &block) if block raise ArgumentError, "Resource must have a name." if name.nil? raise DuplicateResourceError, name if resource_defined?(name) res = klass.new(name, &block) return unless res.url resources[name] = res dependency_collector.add(res) res else return @resource if name.nil? resources.fetch(name) { raise ResourceMissingError.new(owner, name) } end end |
#resource_defined?(name) ⇒ 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.
174 175 176 |
# File 'software_spec.rb', line 174 def resource_defined?(name) resources.key?(name) end |
#sha256(*args, &block) ⇒ T.untyped
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.
37 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 37 def sha256(*args, &block); end |
#source_modified_time(*args, &block) ⇒ T.untyped
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.
40 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 40 def source_modified_time(*args, &block); end |
#specs(*args, &block) ⇒ T.untyped
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 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 43 def specs(*args, &block); end |
#stage(*args, &block) ⇒ T.untyped
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.
46 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 46 def stage(*args, &block); end |
#url(val = nil, specs = {}) ⇒ 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.
137 138 139 140 141 142 143 |
# File 'software_spec.rb', line 137 def url(val = nil, specs = {}) if val @resource.url(val, **specs) dependency_collector.add(@resource) end @resource.url end |
#uses_from_macos(dep, bounds = {}) ⇒ 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.
249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'software_spec.rb', line 249 def uses_from_macos(dep, bounds = {}) if dep.is_a?(Hash) bounds = dep.dup dep, = bounds.shift dep = T.cast(dep, String) = [*] bounds = T.cast(bounds, T::Hash[Symbol, Symbol]) else = [] end depends_on UsesFromMacOSDependency.new(dep, , bounds:) end |
#using(*args, &block) ⇒ T.untyped
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.
49 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 49 def using(*args, &block); end |
#verify_download_integrity(*args, &block) ⇒ T.untyped
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.
52 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 52 def verify_download_integrity(*args, &block); end |
#version(*args, &block) ⇒ T.untyped
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.
55 |
# File 'sorbet/rbi/dsl/software_spec.rbi', line 55 def version(*args, &block); end |