Adjust semantics of Formula#fetch

It doesn't really make logical sense that this method returns both the
fetched path (or sometimes nil!) and the downloader, so just return the
path (again, or nil!) and callers that want the downloader can ask for
it separately.
This commit is contained in:
Jack Nagel 2013-05-16 14:06:26 -05:00
parent a6f9a1c4a3
commit daef74aa27
3 changed files with 6 additions and 6 deletions

View File

@ -25,7 +25,7 @@ module Homebrew extend self
def fetch_formula f def fetch_formula f
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? # FIXME why are strategies returning different types?
return unless download.is_a? Pathname return unless download.is_a? Pathname

View File

@ -618,7 +618,7 @@ class Formula
def fetch def fetch
# Ensure the cache exists # Ensure the cache exists
HOMEBREW_CACHE.mkpath HOMEBREW_CACHE.mkpath
return downloader.fetch, downloader downloader.fetch
end end
# For FormulaInstaller. # For FormulaInstaller.
@ -643,8 +643,8 @@ class Formula
private private
def stage def stage
fetched, downloader = fetch fetched = fetch
verify_download_integrity fetched if fetched.kind_of? Pathname verify_download_integrity(fetched) if fetched.kind_of? Pathname
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.

View File

@ -406,8 +406,8 @@ class FormulaInstaller
end end
def pour def pour
fetched, downloader = f.fetch fetched, downloader = f.fetch, f.downloader
f.verify_download_integrity fetched unless downloader.local_bottle_path f.verify_download_integrity(fetched) unless downloader.local_bottle_path
HOMEBREW_CELLAR.cd do HOMEBREW_CELLAR.cd do
downloader.stage downloader.stage
end end