|
@@ -1,19 +1,9 @@
|
1
|
1
|
(in-package :coleslaw)
|
2
|
2
|
|
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)))
|
13
|
|
-
|
14
|
|
-(defun app-path (path)
|
15
|
|
- "Take a relative PATH and return the corresponding pathname beneath coleslaw."
|
16
|
|
- (merge-pathnames path coleslaw-conf:*basedir*))
|
|
3
|
+(defun app-path (path &rest args)
|
|
4
|
+ "Take a relative PATH and return the corresponding pathname beneath coleslaw.
|
|
5
|
+If ARGS is provided, use (apply 'format nil PATH ARGS) as the value of PATH."
|
|
6
|
+ (merge-pathnames (apply 'format nil path args) coleslaw-conf:*basedir*))
|
17
|
7
|
|
18
|
8
|
(defun compile-blog ()
|
19
|
9
|
(let ((staging #p"/tmp/coleslaw/"))
|
|
@@ -22,7 +12,7 @@
|
22
|
12
|
(delete-files staging :recursive t)
|
23
|
13
|
(ensure-directories-exist staging))
|
24
|
14
|
(with-current-directory staging
|
25
|
|
- (let ((css-dir (app-path (format nil "themes/~a/css/" (theme *config*))))
|
|
15
|
+ (let ((css-dir (app-path "themes/~a/css/" (theme *config*)))
|
26
|
16
|
(static-dir (merge-pathnames "static/" (repo *config*))))
|
27
|
17
|
(dolist (dir (list css-dir static-dir))
|
28
|
18
|
(run-program "cp" `("-R" ,dir "."))))
|
|
@@ -36,7 +26,7 @@
|
36
|
26
|
|
37
|
27
|
(defun deploy (dir)
|
38
|
28
|
"Deploy DIR, updating the .prev and .curr symlinks."
|
39
|
|
- (let ((new-build (app-path (format nil "generated/~a" (get-universal-time)))))
|
|
29
|
+ (let ((new-build (app-path "generated/~a" (get-universal-time))))
|
40
|
30
|
(run-program "mv" (list dir (namestring new-build)))
|
41
|
31
|
(when (probe-file (app-path ".prev"))
|
42
|
32
|
(delete-files (read-symlink (app-path ".prev")) :recursive t))
|
|
@@ -47,6 +37,7 @@
|
47
|
37
|
|
48
|
38
|
(defun main ()
|
49
|
39
|
(load-config)
|
|
40
|
+ (compile-theme)
|
50
|
41
|
(loop do (if (blog-update-p)
|
51
|
42
|
(compile-blog)
|
52
|
43
|
(sleep (interval *config*)))))
|