aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/download_strategy.rb2
-rw-r--r--Library/Homebrew/formula.rb4
-rwxr-xr-xbin/brew9
3 files changed, 14 insertions, 1 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index e60b879b6..b49cf4d6e 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -53,6 +53,8 @@ class AbstractDownloadStrategy
end
class CurlDownloadStrategy <AbstractDownloadStrategy
+ attr_reader :tarball_path
+
def initialize url, name, version, specs
super
if @unique_token
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 0af5651e3..34cd5ef24 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -133,6 +133,10 @@ class Formula
self.class.path name
end
+ def cached_download
+ @downloader.tarball_path
+ end
+
attr_reader :url, :version, :homepage, :name, :specs
def bin; prefix+'bin' end
diff --git a/bin/brew b/bin/brew
index dfbc4e3dd..f1e445b1b 100755
--- a/bin/brew
+++ b/bin/brew
@@ -14,7 +14,14 @@ require 'global'
case ARGV.first
when '--cache'
- puts HOMEBREW_CACHE
+ if ARGV.named.empty?
+ puts HOMEBREW_CACHE
+ else
+ require 'formula'
+ ARGV.named.each do |name|
+ puts Formula.factory(name).cached_download rescue '(built from source control)'
+ end
+ end
exit 0
when '-h', '--help', '--usage', '-?', 'help', nil
puts ARGV.usage