Class: Formulary::BottleLoader Private
- Inherits:
-
FormulaLoader
- Object
- FormulaLoader
- Formulary::BottleLoader
- Defined in:
- formulary.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.
Loads a formula from a bottle.
Instance Attribute Summary
Attributes inherited from FormulaLoader
#alias_path, #name, #path, #tap
Instance Method Summary collapse
-
#get_formula(spec, force_bottle: false, flags: [], ignore_errors: false) ⇒ Object
private
-
#initialize(bottle_name) ⇒ BottleLoader
constructor
private
A new instance of BottleLoader.
Methods inherited from FormulaLoader
Methods included from Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Constructor Details
#initialize(bottle_name) ⇒ BottleLoader
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.
Returns a new instance of BottleLoader.
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'formulary.rb', line 457 def initialize(bottle_name) case bottle_name when URL_START_REGEX # The name of the formula is found between the last slash and the last hyphen. formula_name = File.basename(bottle_name)[/(.+)-/, 1] resource = Resource.new(formula_name) { url bottle_name } resource.specs[:bottle] = true downloader = resource.downloader cached = downloader.cached_location.exist? downloader.fetch ohai "Pouring the cached bottle" if cached @bottle_filename = downloader.cached_location else @bottle_filename = Pathname(bottle_name).realpath end name, full_name = Utils::Bottles.resolve_formula_names @bottle_filename super name, Formulary.path(full_name) end |
Instance Method Details
#get_formula(spec, force_bottle: false, flags: [], ignore_errors: false) ⇒ 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.
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
# File 'formulary.rb', line 476 def get_formula(spec, force_bottle: false, flags: [], ignore_errors: false, **) formula = begin contents = Utils::Bottles.formula_contents @bottle_filename, name: name Formulary.from_contents(name, path, contents, spec, force_bottle: force_bottle, flags: flags, ignore_errors: ignore_errors) rescue FormulaUnreadableError => e opoo <<~EOS Unreadable formula in #{@bottle_filename}: #{e} EOS super rescue BottleFormulaUnavailableError => e opoo <<~EOS #{e} Falling back to non-bottle formula. EOS super end formula.local_bottle_path = @bottle_filename formula end |