From e3a3a0c320a86a02be231783dfdf79923ab53d2c Mon Sep 17 00:00:00 2001 From: Jack Nagel <jacknagel@gmail.com> Date: Tue, 17 Sep 2013 21:25:40 -0500 Subject: [PATCH] Reorganize resource download methods --- Library/Homebrew/resource.rb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/resource.rb b/Library/Homebrew/resource.rb index c089c4ee5e..f9409f7604 100644 --- a/Library/Homebrew/resource.rb +++ b/Library/Homebrew/resource.rb @@ -30,10 +30,21 @@ class Resource end def downloader - download_name = name == :default ? owner.name : "#{owner.name}--#{name}" @downloader ||= download_strategy.new(download_name, self) end + def download_name + name == :default ? owner.name : "#{owner.name}--#{name}" + end + + def download_strategy + @download_strategy ||= DownloadStrategyDetector.detect(url, using) + end + + def cached_download + downloader.cached_location + end + # Download the resource # If a target is given, unpack there; else unpack to a temp folder # If block is given, yield to that block @@ -51,14 +62,6 @@ class Resource end end - def download_strategy - @download_strategy ||= DownloadStrategyDetector.detect(url, using) - end - - def cached_download - downloader.cached_location - end - # For brew-fetch and others. def fetch # Ensure the cache exists -- GitLab