diff --git a/example.coleslawrc b/example.coleslawrc index 2a06cb8..661469b 100644 --- a/example.coleslawrc +++ b/example.coleslawrc @@ -1,8 +1,9 @@ (:author "Brit Butler" + :deploy "/home/git/blog/" :domain "http://blog.redlinernotes.com" :license "CC-BY-SA" - :plugins (markdown mathjax) - :repo "/home/redline/projects/coleslaw/ignore/input/" + :plugins (mathjax) + :repo "/home/git/tmp/improvedmeans/" :sitenav "" :title "Improved Means for Achieving Deteriorated Ends" :theme "hyde") diff --git a/example.post-receive b/example.post-receive new file mode 100644 index 0000000..afb89eb --- /dev/null +++ b/example.post-receive @@ -0,0 +1,8 @@ +GIT_REPO=$HOME/improvedmeans.git +# TMP_GIT_CLONE _must_ match the :repo arg in coleslawrc excluding trailing slash +TMP_GIT_CLONE=$HOME/tmp/improvedmeans + +git clone $GIT_REPO $TMP_GIT_CLONE +sbcl --eval "(progn (ql:quickload 'coleslaw) (coleslaw:main) (sb-ext:quit))" +rm -Rf $TMP_GIT_CLONE +exit diff --git a/src/coleslaw.lisp b/src/coleslaw.lisp index 0b66da2..5891949 100644 --- a/src/coleslaw.lisp +++ b/src/coleslaw.lisp @@ -45,17 +45,19 @@ If RAW is non-nil, write the content without wrapping it in the base template." (defgeneric deploy (dir) (:documentation "Deploy DIR, updating the .prev and .curr symlinks.") (:method (dir) - (let ((new-build (app-path "generated/~a" (get-universal-time))) - (prev (merge-pathnames ".prev" (deploy *config*))) - (curr (merge-pathnames ".curr" (deploy *config*)))) - (ensure-directories-exist new-build) - (with-current-directory coleslaw-conf:*basedir* - (run-program "mv" (mapcar #'namestring (list dir new-build))) - (when (probe-file prev) - (delete-directory-and-files (read-symlink prev))) - (when (probe-file curr) - (update-symlink prev (read-symlink curr))) - (update-symlink curr new-build))))) + (flet ((deploy-path (path &rest args) + (merge-pathnames (apply 'format nil path args) (deploy *config*)))) + (let ((new-build (deploy-path "generated/~a" (get-universal-time))) + (prev (deploy-path ".prev")) + (curr (deploy-path ".curr"))) + (ensure-directories-exist new-build) + (with-current-directory coleslaw-conf:*basedir* + (run-program "mv" (mapcar #'namestring (list dir new-build))) + (when (probe-file prev) + (delete-directory-and-files (read-symlink prev))) + (when (probe-file curr) + (update-symlink prev (read-symlink curr))) + (update-symlink curr new-build)))))) (defun main () "Load the user's config, then compile and deploy the blog."