diff --git a/Library/Homebrew/cask/cmd/--cache.rb b/Library/Homebrew/cask/cmd/--cache.rb index d3aaf8e027..f54c1484fc 100644 --- a/Library/Homebrew/cask/cmd/--cache.rb +++ b/Library/Homebrew/cask/cmd/--cache.rb @@ -16,10 +16,14 @@ module Cask def run casks.each do |cask| - puts Download.new(cask).downloader.cached_location + puts cached_location(cask) end end + def self.cached_location(cask) + Download.new(cask).downloader.cached_location + end + def self.help "display the file used to cache the Cask" end diff --git a/Library/Homebrew/cmd/--cache.rb b/Library/Homebrew/cmd/--cache.rb index 225bf68747..f4285f77d1 100644 --- a/Library/Homebrew/cmd/--cache.rb +++ b/Library/Homebrew/cmd/--cache.rb @@ -2,6 +2,7 @@ require "fetch" require "cli/parser" +require "cask/cmd" module Homebrew module_function @@ -29,13 +30,21 @@ module Homebrew if args.no_named? puts HOMEBREW_CACHE else - args.formulae.each do |f| - if Fetch.fetch_bottle?(f) - puts f.bottle.cached_download - else - puts f.cached_download + args.formulae_and_casks.each do |formula_or_cask| + case formula_or_cask + when Formula + formula = formula_or_cask + if Fetch.fetch_bottle?(formula) + puts formula.bottle.cached_download + else + puts formula.cached_download + end + when Cask::Cask + cask = formula_or_cask + puts "cask: #{Cask::Cmd::Cache.cached_location(cask)}" end end end end + end