aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-06-15 21:52:11 -0700
committerAdam Vandenberg2010-06-15 21:52:11 -0700
commit5e7ac882656c1fcf675d939bffe44e71b813a931 (patch)
treeee77a17b2a56c5f5f0351d5fcc2a7a0d83a09689 /Library
parent07914a48eece34d8f2ae1d91a0233199ac7c9dae (diff)
downloadbrew-5e7ac882656c1fcf675d939bffe44e71b813a931.tar.bz2
brew fetch --force to force redownload of tarballs
External command "brew fetch" now allows -f|--force to remove an existing cached file before downloading.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/examples/brew-fetch.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Contributions/examples/brew-fetch.rb b/Library/Contributions/examples/brew-fetch.rb
index 73e1f6a87..a3fb29320 100755
--- a/Library/Contributions/examples/brew-fetch.rb
+++ b/Library/Contributions/examples/brew-fetch.rb
@@ -1,7 +1,13 @@
# Downloads the tarballs for the given formulae to the Cache
require 'formula'
+require 'fileutils'
ARGV.formulae.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?
+ end
+
f.downloader.fetch
end