From de5aa6a23a15a8b21a606c1be1679f1b400ec468 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 3 Aug 2018 15:11:04 +0200 Subject: [PATCH] Move `temporary_path` to `AbstractFileDownloadStrategy`. --- Library/Homebrew/download_strategy.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index bea1241ea4..9a8eac424a 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -176,9 +176,12 @@ class VCSDownloadStrategy < AbstractDownloadStrategy end class AbstractFileDownloadStrategy < AbstractDownloadStrategy + attr_reader :temporary_path + def initialize(url, name, version, **meta) super @cached_location = HOMEBREW_CACHE/"#{name}-#{version}#{ext}" + @temporary_path = Pathname.new("#{cached_location}.incomplete") end def stage @@ -203,12 +206,11 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy end class CurlDownloadStrategy < AbstractFileDownloadStrategy - attr_reader :mirrors, :temporary_path + attr_reader :mirrors def initialize(url, name, version, **meta) super @mirrors = meta.fetch(:mirrors, []) - @temporary_path = Pathname.new("#{cached_location}.incomplete") end def fetch @@ -507,12 +509,8 @@ end # url "scp://example.com/src/abc.1.0.tar.gz" # ... class ScpDownloadStrategy < AbstractFileDownloadStrategy - attr_reader :temporary_path - def initialize(url, name, version, **meta) super - @cached_location = HOMEBREW_CACHE/"#{name}-#{version}#{ext}" - @temporary_path = Pathname.new("#{cached_location}.incomplete") parse_url_pattern end