From f6a67ea0176dea208f00317b0e4627ebdeb3b289 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 26 Jun 2012 01:35:37 -0500 Subject: 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 --- Library/Homebrew/cmd/create.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/cmd') 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) -- cgit v1.2.3