From 327286cdfb068e8a1763849b321fdec2c3517ed2 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Sun, 6 Dec 2015 20:59:31 +0800 Subject: [PATCH] add Tap#formula_dir --- Library/Homebrew/tap.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 2e9b988088..d5678c1a82 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -152,10 +152,15 @@ class Tap remote.casecmp("https://github.com/#{user}/homebrew-#{repo}") != 0 end + # path to the directory of all {Formula} files for this {Tap}. + def formula_dir + @formula_dir ||= [path/"Formula", path/"HomebrewFormula", path].detect(&:directory?) + end + # an array of all {Formula} files of this {Tap}. def formula_files - @formula_files ||= if dir = [path/"Formula", path/"HomebrewFormula", path].detect(&:directory?) - dir.children.select { |p| p.extname == ".rb" } + @formula_files ||= if formula_dir + formula_dir.children.select { |p| p.extname == ".rb" } else [] end