Tweak deploy code since post-receive kills $TMP_CLONE_REPO.

This commit is contained in:
Brit Butler 2012-08-25 15:12:38 -04:00
parent 50f084d7c8
commit 0be1db7890
3 changed files with 24 additions and 13 deletions

View file

@ -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")

8
example.post-receive Normal file
View file

@ -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

View file

@ -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."