diff options
| author | Xu Cheng | 2015-09-12 18:04:06 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-09-13 12:57:59 +0800 |
| commit | 5f68fff92b8b3389ca023f913f1e6d83282a3eab (patch) | |
| tree | 54fc14d9ccce0af96d61aa73e58c755daa7286dc /Library/Homebrew | |
| parent | 3bc2ff8e201b3f64c8431b5dc1eb5a49c05b864d (diff) | |
| download | brew-5f68fff92b8b3389ca023f913f1e6d83282a3eab.tar.bz2 | |
support alias for tap
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/formulary.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 89e3feb74..a21d6e731 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -148,7 +148,15 @@ class Formulary @tap = Tap.new user, repo.sub(/^homebrew-/, "") name = @tap.formula_renames.fetch(name, name) path = @tap.formula_files.detect { |file| file.basename(".rb").to_s == name } - path ||= @tap.path/"#{name}.rb" + + unless path + if (possible_alias = @tap.path/"Aliases/#{name}").file? + path = possible_alias.resolved_path + name = path.basename(".rb").to_s + else + path = @tap.path/"#{name}.rb" + end + end super name, path end @@ -279,7 +287,9 @@ class Formulary if possible_tap_formulae.size > 1 raise TapFormulaAmbiguityError.new(ref, possible_tap_formulae) elsif possible_tap_formulae.size == 1 - return FormulaLoader.new(ref, possible_tap_formulae.first) + path = possible_tap_formulae.first.resolved_path + name = path.basename(".rb").to_s + return FormulaLoader.new(name, path) end if newref = FORMULA_RENAMES[ref] @@ -320,7 +330,8 @@ class Formulary Pathname.glob([ "#{tap}Formula/#{name}.rb", "#{tap}HomebrewFormula/#{name}.rb", - "#{tap}#{name}.rb" + "#{tap}#{name}.rb", + "#{tap}Aliases/#{name}", ]).detect(&:file?) end.compact end |
