|
@@ -3,12 +3,12 @@
|
3
|
3
|
(defvar *last-revision* nil
|
4
|
4
|
"The git revision prior to the last push. For use with GET-UPDATED-FILES.")
|
5
|
5
|
|
6
|
|
-(defun main (&optional (repo-dir "") oldrev)
|
7
|
|
- "Load the user's config file, then compile and deploy the site. Optionally,
|
8
|
|
-REPO-DIR is the location of the blog repo and OLDREV is the revision prior to
|
9
|
|
-the last push."
|
10
|
|
- (setf *last-revision* oldrev)
|
|
6
|
+(defun main (repo-dir &optional oldrev)
|
|
7
|
+ "Load the user's config file, then compile and deploy the blog stored
|
|
8
|
+in REPO-DIR. Optionally, OLDREV is the revision prior to the last push."
|
11
|
9
|
(load-config repo-dir)
|
|
10
|
+ (setf (repo *config*) repo-dir
|
|
11
|
+ *last-revision* oldrev)
|
12
|
12
|
(load-content)
|
13
|
13
|
(compile-theme (theme *config*))
|
14
|
14
|
(let ((dir (staging-dir *config*)))
|
|
@@ -40,19 +40,10 @@ the last push."
|
40
|
40
|
(update-symlink "index.html" "1.html")))
|
41
|
41
|
|
42
|
42
|
(defgeneric deploy (staging)
|
43
|
|
- (:documentation "Deploy the STAGING dir, updating the .prev and .curr symlinks.")
|
|
43
|
+ (:documentation "Deploy the STAGING build to the directory specified in the config.")
|
44
|
44
|
(:method (staging)
|
45
|
|
- (let* ((dest (deploy-dir *config*))
|
46
|
|
- (new-build (rel-path dest "generated/~a" (get-universal-time)))
|
47
|
|
- (prev (rel-path dest ".prev"))
|
48
|
|
- (curr (rel-path dest ".curr")))
|
49
|
|
- (ensure-directories-exist new-build)
|
50
|
|
- (run-program "mv ~a ~a" staging new-build)
|
51
|
|
- (when (and (probe-file prev) (truename prev))
|
52
|
|
- (run-program "rm -r ~a" (truename prev)))
|
53
|
|
- (when (probe-file curr)
|
54
|
|
- (update-symlink prev (truename curr)))
|
55
|
|
- (update-symlink curr new-build))))
|
|
45
|
+ (let ((destination (deploy-dir *config*)))
|
|
46
|
+ (run-program "rsync --delete -avz ~a ~a" staging destination))))
|
56
|
47
|
|
57
|
48
|
(defun update-symlink (path target)
|
58
|
49
|
"Update the symlink at PATH to point to TARGET."
|