From 9ffc7dd46516e1d94ca4c386fc6006c61bd0e6ca Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 1 Aug 2018 05:33:03 +0200 Subject: [PATCH] Use `Resource#downloader` for `BottleLoader`. --- Library/Homebrew/formulary.rb | 2 +- Library/Homebrew/resource.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 4a552b1be7..974ed85cea 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -105,7 +105,7 @@ module Formulary formula_name = File.basename(bottle_name)[/(.+)-/, 1] resource = Resource.new(formula_name) { url bottle_name } resource.specs[:bottle] = true - downloader = CurlDownloadStrategy.new(resource.download_name, resource.version, resource) + downloader = resource.downloader cached = downloader.cached_location.exist? downloader.fetch ohai "Pouring the cached bottle" if cached diff --git a/Library/Homebrew/resource.rb b/Library/Homebrew/resource.rb index b5088a84f6..6343331a72 100644 --- a/Library/Homebrew/resource.rb +++ b/Library/Homebrew/resource.rb @@ -64,7 +64,9 @@ class Resource end def download_name - name.nil? ? owner.name : "#{owner.name}--#{escaped_name}" + return owner.name if name.nil? + return escaped_name if owner.nil? + "#{owner.name}--#{escaped_name}" end def cached_download