From 5201411a6dda474353b7d6c073b1bd04502b637b Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Wed, 10 Dec 2014 00:53:57 -0500 Subject: [PATCH] Provide version reader method --- Library/Homebrew/download_strategy.rb | 7 ++++--- Library/Homebrew/test/test_download_strategies.rb | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 84cbf3778b..bc31babd99 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -3,12 +3,13 @@ require 'utils/json' class AbstractDownloadStrategy include FileUtils - attr_reader :meta, :name, :resource + attr_reader :meta, :name, :version, :resource def initialize name, resource @name = name @resource = resource @url = resource.url + @version = resource.version @meta = resource.specs end @@ -120,7 +121,7 @@ class VCSDownloadStrategy < AbstractDownloadStrategy end def head? - resource.version.head? + version.head? end private @@ -155,7 +156,7 @@ class CurlDownloadStrategy < AbstractDownloadStrategy def initialize(name, resource) super @mirrors = resource.mirrors.dup - @tarball_path = HOMEBREW_CACHE.join("#{name}-#{resource.version}#{ext}") + @tarball_path = HOMEBREW_CACHE.join("#{name}-#{version}#{ext}") @temporary_path = Pathname.new("#{cached_location}.incomplete") end diff --git a/Library/Homebrew/test/test_download_strategies.rb b/Library/Homebrew/test/test_download_strategies.rb index 3dabc7af71..2f4a324ef7 100644 --- a/Library/Homebrew/test/test_download_strategies.rb +++ b/Library/Homebrew/test/test_download_strategies.rb @@ -2,7 +2,7 @@ require 'testing_env' require 'download_strategy' class ResourceDouble - attr_reader :url, :specs + attr_reader :url, :specs, :version def initialize(url="http://example.com/foo.tar.gz", specs={}) @url = url