aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Contributions/examples/brew-fetch.rb
blob: 2f7ddc6f80ff07a11de6736995efe13b60811a2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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

  the_tarball = f.downloader.fetch
  if the_tarball.kind_of? Pathname
    puts "MD5:  #{the_tarball.md5}"
    puts "SHA1: #{the_tarball.sha1}"
  end
end