Class: Formulary::TapLoader Private
- Inherits:
-
FormulaLoader
- Object
- FormulaLoader
- Formulary::TapLoader
- 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 tapped formulae.
Instance Attribute Summary
Attributes inherited from FormulaLoader
#alias_path, #name, #path, #tap
Instance Method Summary collapse
-
#formula_name_path(tapped_name, warn:) ⇒ Object
private
-
#get_formula(spec, alias_path: nil, force_bottle: false, flags: [], ignore_errors: false) ⇒ Object
private
-
#initialize(tapped_name, from:, warn:) ⇒ TapLoader
constructor
private
A new instance of TapLoader.
-
#load_file(flags:, ignore_errors:) ⇒ Object
private
Methods inherited from FormulaLoader
Methods included from Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Constructor Details
#initialize(tapped_name, from:, warn:) ⇒ TapLoader
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 TapLoader.
559 560 561 562 |
# File 'formulary.rb', line 559 def initialize(tapped_name, from:, warn:) name, path, tap = formula_name_path(tapped_name, warn: warn) super name, path, tap: tap end |
Instance Method Details
#formula_name_path(tapped_name, warn:) ⇒ 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.
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 |
# File 'formulary.rb', line 564 def formula_name_path(tapped_name, warn:) user, repo, name = tapped_name.split("/", 3).map(&:downcase) tap = Tap.fetch user, repo path = find_formula_from_name(name, tap) unless path.file? if (possible_alias = tap.alias_dir/name).file? path = possible_alias.resolved_path name = path.basename(".rb").to_s elsif (new_name = tap.formula_renames[name].presence) && (new_path = find_formula_from_name(new_name, tap)).file? old_name = name path = new_path name = new_name new_name = tap.core_tap? ? name : "#{tap}/#{name}" elsif (new_tap_name = tap.tap_migrations[name].presence) new_tap_user, new_tap_repo, = new_tap_name.split("/") new_tap_name = "#{new_tap_user}/#{new_tap_repo}" new_tap = Tap.fetch new_tap_name new_tap.install unless new_tap.installed? new_tapped_name = "#{new_tap_name}/#{name}" name, path = formula_name_path(new_tapped_name, warn: false) old_name = tapped_name new_name = new_tap.core_tap? ? name : new_tapped_name end opoo "Formula #{old_name} was renamed to #{new_name}." if warn && old_name && new_name end [name, path, tap] end |
#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.
596 597 598 599 600 601 602 603 604 |
# File 'formulary.rb', line 596 def get_formula(spec, alias_path: nil, force_bottle: false, flags: [], ignore_errors: false) super rescue FormulaUnreadableError => e raise TapFormulaUnreadableError.new(tap, name, e.formula_error), "", e.backtrace rescue FormulaClassUnavailableError => e raise TapFormulaClassUnavailableError.new(tap, name, e.path, e.class_name, e.class_list), "", e.backtrace rescue FormulaUnavailableError => e raise TapFormulaUnavailableError.new(tap, name), "", e.backtrace end |
#load_file(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.
606 607 608 609 610 611 |
# File 'formulary.rb', line 606 def load_file(flags:, ignore_errors:) super rescue MethodDeprecatedError => e e.issues_url = tap.issues_url || tap.to_s raise end |