|
89 | 89 | (check-type release string)
|
90 | 90 | ;; The directory structure has been changed since Aug 13 (quicklisp-2015-09-24).
|
91 | 91 | ;; All project directories are in "projects/" directory now.
|
92 |
| - (merge-pathnames (format nil "projects/~A/source.txt" release) |
93 |
| - (asdf:system-relative-pathname :quickdocs-updater |
94 |
| - #P"modules/quicklisp-projects/"))) |
| 92 | + (let ((file |
| 93 | + (merge-pathnames (format nil "projects/~A/source.txt" release) |
| 94 | + (asdf:system-relative-pathname :quickdocs-updater |
| 95 | + #P"modules/quicklisp-projects/")))) |
| 96 | + (when (probe-file file) |
| 97 | + file))) |
95 | 98 |
|
96 | 99 | (defun project-source-info (release)
|
97 | 100 | (check-type release string)
|
98 | 101 | (flet ((chomp (str)
|
99 | 102 | (subseq str 0 (1+ (position #\Newline str :test #'char/= :from-end t)))))
|
100 |
| - (let ((data (uiop:read-file-string (project-source-txt release)))) |
101 |
| - (destructuring-bind (type source-url) |
102 |
| - (split-sequence #\Space data :count 2) |
103 |
| - (values type (chomp source-url)))))) |
| 103 | + (let ((source.txt (project-source-txt release))) |
| 104 | + (when source.txt |
| 105 | + (let ((data (uiop:read-file-string source.txt))) |
| 106 | + (destructuring-bind (type source-url) |
| 107 | + (split-sequence #\Space data :count 2) |
| 108 | + (values type (chomp source-url)))))))) |
104 | 109 |
|
105 | 110 | (defun release-homepage-url (release)
|
106 | 111 | (check-type release string)
|
107 | 112 | (multiple-value-bind (type source-url)
|
108 | 113 | (project-source-info release)
|
109 |
| - (ignore-some-conditions (quri:uri-error) |
110 |
| - (let* ((uri (quri:uri source-url)) |
111 |
| - (domain (quri:uri-domain uri))) |
112 |
| - (cond |
113 |
| - ((string= domain "common-lisp.net") |
114 |
| - (let ((match (nth-value 1 (ppcre:scan-to-strings "://common-lisp\\.net/project/([^\\/]+)" source-url)))) |
115 |
| - (format nil "http://common-lisp.net/project/~A" |
116 |
| - (quri:url-encode |
117 |
| - (if match |
118 |
| - (aref match 0) |
119 |
| - release) |
120 |
| - :encoding :utf-8)))) |
121 |
| - ((or (string= domain "weitz.de") |
122 |
| - (string= type "ediware-http")) |
123 |
| - (format nil "http://weitz.de/~A/" |
124 |
| - (quri:url-encode release :encoding :utf-8)))))))) |
| 114 | + (when type |
| 115 | + (ignore-some-conditions (quri:uri-error) |
| 116 | + (let* ((uri (quri:uri source-url)) |
| 117 | + (domain (quri:uri-domain uri))) |
| 118 | + (cond |
| 119 | + ((string= domain "common-lisp.net") |
| 120 | + (let ((match (nth-value 1 (ppcre:scan-to-strings "://common-lisp\\.net/project/([^\\/]+)" source-url)))) |
| 121 | + (format nil "http://common-lisp.net/project/~A" |
| 122 | + (quri:url-encode |
| 123 | + (if match |
| 124 | + (aref match 0) |
| 125 | + release) |
| 126 | + :encoding :utf-8)))) |
| 127 | + ((or (string= domain "weitz.de") |
| 128 | + (string= type "ediware-http")) |
| 129 | + (format nil "http://weitz.de/~A/" |
| 130 | + (quri:url-encode release :encoding :utf-8))))))))) |
125 | 131 |
|
126 | 132 | (defun release-repos-url (release)
|
127 | 133 | (check-type release string)
|
128 | 134 | (multiple-value-bind (type source-url)
|
129 | 135 | (project-source-info release)
|
130 |
| - (declare (ignore type)) |
131 |
| - (ignore-some-conditions (quri:uri-error) |
132 |
| - (let* ((uri (quri:uri source-url)) |
133 |
| - (domain (quri:uri-domain uri))) |
134 |
| - (cond |
135 |
| - ((string= domain "github.com") |
136 |
| - (let ((repos-id (ppcre:scan-to-strings "/[^/]+/[a-zA-Z0-9-_.]+" (quri:uri-path uri)))) |
137 |
| - (concatenate 'string |
138 |
| - "https://github.com" |
139 |
| - repos-id))) |
140 |
| - ((string= domain "bitbucket.org") |
141 |
| - source-url) |
142 |
| - ((string= domain "gitlab.common-lisp.net") |
143 |
| - (let ((repos-id (ppcre:scan-to-strings "/[^/]+/[a-zA-Z0-9-_.]+" (quri:uri-path uri)))) |
144 |
| - (concatenate 'string |
145 |
| - "http://gitlab.common-lisp.net" |
146 |
| - repos-id)))))))) |
| 136 | + (when type |
| 137 | + (ignore-some-conditions (quri:uri-error) |
| 138 | + (let* ((uri (quri:uri source-url)) |
| 139 | + (domain (quri:uri-domain uri))) |
| 140 | + (cond |
| 141 | + ((string= domain "github.com") |
| 142 | + (let ((repos-id (ppcre:scan-to-strings "/[^/]+/[a-zA-Z0-9-_.]+" (quri:uri-path uri)))) |
| 143 | + (concatenate 'string |
| 144 | + "https://github.com" |
| 145 | + repos-id))) |
| 146 | + ((string= domain "bitbucket.org") |
| 147 | + source-url) |
| 148 | + ((string= domain "gitlab.common-lisp.net") |
| 149 | + (let ((repos-id (ppcre:scan-to-strings "/[^/]+/[a-zA-Z0-9-_.]+" (quri:uri-path uri)))) |
| 150 | + (concatenate 'string |
| 151 | + "http://gitlab.common-lisp.net" |
| 152 | + repos-id))))))))) |
0 commit comments