aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJack Nagel2014-12-05 22:11:23 -0500
committerJack Nagel2014-12-05 22:11:23 -0500
commitd157301cdc926cd0e3f9ecdf9d4b25442f470a4f (patch)
tree84cf71eeab2ff969c67325e9d48fdea301131c2e /Library/Homebrew
parent853399da445cfa4f305a9162264f7a7bdee425b2 (diff)
downloadbrew-d157301cdc926cd0e3f9ecdf9d4b25442f470a4f.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')
-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