Pass new tap to TapLoader

Co-authored-by: Alexander Mancevice <alexander.mancevice@hey.com>
This commit is contained in:
Rylan Polster 2023-11-13 14:00:22 -05:00
parent 237a42974b
commit aa316109d9
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64
2 changed files with 5 additions and 4 deletions

View File

@ -915,6 +915,7 @@ module Formulary
name, path = Formulary.tap_formula_name_path(new_tapped_name, warn: false) name, path = Formulary.tap_formula_name_path(new_tapped_name, warn: false)
old_name = tapped_name old_name = tapped_name
new_name = new_tap.core_tap? ? name : new_tapped_name new_name = new_tap.core_tap? ? name : new_tapped_name
tap = new_tap
end end
opoo "Formula #{old_name} was renamed to #{new_name}." if warn && old_name && new_name opoo "Formula #{old_name} was renamed to #{new_name}." if warn && old_name && new_name
@ -926,9 +927,9 @@ module Formulary
def self.tap_loader_for(tapped_name, warn:) def self.tap_loader_for(tapped_name, warn:)
name, path, tap = Formulary.tap_formula_name_path(tapped_name, warn: warn) name, path, tap = Formulary.tap_formula_name_path(tapped_name, warn: warn)
if Tap.from_path(path).core_tap? && !Homebrew::EnvConfig.no_install_from_api? && if tap.core_tap? && !Homebrew::EnvConfig.no_install_from_api? &&
Homebrew::API::Formula.all_formulae.key?(name) Homebrew::API::Formula.all_formulae.key?(name)
FormulaAPILoader.new(name, tap: tap) FormulaAPILoader.new(name)
else else
TapLoader.new(name, path, tap: tap) TapLoader.new(name, path, tap: tap)
end end

View File

@ -211,7 +211,7 @@ describe Formulary do
EOS EOS
formula = described_class.factory("#{tap}/#{formula_name}") formula = described_class.factory("#{tap}/#{formula_name}")
expect(formula).to be_a(Formula) expect(formula).to be_a(Formula)
expect(formula.tap).to eq(tap) expect(formula.tap).to eq(CoreTap.instance)
expect(formula.path).to eq(formula_path) expect(formula.path).to eq(formula_path)
end end
@ -223,7 +223,7 @@ describe Formulary do
EOS EOS
formula = described_class.factory("#{tap}/#{formula_name}") formula = described_class.factory("#{tap}/#{formula_name}")
expect(formula).to be_a(Formula) expect(formula).to be_a(Formula)
expect(formula.tap).to eq(tap) expect(formula.tap).to eq(another_tap)
expect(formula.path).to eq(another_tap_formula_path) expect(formula.path).to eq(another_tap_formula_path)
end end
end end