Formula#fetch: always return the cached path

This allows us to remove some type checks that were protecting against
potential nils.
This commit is contained in:
Jack Nagel 2013-05-16 14:06:26 -05:00
parent daef74aa27
commit 2d8496129c
2 changed files with 3 additions and 3 deletions

View File

@ -27,8 +27,7 @@ module Homebrew extend self
f.cached_download.rmtree if already_fetched?(f) && ARGV.force? f.cached_download.rmtree if already_fetched?(f) && ARGV.force?
download = f.fetch download = f.fetch
# FIXME why are strategies returning different types? return unless download.file?
return unless download.is_a? Pathname
puts "Downloaded to: #{download}" unless already_fetched?(f) puts "Downloaded to: #{download}" unless already_fetched?(f)
puts Checksum::TYPES.map { |t| "#{t.to_s.upcase}: #{download.send(t)}" } puts Checksum::TYPES.map { |t| "#{t.to_s.upcase}: #{download.send(t)}" }

View File

@ -619,6 +619,7 @@ class Formula
# Ensure the cache exists # Ensure the cache exists
HOMEBREW_CACHE.mkpath HOMEBREW_CACHE.mkpath
downloader.fetch downloader.fetch
cached_download
end end
# For FormulaInstaller. # For FormulaInstaller.
@ -644,7 +645,7 @@ class Formula
def stage def stage
fetched = fetch fetched = fetch
verify_download_integrity(fetched) if fetched.kind_of? Pathname verify_download_integrity(fetched) if fetched.file?
mktemp do mktemp do
downloader.stage downloader.stage
# Set path after the downloader changes the working folder. # Set path after the downloader changes the working folder.