Module: Homebrew::API::FormulaBottle Private

Defined in:
api/formula_bottle.rb

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Class Method Summary collapse

Class Method Details

.bottle(name:, formula_struct:, bottle_tag: Utils::Bottles.tag) ⇒ ::Bottle?

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.

Parameters:

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'api/formula_bottle.rb', line 19

def self.bottle(name:, formula_struct:, bottle_tag: Utils::Bottles.tag)
  return unless formula_struct.stable?
  return unless formula_struct.bottle?

  bottle_specification = BottleSpecification.new
  bottle_specification.root_url(
    if Homebrew::EnvConfig.bottle_domain == HOMEBREW_BOTTLE_DEFAULT_DOMAIN
      HOMEBREW_BOTTLE_DEFAULT_DOMAIN
    else
      Homebrew::EnvConfig.bottle_domain
    end,
  )
  bottle_specification.rebuild(formula_struct.bottle_rebuild)
  formula_struct.bottle_checksums.each { |args| bottle_specification.sha256(args) }

  return unless bottle_specification.tag?(bottle_tag)

  ::Bottle.new(
    nil,
    bottle_specification,
    bottle_tag,
    name:,
    pkg_version: PkgVersion.new(::Version.new(formula_struct.stable_version), formula_struct.revision),
  )
end