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, formula: nil) ⇒ ::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:



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

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

  bottle_specification = BottleSpecification.new
  bottle_specification.root_url(
    if Homebrew::EnvConfig.bottle_domain_custom?
      Homebrew::EnvConfig.bottle_domain
    else
      HOMEBREW_BOTTLE_DEFAULT_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)

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