|
@@ -11,38 +11,38 @@
|
11
|
11
|
(title :initarg :title :initform "" :accessor title)
|
12
|
12
|
(theme :initarg :theme :initform "hyde" :accessor theme)))
|
13
|
13
|
|
14
|
|
-(defparameter *config* nil
|
15
|
|
- "A variable to store the blog configuration and plugin settings.")
|
16
|
|
-
|
17
|
14
|
(defun app-path (path)
|
18
|
15
|
"Take a relative PATH and return the corresponding pathname beneath coleslaw."
|
19
|
16
|
(merge-pathnames path coleslaw-conf:*basedir*))
|
20
|
17
|
|
21
|
|
-(defun load-config ()
|
22
|
|
- nil)
|
23
|
|
-
|
24
|
|
-(defun exit-handler ()
|
25
|
|
- nil)
|
26
|
|
-
|
27
|
18
|
(defun compile-blog ()
|
28
|
19
|
(let ((staging #p"/tmp/coleslaw/"))
|
29
|
20
|
; TODO: More incremental compilation? Don't regen whole blog unnecessarily.
|
30
|
21
|
(if (probe-file staging)
|
31
|
|
- (iolib.os:delete-files staging :recursive t)
|
|
22
|
+ (delete-files staging :recursive t)
|
32
|
23
|
(ensure-directories-exist staging))
|
33
|
24
|
(with-current-directory staging
|
34
|
25
|
(let ((css-dir (app-path (format nil "themes/~a/css/" (theme *config*))))
|
35
|
26
|
(static-dir (merge-pathnames "static/" (repo *config*))))
|
36
|
27
|
(dolist (dir (list css-dir static-dir))
|
37
|
|
- (iolib.os:run-program "cp" `("-R" ,dir "."))))
|
|
28
|
+ (run-program "cp" `("-R" ,dir "."))))
|
38
|
29
|
(render-posts)
|
39
|
30
|
(render-indices))
|
40
|
31
|
(deploy staging)))
|
41
|
32
|
|
|
33
|
+(defun deploy (dir)
|
|
34
|
+ "Deploy DIR, updating the .prev and .curr symlinks."
|
|
35
|
+ (let ((new-build (app-path (format nil "generated/~a" (get-universal-time)))))
|
|
36
|
+ (run-program "mv" (list dir (app-path new-build)))
|
|
37
|
+ (when (probe-file (app-path ".prev"))
|
|
38
|
+ (delete-files (read-symlink (app-path ".prev")) :recursive t))
|
|
39
|
+ (when (probe-file (app-path ".curr"))
|
|
40
|
+ (run-program "ln" (list "-sfn" (read-symlink (app-path ".curr")) ".prev")))
|
|
41
|
+ (run-program "ln" (list "-sfn" new-build ".curr")))
|
|
42
|
+ (setf (last-published) (last-commit)))
|
|
43
|
+
|
42
|
44
|
(defun main ()
|
43
|
45
|
(load-config)
|
44
|
|
- (unwind-protect
|
45
|
|
- (loop do (if (blog-update-p)
|
46
|
|
- (compile-blog)
|
47
|
|
- (sleep (interval *config*))))
|
48
|
|
- (exit-handler)))
|
|
46
|
+ (loop do (if (blog-update-p)
|
|
47
|
+ (compile-blog)
|
|
48
|
+ (sleep (interval *config*)))))
|