Class: Formulary::FromBottleLoader Private
- Inherits:
-
FormulaLoader
- Object
- FormulaLoader
- Formulary::FromBottleLoader
- 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
Class Method Summary collapse
Instance Method Summary collapse
- #get_formula(spec, force_bottle: false, flags: [], ignore_errors: false) ⇒ Object private
-
#initialize(bottle_name, warn: false) ⇒ FromBottleLoader
constructor
private
A new instance of FromBottleLoader.
Methods inherited from FormulaLoader
Methods included from Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Constructor Details
#initialize(bottle_name, warn: false) ⇒ FromBottleLoader
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 FromBottleLoader.
599 600 601 602 603 |
# File 'formulary.rb', line 599 def initialize(bottle_name, warn: false) @bottle_path = Pathname(bottle_name).realpath name, full_name = Utils::Bottles.resolve_formula_names(@bottle_path) super name, Formulary.path(full_name) end |
Class Method Details
.try_new(ref, from: nil, warn: false) ⇒ 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.
591 592 593 594 595 596 597 |
# File 'formulary.rb', line 591 def self.try_new(ref, from: nil, warn: false) return if Homebrew::EnvConfig.forbid_packages_from_paths? ref = ref.to_s new(ref) if HOMEBREW_BOTTLES_EXTNAME_REGEX.match?(ref) && File.exist?(ref) 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.
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
# File 'formulary.rb', line 605 def get_formula(spec, force_bottle: false, flags: [], ignore_errors: false, **) formula = begin contents = Utils::Bottles.formula_contents(@bottle_path, name:) Formulary.from_contents(name, path, contents, spec, force_bottle:, flags:, ignore_errors:) rescue FormulaUnreadableError => e opoo <<~EOS Unreadable formula in #{@bottle_path}: #{e} EOS super rescue BottleFormulaUnavailableError => e opoo <<~EOS #{e} Falling back to non-bottle formula. EOS super end formula.local_bottle_path = @bottle_path formula end |