From ea281a1cf928d08a936d336aa822b1193078c90d Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 3 Aug 2018 18:04:28 +0200 Subject: [PATCH] Allow specifying cache directory for download strategies. --- Library/Homebrew/download_strategy.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 9a8eac424a..63c28e68ca 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -22,6 +22,7 @@ class AbstractDownloadStrategy @url = url @name = name @version = version + @cache = meta.fetch(:cache, HOMEBREW_CACHE) @meta = meta @shutup = false extend Pourable if meta[:bottle] @@ -105,7 +106,7 @@ class VCSDownloadStrategy < AbstractDownloadStrategy super @ref_type, @ref = extract_ref(meta) @revision = meta[:revision] - @cached_location = HOMEBREW_CACHE/"#{name}--#{cache_tag}" + @cached_location = @cache/"#{name}--#{cache_tag}" end def fetch @@ -180,7 +181,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy def initialize(url, name, version, **meta) super - @cached_location = HOMEBREW_CACHE/"#{name}-#{version}#{ext}" + @cached_location = @cache/"#{name}-#{version}#{ext}" @temporary_path = Pathname.new("#{cached_location}.incomplete") end