From d6382efdebf2a92b9e115c25f673a499eda8056d Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Thu, 14 Apr 2011 14:57:21 -0700 Subject: Add `brew fetch --deps` `brew fetch --deps` will also cache the dependencies of any listed formulae. --- Library/Contributions/manpages/brew.1.md | 10 ++++++---- Library/Homebrew/cmd/fetch.rb | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'Library') diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md index 409eab697..3030f3b8d 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 8ad3c7f7d..f8eada40a 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? -- cgit v1.2.3