Add brew fetch --deps

`brew fetch --deps` will also cache the dependencies of any listed formulae.
This commit is contained in:
Adam Vandenberg 2011-04-14 14:57:21 -07:00
parent 94a524cce3
commit d6382efdeb
3 changed files with 27 additions and 8 deletions

View File

@ -154,16 +154,18 @@ didn't include with OS X.
Show the git log for the given formulae. Options that `git-log`(1)
recognizes can be passed before the formula list.
* `fetch [--force] [-v] [--HEAD]` <formula>:
Download the source package for the given <formula>. For tarballs, also
prints MD5 and SHA1 checksums.
* `fetch [--force] [-v] [--HEAD] [--deps]` <formulae>:
Download the source packages for the given <formulae>.
For tarballs, also print MD5 and SHA1 checksums.
If `--HEAD` is passed, download the HEAD version of <formula> instead. `-v`
If `--HEAD` is passed, download the HEAD versions of <formulae> instead. `-v`
may also be passed to make the VCS checkout verbose, useful for seeing if
an existing HEAD cache has been updated.
If `--force` is passed, remove a previously cached version and re-fetch.
If `--deps` is passed, also download dependencies for any listed <formulae>.
* `audit [--strict]`:
Check formulae for Homebrew coding style violations. This should be
run before submitting a new formula for inclusion.

View File

@ -4,7 +4,21 @@ require 'formula'
module Homebrew extend self
def fetch
ARGV.formulae.each do |f|
if ARGV.include? '--deps'
bucket = []
ARGV.formulae.each do |f|
bucket << f
bucket << f.recursive_deps
end
bucket = bucket.flatten.uniq
else
bucket = ARGV.formulae
end
puts "Fetching: #{bucket * ', '}" if bucket.size > 1
bucket.each do |f|
if ARGV.include? "--force" or ARGV.include? "-f"
where_to = `brew --cache #{f.name}`.strip
FileUtils.rm_rf where_to unless where_to.empty?

View File

@ -171,15 +171,18 @@ For all installed or specific formulae, remove any older versions from the cella
Show the git log for the given formulae\. Options that \fBgit\-log\fR(1) recognizes can be passed before the formula list\.
.
.TP
\fBfetch [\-\-force] [\-v] [\-\-HEAD]\fR \fIformula\fR
Download the source package for the given \fIformula\fR\. For tarballs, also prints MD5 and SHA1 checksums\.
\fBfetch [\-\-force] [\-v] [\-\-HEAD] [\-\-deps]\fR \fIformulae\fR
Download the source packages for the given \fIformulae\fR\. For tarballs, also print MD5 and SHA1 checksums\.
.
.IP
If \fB\-\-HEAD\fR is passed, download the HEAD version of \fIformula\fR instead\. \fB\-v\fR may also be passed to make the VCS checkout verbose, useful for seeing if an existing HEAD cache has been updated\.
If \fB\-\-HEAD\fR is passed, download the HEAD versions of \fIformulae\fR instead\. \fB\-v\fR may also be passed to make the VCS checkout verbose, useful for seeing if an existing HEAD cache has been updated\.
.
.IP
If \fB\-\-force\fR is passed, remove a previously cached version and re\-fetch\.
.
.IP
If \fB\-\-deps\fR is passed, also download dependencies for any listed \fIformulae\fR\.
.
.TP
\fBaudit [\-\-strict]\fR
Check formulae for Homebrew coding style violations\. This should be run before submitting a new formula for inclusion\.