Merge pull request #1485 from MikeMcQuaid/less-tap-migrate-warnings
formulary: don't warn on old formula name from keg/rack.
This commit is contained in:
commit
fe9ce9ffce
@ -158,8 +158,9 @@ class Formulary
|
|||||||
class TapLoader < FormulaLoader
|
class TapLoader < FormulaLoader
|
||||||
attr_reader :tap
|
attr_reader :tap
|
||||||
|
|
||||||
def initialize(tapped_name)
|
def initialize(tapped_name, from: nil)
|
||||||
name, path = formula_name_path(tapped_name)
|
warn = ![:keg, :rack].include?(from)
|
||||||
|
name, path = formula_name_path(tapped_name, warn: warn)
|
||||||
super name, path
|
super name, path
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -236,8 +237,8 @@ class Formulary
|
|||||||
# * a formula pathname
|
# * a formula pathname
|
||||||
# * a formula URL
|
# * a formula URL
|
||||||
# * a local bottle reference
|
# * a local bottle reference
|
||||||
def self.factory(ref, spec = :stable, alias_path: nil)
|
def self.factory(ref, spec = :stable, alias_path: nil, from: nil)
|
||||||
loader_for(ref).get_formula(spec, alias_path: alias_path)
|
loader_for(ref, from: from).get_formula(spec, alias_path: alias_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return a Formula instance for the given rack.
|
# Return a Formula instance for the given rack.
|
||||||
@ -253,7 +254,7 @@ class Formulary
|
|||||||
if keg
|
if keg
|
||||||
from_keg(keg, spec, alias_path: alias_path)
|
from_keg(keg, spec, alias_path: alias_path)
|
||||||
else
|
else
|
||||||
factory(rack.basename.to_s, spec || :stable, alias_path: alias_path)
|
factory(rack.basename.to_s, spec || :stable, alias_path: alias_path, from: :rack)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -265,13 +266,13 @@ class Formulary
|
|||||||
spec ||= tab.spec
|
spec ||= tab.spec
|
||||||
|
|
||||||
f = if tap.nil?
|
f = if tap.nil?
|
||||||
factory(keg.rack.basename.to_s, spec, alias_path: alias_path)
|
factory(keg.rack.basename.to_s, spec, alias_path: alias_path, from: :keg)
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
factory("#{tap}/#{keg.rack.basename}", spec, alias_path: alias_path)
|
factory("#{tap}/#{keg.rack.basename}", spec, alias_path: alias_path, from: :keg)
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
# formula may be migrated to different tap. Try to search in core and all taps.
|
# formula may be migrated to different tap. Try to search in core and all taps.
|
||||||
factory(keg.rack.basename.to_s, spec, alias_path: alias_path)
|
factory(keg.rack.basename.to_s, spec, alias_path: alias_path, from: :keg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
f.build = tab
|
f.build = tab
|
||||||
@ -309,14 +310,14 @@ class Formulary
|
|||||||
loader_for(ref).path
|
loader_for(ref).path
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.loader_for(ref)
|
def self.loader_for(ref, from: nil)
|
||||||
case ref
|
case ref
|
||||||
when %r{(https?|ftp|file)://}
|
when %r{(https?|ftp|file)://}
|
||||||
return FromUrlLoader.new(ref)
|
return FromUrlLoader.new(ref)
|
||||||
when Pathname::BOTTLE_EXTNAME_RX
|
when Pathname::BOTTLE_EXTNAME_RX
|
||||||
return BottleLoader.new(ref)
|
return BottleLoader.new(ref)
|
||||||
when HOMEBREW_TAP_FORMULA_REGEX
|
when HOMEBREW_TAP_FORMULA_REGEX
|
||||||
return TapLoader.new(ref)
|
return TapLoader.new(ref, from: from)
|
||||||
end
|
end
|
||||||
|
|
||||||
return FromPathLoader.new(ref) if File.extname(ref) == ".rb"
|
return FromPathLoader.new(ref) if File.extname(ref) == ".rb"
|
||||||
@ -359,7 +360,7 @@ class Formulary
|
|||||||
end
|
end
|
||||||
|
|
||||||
unless possible_tap_newname_formulae.empty?
|
unless possible_tap_newname_formulae.empty?
|
||||||
return TapLoader.new(possible_tap_newname_formulae.first)
|
return TapLoader.new(possible_tap_newname_formulae.first, from: from)
|
||||||
end
|
end
|
||||||
|
|
||||||
possible_cached_formula = Pathname.new("#{HOMEBREW_CACHE_FORMULA}/#{ref}.rb")
|
possible_cached_formula = Pathname.new("#{HOMEBREW_CACHE_FORMULA}/#{ref}.rb")
|
||||||
|
@ -119,7 +119,8 @@ module Homebrew
|
|||||||
def stub_formula_loader(formula, ref = formula.full_name)
|
def stub_formula_loader(formula, ref = formula.full_name)
|
||||||
loader = mock
|
loader = mock
|
||||||
loader.stubs(:get_formula).returns(formula)
|
loader.stubs(:get_formula).returns(formula)
|
||||||
Formulary.stubs(:loader_for).with(ref).returns(loader)
|
Formulary.stubs(:loader_for).with(ref, from: :keg).returns(loader)
|
||||||
|
Formulary.stubs(:loader_for).with(ref, from: nil).returns(loader)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user