diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md index 409eab697f..3030f3b8d2 100644 --- a/Library/Contributions/manpages/brew.1.md +++ b/Library/Contributions/manpages/brew.1.md @@ -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]` : - Download the source package for the given . For tarballs, also - prints MD5 and SHA1 checksums. + * `fetch [--force] [-v] [--HEAD] [--deps]` : + Download the source packages for the given . + For tarballs, also print MD5 and SHA1 checksums. - If `--HEAD` is passed, download the HEAD version of instead. `-v` + If `--HEAD` is passed, download the HEAD versions of 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 . + * `audit [--strict]`: Check formulae for Homebrew coding style violations. This should be run before submitting a new formula for inclusion. diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 8ad3c7f7dc..f8eada40a0 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -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? diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1 index ed8a909dcb..c394dd7f6c 100644 --- a/share/man/man1/brew.1 +++ b/share/man/man1/brew.1 @@ -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\.