diff options
| author | AnastasiaSulyagina | 2016-07-20 21:15:20 +0300 |
|---|---|---|
| committer | Mike McQuaid | 2016-08-02 13:44:19 +0100 |
| commit | 05daa0574732a7884bd158b2c3e14bd0709367da (patch) | |
| tree | ce8301b114045ef5b8ddc23fc6023f5296c074a5 | |
| parent | 0302a6bc7cc72aed9b729e9d465856e65b6c8b2c (diff) | |
| download | brew-05daa0574732a7884bd158b2c3e14bd0709367da.tar.bz2 | |
tap: add cask methods.
Closes #562.
| -rw-r--r-- | Library/Homebrew/tap.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index a564b3170..c5692ae80 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -72,6 +72,7 @@ class Tap def clear_cache @remote = nil @formula_dir = nil + @cask_dir = nil @formula_files = nil @alias_dir = nil @alias_files = nil @@ -304,6 +305,11 @@ class Tap @formula_dir ||= [path/"Formula", path/"HomebrewFormula", path].detect(&:directory?) end + # path to the directory of all casks for caskroom/cask {Tap}. + def cask_dir + @cask_dir ||= [path/"Casks", path].detect(&:directory?) + end + # an array of all {Formula} files of this {Tap}. def formula_files @formula_files ||= if formula_dir @@ -319,7 +325,7 @@ class Tap def formula_file?(file) file = Pathname.new(file) unless file.is_a? Pathname file = file.expand_path(path) - file.extname == ".rb" && file.parent == formula_dir + file.extname == ".rb" && (file.parent == formula_dir || file.parent == cask_dir) end # an array of all {Formula} names of this {Tap}. @@ -563,6 +569,14 @@ class CoreTap < Tap end # @private + def cask_dir + @cask_dir ||= begin + self.class.ensure_installed! + super + end + end + + # @private def alias_dir @alias_dir ||= begin self.class.ensure_installed! |
