aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/resource.rb
diff options
context:
space:
mode:
authorJack Nagel2014-12-05 22:11:23 -0500
committerJack Nagel2014-12-05 22:11:23 -0500
commit8184b8a8915dd968204bda5de6fbe49090ac4c3e (patch)
treeff74aa6844e186de14b50241ae5d9dfaee4f4167 /Library/Homebrew/resource.rb
parent6825aec99a9a48e2b5e021ac9371d8c84d7ec6c2 (diff)
downloadhomebrew-8184b8a8915dd968204bda5de6fbe49090ac4c3e.tar.bz2
Pass the downloader a proxy object instead of the resource
We need to limit the interface that is exposed to the downloader in order to make future changes easier. This will be important for work on new features, such as selecting a mirror from the command line. In the future, the existing Resource class will probably be split into multiple classes.
Diffstat (limited to 'Library/Homebrew/resource.rb')
-rw-r--r--Library/Homebrew/resource.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/Library/Homebrew/resource.rb b/Library/Homebrew/resource.rb
index 9cbce9acb..f6b417fc5 100644
--- a/Library/Homebrew/resource.rb
+++ b/Library/Homebrew/resource.rb
@@ -16,6 +16,28 @@ class Resource
# formula name before initialization of the formula
attr_accessor :name, :owner
+ class Download
+ def initialize(resource)
+ @resource = resource
+ end
+
+ def url
+ @resource.url
+ end
+
+ def specs
+ @resource.specs
+ end
+
+ def version
+ @resource.version
+ end
+
+ def mirrors
+ @resource.mirrors
+ end
+ end
+
def initialize name=nil, &block
@name = name
@url = nil
@@ -28,7 +50,7 @@ class Resource
end
def downloader
- @downloader ||= download_strategy.new(download_name, self)
+ @downloader ||= download_strategy.new(download_name, Download.new(self))
end
# Removes /s from resource names; this allows go package names