Module: Drupid::DownloadStrategy

Defined in:
lib/drupid/download_strategy.rb

Defined Under Namespace

Classes: Base, Bazaar, CVS, Curl, CurlApacheMirror, CurlError, Fossil, Git, Mercurial, Subversion

Class Method Summary collapse

Class Method Details

.detect(url) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/drupid/download_strategy.rb', line 70

def self.detect url
  case url
  when %r[^file://] then Curl
    # We use a special URL pattern for cvs
  when %r[^cvs://] then CVS
    # Standard URLs
  when %r[^bzr://] then Bazaar
  when %r[^git://] then Git
  when %r[^https?://.+\.git$] then Git
  when %r[^hg://] then Mercurial
  when %r[^svn://] then Subversion
  when %r[^svn\+http://] then Subversion
  when %r[^fossil://] then Fossil
    # Some well-known source hosts
  when %r[^https?://(.+?\.)?googlecode\.com/hg] then Mercurial
  when %r[^https?://(.+?\.)?googlecode\.com/svn] then Subversion
  when %r[^https?://(.+?\.)?sourceforge\.net/svnroot/] then Subversion
  when %r[^http://svn.apache.org/repos/] then Subversion
  when %r[^http://www.apache.org/dyn/closer.cgi] then CurlApacheMirror
    # Common URL patterns
  when %r[^https?://svn\.] then Subversion
  when %r[\.git$] then Git
  when %r[\/] then Curl
  else Curl
  end
end