formulary: use CoreFormulaRepository

Let's hide implementation detail on where to find core formulae alias
directory. This will benefit future core code and formulae separation.
This commit is contained in:
Xu Cheng 2015-12-19 18:37:12 +08:00
parent 203000cee6
commit 82eb1a4c42
2 changed files with 2 additions and 2 deletions

View File

@ -276,7 +276,7 @@ class Formulary
return FormulaLoader.new(ref, formula_with_that_name)
end
possible_alias = Pathname.new("#{HOMEBREW_LIBRARY}/Aliases/#{ref}")
possible_alias = CoreFormulaRepository.instance.alias_dir/ref
if possible_alias.file?
return AliasLoader.new(possible_alias)
end

View File

@ -69,7 +69,7 @@ class FormularyFactoryTest < Homebrew::TestCase
end
def test_factory_from_alias
alias_dir = HOMEBREW_LIBRARY/"Aliases"
alias_dir = CoreFormulaRepository.instance.alias_dir
alias_dir.mkpath
FileUtils.ln_s @path, alias_dir/"foo"
assert_kind_of Formula, Formulary.factory("foo")