|
@@ -1,14 +1,22 @@
|
1
|
1
|
(in-package :coleslaw)
|
2
|
2
|
|
3
|
|
-(defparameter *storage* nil
|
4
|
|
- "A db-spec for postmodern or a hash-table cache. It is expected that
|
5
|
|
-*storage* has methods for each Generic Function in coleslaw implemented.")
|
|
3
|
+(defclass blog ()
|
|
4
|
+ ((author :initarg :author :initform "" :accessor author)
|
|
5
|
+ (domain :initarg :domain :initform "" :accessor domain)
|
|
6
|
+ (interval :initarg :interval :initform 600 :accessor interval)
|
|
7
|
+ (license :initarg :license :initform "" :accessor license)
|
|
8
|
+ (plugins :initarg :plugins :initform '() :accessor plugins)
|
|
9
|
+ (repo :initarg :repo :initform #p"/" :accessor repo)
|
|
10
|
+ (sitenav :initarg :sitenav :initform "" :accessor sitenav)
|
|
11
|
+ (title :initarg :title :initform "" :accessor title)
|
|
12
|
+ (theme :initarg :theme :initform "hyde" :accessor theme)))
|
6
|
13
|
|
7
|
|
-(defgeneric get-credentials (name)
|
8
|
|
- (:documentation "Retrieve the credentials keyed by NAME from *storage*."))
|
|
14
|
+(defparameter *config* nil
|
|
15
|
+ "A variable to store the blog configuration and plugin settings.")
|
9
|
16
|
|
10
|
|
-(defgeneric set-credentials (name credentials)
|
11
|
|
- (:documentation "Store the given CREDENTIALS in *storage* under NAME."))
|
|
17
|
+(defun app-path (path)
|
|
18
|
+ "Take a relative PATH and return the corresponding pathname beneath coleslaw."
|
|
19
|
+ (merge-pathnames path coleslaw-conf:*basedir*))
|
12
|
20
|
|
13
|
21
|
(defun load-config ()
|
14
|
22
|
nil)
|
|
@@ -17,14 +25,24 @@
|
17
|
25
|
nil)
|
18
|
26
|
|
19
|
27
|
(defun compile-blog ()
|
20
|
|
- (with-current-directory *temporary-directory*
|
21
|
|
- nil))
|
|
28
|
+ (let ((staging #p"/tmp/coleslaw/"))
|
|
29
|
+ ; TODO: More incremental compilation? Don't regen whole blog unnecessarily.
|
|
30
|
+ (if (probe-file staging)
|
|
31
|
+ (iolib.os:delete-files staging :recursive t)
|
|
32
|
+ (ensure-directories-exist staging))
|
|
33
|
+ (with-current-directory staging
|
|
34
|
+ (let ((css-dir (app-path (format nil "themes/~a/css/" (theme *config*))))
|
|
35
|
+ (static-dir (merge-pathnames "static/" (repo *config*))))
|
|
36
|
+ (dolist (dir (list css-dir static-dir))
|
|
37
|
+ (iolib.os:run-program "cp" `("-R" ,dir "."))))
|
|
38
|
+ (render-posts)
|
|
39
|
+ (render-indices))
|
|
40
|
+ (deploy staging)))
|
22
|
41
|
|
23
|
|
-;; TODO: Make update interval a config option.
|
24
|
42
|
(defun main ()
|
25
|
43
|
(load-config)
|
26
|
44
|
(unwind-protect
|
27
|
45
|
(loop do (if (blog-update-p)
|
28
|
46
|
(compile-blog)
|
29
|
|
- (sleep 600)))
|
|
47
|
+ (sleep (interval *config*))))
|
30
|
48
|
(exit-handler)))
|