diff options
| author | Adam Vandenberg | 2010-03-17 16:56:06 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2010-04-06 12:54:11 -0700 |
| commit | 2f8011b2e664eab0780cee75c7c46b04228c0d79 (patch) | |
| tree | c3764e196342e6213b60c863e93554fb63465c78 /Library | |
| parent | 1ec2eb331b1f8116ac95ccf183fc8b761f6fa7e8 (diff) | |
| download | homebrew-2f8011b2e664eab0780cee75c7c46b04228c0d79.tar.bz2 | |
Allow :using on head to specify a download strategy.
A 'head' in a formula can now specify which download strategy to use via
a ':using' specification:
head 'http://svn.macosforge.org/repository/darwinbuild/trunk/',
:using => :svn
This reduces the number of cases where "download_strategy" needs to be
overriden.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/formula.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 1bb4889d1..2bba3d4e7 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -134,6 +134,23 @@ class Formula # reimplement if we don't autodetect the download strategy you require def download_strategy + vcs = @specs.delete :using + if vcs != nil + # If a class is passed, assume it is a download strategy + return vcs if vcs.kind_of? Class + + case vcs + when :bzr then return BazaarDownloadStrategy + when :curl then return CurlDownloadStrategy + when :cvs then return CVSDownloadStrategy + when :git then return GitDownloadStrategy + when :hg then return MercurialDownloadStrategy + when :svn then return SubversionDownloadStrategy + end + + raise "Unknown strategy #{vcs} was requested." + end + detect_download_strategy url end |
