From 91f22b7552bc3fb99eaafdd2f82dbd9e556f7d11 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Tue, 6 Aug 2013 19:53:43 -0700 Subject: Allow resource fetching Closes #20047. --- Library/Homebrew/cmd/fetch.rb | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'Library/Homebrew/cmd/fetch.rb') diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index f075bcdce..8af5ff7ca 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -16,14 +16,36 @@ module Homebrew extend self end puts "Fetching: #{bucket * ', '}" if bucket.size > 1 - bucket.each { |f| fetch_formula(f) } + bucket.each do |f| + fetch_formula(f) + f.resources.each do |r| + fetch_resource(r) + end + end end def already_fetched? f f.cached_download.exist? end + def fetch_resource r + puts "Resource: #{r.name}" + fetch_fetchable r + rescue ChecksumMismatchError => e + Homebrew.failed = true + opoo "Resource #{r.name} reports different #{e.hash_type}: #{e.expected}" + end + def fetch_formula f + fetch_fetchable f + rescue ChecksumMismatchError => e + Homebrew.failed = true + opoo "Formula reports different #{e.hash_type}: #{e.expected}" + end + + private + + def fetch_fetchable f f.cached_download.rmtree if already_fetched?(f) && ARGV.force? download = f.fetch @@ -33,8 +55,5 @@ module Homebrew extend self puts Checksum::TYPES.map { |t| "#{t.to_s.upcase}: #{download.send(t)}" } f.verify_download_integrity(download) - rescue ChecksumMismatchError => e - Homebrew.failed = true - opoo "Formula reports different #{e.hash_type}: #{e.expected}" end end -- cgit v1.2.3