Class: Formulary::FormulaLoader Private
- Inherits:
-
Object
- Object
- Formulary::FormulaLoader
- Includes:
- Context
- 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.
A FormulaLoader returns instances of formulae. Subclasses implement loaders for particular sources of formulae.
Direct Known Subclasses
AliasLoader, BottleLoader, FormulaAPILoader, FormulaContentsLoader, FromPathLoader, FromUrlLoader, NullLoader, TapLoader
Instance Attribute Summary collapse
-
#alias_path ⇒ Object
readonly
private
The name used to install the formula.
-
#name ⇒ Object
readonly
private
The formula’s name.
-
#path ⇒ Object
readonly
private
The formula’s ruby file’s path or filename.
Instance Method Summary collapse
-
#get_formula(spec, alias_path: nil, force_bottle: false, flags: [], ignore_errors: false) ⇒ Object
private
Gets the formula instance.
-
#initialize(name, path) ⇒ FormulaLoader
constructor
private
A new instance of FormulaLoader.
-
#klass(flags:, ignore_errors:) ⇒ Object
private
Methods included from Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Constructor Details
#initialize(name, path) ⇒ FormulaLoader
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 FormulaLoader.
385 386 387 388 |
# File 'formulary.rb', line 385 def initialize(name, path) @name = name @path = path.resolved_path end |
Instance Attribute Details
#alias_path ⇒ Object (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.
The name used to install the formula
383 384 385 |
# File 'formulary.rb', line 383 def alias_path @alias_path end |
#name ⇒ Object (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.
The formula’s name
379 380 381 |
# File 'formulary.rb', line 379 def name @name end |
#path ⇒ Object (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.
The formula’s ruby file’s path or filename
381 382 383 |
# File 'formulary.rb', line 381 def path @path end |
Instance Method Details
#get_formula(spec, alias_path: nil, 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.
Gets the formula instance.
alias_path
can be overridden here in case an alias was used to refer to
a formula that was loaded in another way.
393 394 395 396 397 |
# File 'formulary.rb', line 393 def get_formula(spec, alias_path: nil, force_bottle: false, flags: [], ignore_errors: false) alias_path ||= self.alias_path klass(flags: flags, ignore_errors: ignore_errors) .new(name, path, spec, alias_path: alias_path, force_bottle: force_bottle) end |
#klass(flags:, ignore_errors:) ⇒ 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.
399 400 401 402 |
# File 'formulary.rb', line 399 def klass(flags:, ignore_errors:) load_file(flags: flags, ignore_errors: ignore_errors) unless Formulary.formula_class_defined_from_path?(path) Formulary.formula_class_get_from_path(path) end |