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.
This commit is contained in:
parent
c59a638195
commit
663ea030fc
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user