Add *updated-files* to track files changed in the last push.

This commit is contained in:
Brit Butler 2014-05-03 17:23:34 -04:00
parent 35afff4ed9
commit 3088b6de8e
5 changed files with 23 additions and 27 deletions

View file

@ -1,7 +1,7 @@
(defsystem #:coleslaw
:name "coleslaw"
:description "Flexible Lisp Blogware"
:version "0.9.4-dev"
:version "0.9.4"
:license "BSD"
:author "Brit Butler <redline6561@gmail.com>"
:pathname "src/"

View file

@ -240,20 +240,6 @@ avoiding work is better than using more workers. Moreover, being
able to determine (and expose) what files just changed enables new
functionality such as plugins that cross-post to tumblr.
Git's post-receive hook is supposed to get a list of refs on $STDIN.
A brave soul could update our post-receive script to iterate over
those lines as shown in step 3 of this [blog post][post_receive_blog].
There would be two primary benefits:
1. We could pass the oldrev (previous revision) of the blog repo
to `coleslaw:main`. That could be used in conjunction with
`get-updated-files` to get a list of the files modified in the
last push. This would enable cross-posting plugins to be developed
as well as opening the door for incremental compilation.
2. More seriously, **Coleslaw** currently deploys for _any_ branch
pushed to the bare repo. This change would also ensure that we only
invoke `coleslaw:main` when a push is made to the master branch.
This is a cool project and the effects are far reaching. Among other
things the existing deployment model would not work as it involves
rebuilding the entire site. In all likelihood we would want to update
@ -264,7 +250,6 @@ would have to be regenerated along with any tag or month indexes
matching the modified files. If incremental compilation is a goal,
simply disabling the indexes may be appropriate for certain users.
[post_receive_blog]: http://codeshal.tumblr.com/post/927943180/git-post-receive-hook-that-submits-code-to-review-board
[post_receive_hook]: https://github.com/redline6561/coleslaw/blob/master/examples/example.post-receive
[closure_template]: https://github.com/archimag/cl-closure-template
[api_docs]: https://github.com/redline6561/coleslaw/blob/master/docs/plugin-api.md

View file

@ -20,15 +20,19 @@ fi
git clone $GIT_REPO $TMP_GIT_CLONE || exit 1
if [ $LISP = sbcl ]; then
while read oldrev newrev refname; do
if [ $refname = "refs/head/master" ]; then
if [ $LISP = sbcl ]; then
sbcl --eval "(ql:quickload 'coleslaw)" \
--eval "(coleslaw:main \"$TMP_GIT_CLONE\")" \
--eval "(coleslaw:main \"$TMP_GIT_CLONE\" \"$oldrev\")" \
--eval "(coleslaw::exit)"
elif [ $LISP = ccl ]; then
echo "(ql:quickload 'coleslaw)(coleslaw:main \"$TMP_GIT_CLONE\")(coleslaw::exit)" | ccl -b
else
elif [ $LISP = ccl ]; then
ccl -e "(ql:quickload 'coleslaw) (coleslaw:main \"$TMP_GIT_CLONE\" \"$oldrev\") (coleslaw::exit)"
else
exit 1
fi
fi
fi
done
rm -rf $TMP_GIT_CLONE
exit

View file

@ -1,7 +1,13 @@
(in-package :coleslaw)
(defun main (&optional (repo-dir ""))
"Load the user's config file, then compile and deploy the site."
(defvar *updated-files* nil
"A plist of (file-status file-name) for files changed on the last git push.")
(defun main (&optional (repo-dir "") oldrev)
"Load the user's config file, then compile and deploy the site. Optionally,
REPO-DIR is the location of the blog repo and OLDREV is the revision prior to
the last push."
(setf *updated-files* oldrev)
(load-config repo-dir)
(load-content)
(compile-theme (theme *config*))

View file

@ -11,6 +11,7 @@
(:export #:main
#:preview
#:*config*
#:*updated-files*
#:content
#:post
#:index