diff options
| author | Anastasia Sulyagina | 2016-08-04 14:37:37 +0400 |
|---|---|---|
| committer | Mike McQuaid | 2016-08-04 11:37:37 +0100 |
| commit | 4338f35b848ad61462fc4f73e1365e6c002201a2 (patch) | |
| tree | b665d8514255302e5d1e7e3950ad68fb3c41d35c /Library/Homebrew | |
| parent | b77a695b7a0c9094d49993d26921a47da919364d (diff) | |
| download | brew-4338f35b848ad61462fc4f73e1365e6c002201a2.tar.bz2 | |
tap: add cask methods.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/cmd/update-report.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/tap.rb | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index b4ecf9886..4e93e6548 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -193,7 +193,7 @@ class Reporter dst = Pathname.new paths.last next unless dst.extname == ".rb" - next unless paths.any? { |p| tap.formula_file?(p)} + next unless paths.any? { |p| tap.formula_file?(p) || tap.cask_file?(p)} case status when "A", "D" diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index a564b3170..f38df64b3 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" + end + # an array of all {Formula} files of this {Tap}. def formula_files @formula_files ||= if formula_dir @@ -322,6 +328,15 @@ class Tap file.extname == ".rb" && file.parent == formula_dir end + # return true if given path would present a cask file in this {Tap}. + # accepts both absolute path and relative path (relative to this {Tap}'s path) + # @private + def cask_file?(file) + file = Pathname.new(file) unless file.is_a? Pathname + file = file.expand_path(path) + file.extname == ".rb" && file.parent == cask_dir + end + # an array of all {Formula} names of this {Tap}. def formula_names @formula_names ||= formula_files.map { |f| formula_file_to_name(f) } |
