Permalink
Browse files

add url patterns

  • Loading branch information...
1 parent 956ff03 commit c3ede07830695f04c63d5ffd42a25ae3b694acbc @dochang committed Jan 22, 2011
Showing with 61 additions and 9 deletions.
  1. +23 −6 asia.asciidoc
  2. +20 −3 src/installer.lisp
  3. +18 −0 src/test.lisp
View
@@ -174,13 +174,30 @@ Its value is a url for VCS command or download tool, such as:
ASIA handles the url according to the following patterns:
-[separator="!"]
+[separator="!",cols=",l"]
|=====================================================================
-!Git !`^(git|git\+ssh|ssh\+git)://|/git(/|$)|\.git/?$`
-!SVN !`^svn://`
-!Darcs !`/darcs(/|$)`
-!CVS* !`^:pserver:`
-!cURL !`^(https?|ftps?|sftp|file)://`
+!Git !
+^(git|git\+ssh|ssh\+git)://
+| /git(/|$)
+| \.git/?$
+| ^[a-z][a-z0-9+.-]*://git\.
+| ^([^:/]+@)?git\..+:
+
+!SVN !
+^svn://
+| /svn(/|$)
+| ^[a-z][a-z0-9+.-]*://svn\.
+
+!Darcs!
+/darcs(/|$)
+| ^[a-z][a-z0-9+.-]*://darcs\.
+| ^([^:/]+@)?darcs\..+:
+
+!CVS* !
+^:pserver:
+
+!cURL !
+^(https?|ftps?|sftp|file)://
|=====================================================================
CVS url has two parts: cvsroot and module name. ASIA uses a special
View
@@ -71,13 +71,30 @@
(local-install (first (list-directory tmpdir)) project)))
(defun git-url-p (url)
- (pregexp-match "^(git|git\\+ssh|ssh\\+git)://|/git(/|$)|\\.git/?$" url))
+ (pregexp-match "(?x:
+ ^(git|git\\+ssh|ssh\\+git)://
+ | /git(/|$)
+ | \\.git/?$
+ | ^[a-z][a-z0-9+.-]*://git\\.
+ | ^([^:/]+@)?git\\..+:
+ )"
+ url))
(defun svn-url-p (url)
- (pregexp-match "^svn://" url))
+ (pregexp-match "(?x:
+ ^svn://
+ | /svn(/|$)
+ | ^[a-z][a-z0-9+.-]*://svn\\.
+ )"
+ url))
(defun darcs-url-p (url)
- (pregexp-match "/darcs(/|$)" url))
+ (pregexp-match "(?x:
+ /darcs(/|$)
+ | ^[a-z][a-z0-9+.-]*://darcs\\.
+ | ^([^:/]+@)?darcs\\..+:
+ )"
+ url))
(defun cvs-url-p (url)
(pregexp-match "^:pserver:" url))
View
@@ -94,7 +94,18 @@
(assert* (git-url-p "file:///path/project.git/"))
(assert* (git-url-p "/path/project.git"))
(assert* (git-url-p "/path/project.git/"))
+ (assert* (git-url-p "http://git.example.com/project"))
+ (assert* (git-url-p "https://git.example.com/project"))
+ (assert* (git-url-p "ssh://git.example.com/project"))
+ (assert* (git-url-p "git.example.com:project"))
+ (assert* (git-url-p "user@git.example.com:project"))
+ (assert* (git-url-p "git.example.com:/project"))
+ (assert* (git-url-p "user@git.example.com:/project"))
(assert* (svn-url-p "svn://example.com/path"))
+ (assert* (svn-url-p "http://example.com/svn/project"))
+ (assert* (svn-url-p "https://example.com/svn/project"))
+ (assert* (svn-url-p "http://svn.example.com/project"))
+ (assert* (svn-url-p "https://svn.example.com/project"))
(assert* (darcs-url-p "http://example.com/path/project/darcs"))
(assert* (darcs-url-p "https://example.com/path/project/darcs"))
(assert* (darcs-url-p "ssh://example.com/path/project/darcs"))
@@ -104,6 +115,13 @@
(assert* (darcs-url-p "http://example.com/path/darcs/project"))
(assert* (darcs-url-p "https://example.com/path/darcs/project"))
(assert* (darcs-url-p "ssh://example.com/path/darcs/project"))
+ (assert* (darcs-url-p "http://darcs.example.com/project"))
+ (assert* (darcs-url-p "https://darcs.example.com/project"))
+ (assert* (darcs-url-p "ssh://darcs.example.com/project"))
+ (assert* (darcs-url-p "darcs.example.com:project"))
+ (assert* (darcs-url-p "user@darcs.example.com:project"))
+ (assert* (darcs-url-p "darcs.example.com:/project"))
+ (assert* (darcs-url-p "user@darcs.example.com:/project"))
(assert* (cvs-url-p ":pserver:username:password@example.com:/path"))
(assert* (curl-url-p "http://example.com/path/project.tar.gz"))
(assert* (curl-url-p "https://example.com/path/project.tar.gz"))

0 comments on commit c3ede07

Please sign in to comment.