aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorJack Nagel2012-06-26 01:35:37 -0500
committerJack Nagel2012-07-04 22:47:35 -0500
commit56fe164e952e888496bc81495cfc0f66338d50d5 (patch)
tree99e7c7f907aac9e54ef6c8c15624c9e0ecfb79a8 /Library/Homebrew/cmd
parentaf53f54b24581f697a3e5915c33e152d864cfbf6 (diff)
downloadbrew-56fe164e952e888496bc81495cfc0f66338d50d5.tar.bz2
Teach download strategies to take a SoftwareSpec
Now that a URL, version, and the (for lack of a better term) "specs" associated with said URL (e.g. the VCS revision, or a download strategy hint) are neatly bundled up in a SoftwareSpec object, it doesn't make sense to pass them individually to download strategy constructors. These constructors now take only the formula name and a SoftwareSpec as parameters. This allows us to move mirror handling out out of Formula#fetch and into the download strategies themselves. While doing so, we adjust the mirror implementation a bit; mirrors now assume the same "specs" as their owner's URL. They are still only useable by the CurlDownloadStrategy, but this provides a basis for extending mirror support to other strategies. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/create.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/create.rb b/Library/Homebrew/cmd/create.rb
index 97f7e3907..a1f0cb8ca 100644
--- a/Library/Homebrew/cmd/create.rb
+++ b/Library/Homebrew/cmd/create.rb
@@ -89,7 +89,10 @@ class FormulaCreator
unless ARGV.include? "--no-fetch" and version
strategy = DownloadStrategyDetector.new(url).detect
- @sha1 = strategy.new(url, name, version, nil).fetch.sha1 if strategy == CurlDownloadStrategy
+ spec = SoftwareSpec.new
+ spec.url(url)
+ spec.version(version)
+ @sha1 = strategy.new(name, spec).fetch.sha1 if strategy == CurlDownloadStrategy
end
path.write ERB.new(template, nil, '>').result(binding)