1 | ;; (defmacro site (&body lines) |
---|
2 | ;; `(dolist (line (quote ,lines)) |
---|
3 | ;; (format t "~a~&" line))) |
---|
4 | |
---|
5 | (in-package :atom) |
---|
6 | |
---|
7 | (defmacro get-conflist (sym conflines) |
---|
8 | `(rest (assoc ,sym ,conflines))) |
---|
9 | |
---|
10 | (defmacro get-confvalue (sym conflines) |
---|
11 | `(first (rest (assoc ,sym ,conflines)))) |
---|
12 | |
---|
13 | (defmacro build-updatefeed (collection-feed feed feedtype source-locator-prefix) |
---|
14 | "Helper macro to build an update feed (feedtype: snapshotsfeed or fragmentfeed)" |
---|
15 | `(let* |
---|
16 | ((entry |
---|
17 | (get-conflist ,feedtype (rest ,feed))) |
---|
18 | (entry-obj |
---|
19 | (make-instance |
---|
20 | 'collection-entry |
---|
21 | :id (get-confvalue 'id entry) |
---|
22 | :link-type ,feedtype |
---|
23 | :tm-id (id ,collection-feed) |
---|
24 | :path (format nil "~a/~a" (path ,collection-feed) (get-confvalue 'relative-path entry)) |
---|
25 | :title (get-confvalue 'title entry)))) |
---|
26 | ;(format t "feed: ~a" ,feed) |
---|
27 | ;(format t "entry: ~a" entry) |
---|
28 | (register-entry ,collection-feed entry-obj) |
---|
29 | (register-subfeed |
---|
30 | ,collection-feed |
---|
31 | (make-instance |
---|
32 | ,feedtype |
---|
33 | :id (get-confvalue 'id entry) |
---|
34 | :author (author ,collection-feed) |
---|
35 | :path (format nil "~a/~a" (path ,collection-feed) (get-confvalue 'relative-path entry)) |
---|
36 | :tm-id (id ,collection-feed) |
---|
37 | :source-locator-prefix ,source-locator-prefix |
---|
38 | :title (get-confvalue 'title entry))))) |
---|
39 | |
---|
40 | (defmacro defsite (sitename &body conflines) |
---|
41 | "Macro to encapsulate the definition of feeds for the TMs the engine hosts" |
---|
42 | |
---|
43 | (setf *tm-feed* |
---|
44 | (make-instance |
---|
45 | 'feed |
---|
46 | :id (string-downcase sitename) |
---|
47 | :title (get-confvalue 'title conflines) |
---|
48 | :path (get-confvalue 'relative-path conflines) |
---|
49 | :author (get-confvalue 'author conflines))) |
---|
50 | |
---|
51 | (dolist (feed |
---|
52 | (remove-if-not (lambda (elem) (eq elem 'collection-feed)) conflines :key #'first)) |
---|
53 | |
---|
54 | (let* |
---|
55 | ((collection-url |
---|
56 | (format nil "~a/~a" (get-confvalue 'relative-path conflines) (get-confvalue 'relative-path (rest feed)))) |
---|
57 | (source-locator-prefix (get-confvalue 'source-locator-prefix (rest feed))) |
---|
58 | (overview-entry |
---|
59 | (make-instance |
---|
60 | 'overview-entry |
---|
61 | :id (get-confvalue 'id (rest feed)) |
---|
62 | :title (get-confvalue 'title (rest feed)) |
---|
63 | :author (get-confvalue 'author (rest feed)) |
---|
64 | :path collection-url)) |
---|
65 | (cf |
---|
66 | (make-instance |
---|
67 | 'collection-feed |
---|
68 | :id (get-confvalue 'id (rest feed)) |
---|
69 | :title (get-confvalue 'title (rest feed)) |
---|
70 | :source-locator-prefix source-locator-prefix |
---|
71 | :dependency (get-conflist 'dependency (rest feed)) |
---|
72 | :author (get-confvalue 'author (rest feed)) |
---|
73 | :path collection-url))) |
---|
74 | |
---|
75 | (register-entry *tm-feed* overview-entry) |
---|
76 | (register-subfeed *tm-feed* cf) |
---|
77 | |
---|
78 | (build-updatefeed cf feed 'fragments-feed source-locator-prefix) |
---|
79 | (build-updatefeed cf feed 'snapshots-feed source-locator-prefix)))) |
---|
80 | |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | |
---|