diff options
| author | Jack Nagel | 2012-06-26 01:35:37 -0500 |
|---|---|---|
| committer | Jack Nagel | 2012-07-04 22:47:35 -0500 |
| commit | f6a67ea0176dea208f00317b0e4627ebdeb3b289 (patch) | |
| tree | 4371a6b03fa440a374e6b79e5db84023916dc742 /Library/Homebrew/cmd | |
| parent | 96f396c9d461aa50049e0856e8f32667ad3a9c37 (diff) | |
| download | homebrew-f6a67ea0176dea208f00317b0e4627ebdeb3b289.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.rb | 5 |
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) |
