Use Resource#downloader for BottleLoader.

This commit is contained in:
Markus Reiter 2018-08-01 05:33:03 +02:00
parent 3d27b2aa8d
commit 9ffc7dd465
2 changed files with 4 additions and 2 deletions

View File

@ -105,7 +105,7 @@ module Formulary
formula_name = File.basename(bottle_name)[/(.+)-/, 1] formula_name = File.basename(bottle_name)[/(.+)-/, 1]
resource = Resource.new(formula_name) { url bottle_name } resource = Resource.new(formula_name) { url bottle_name }
resource.specs[:bottle] = true resource.specs[:bottle] = true
downloader = CurlDownloadStrategy.new(resource.download_name, resource.version, resource) downloader = resource.downloader
cached = downloader.cached_location.exist? cached = downloader.cached_location.exist?
downloader.fetch downloader.fetch
ohai "Pouring the cached bottle" if cached ohai "Pouring the cached bottle" if cached

View File

@ -64,7 +64,9 @@ class Resource
end end
def download_name 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 end
def cached_download def cached_download