brew --cache [formula]

This developer-oriented command lets you ask Homebrew what the cached
filename will be for a brew's tarball.
This commit is contained in:
Adam Vandenberg 2010-02-19 21:55:17 -08:00
parent 1149b082bb
commit 080a7ee3dc
3 changed files with 14 additions and 1 deletions

View File

@ -53,6 +53,8 @@ class AbstractDownloadStrategy
end
class CurlDownloadStrategy <AbstractDownloadStrategy
attr_reader :tarball_path
def initialize url, name, version, specs
super
if @unique_token

View File

@ -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

View File

@ -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