aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/tap.rb
diff options
context:
space:
mode:
authorXu Cheng2015-12-06 20:59:31 +0800
committerXu Cheng2015-12-09 16:56:59 +0800
commit327286cdfb068e8a1763849b321fdec2c3517ed2 (patch)
treec55407cbd748f2d0317ffbd117dbcd718c16fe39 /Library/Homebrew/tap.rb
parent89bd945bb7d623571da389db0167843fdbc805d6 (diff)
downloadbrew-327286cdfb068e8a1763849b321fdec2c3517ed2.tar.bz2
add Tap#formula_dir
Diffstat (limited to 'Library/Homebrew/tap.rb')
-rw-r--r--Library/Homebrew/tap.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb
index 2e9b98808..d5678c1a8 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