aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-03-17 16:56:06 -0700
committerAdam Vandenberg2010-04-06 12:54:11 -0700
commit663ea030fc8a93ae66e6fbf148d7af88eec7c6cf (patch)
tree401ae9bddf54d61be4fb8129e29a78acaf77225a /Library
parentc59a6381956a1a6408f6b6686476fecc437cca1d (diff)
downloadbrew-663ea030fc8a93ae66e6fbf148d7af88eec7c6cf.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.rb17
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