diff --git a/README b/README index 32e1e81..90f7d54 100644 --- a/README +++ b/README @@ -20,3 +20,19 @@ References: -- Hakyll -- Hyde +This software should be portable to any conforming Common Lisp implementation but this guide will assume SBCL is installed. Testing has also been done on CCL. +Server side setup: +* Clone or create the git repo for your blog. +* Install Lisp and Quicklisp. +* For now, git clone https://github.com/redline6561/coleslaw.git and add + (push "/path/to/coleslaw/" asdf:*central-registry*) to your lisp's init file. (e.g. ~/.sbclrc for SBCL) + -- You may need to (require 'asdf) in that file first or even create it! (Don't panic.) + This is only temporarily necessary until coleslaw is in quicklisp. +* cp coleslaw/example.coleslawrc ~/.coleslawrc # and edit as necessary for your repo location, etc +* Edit your-blog/.git/hooks/post-receieve and insert: +#!/bin/sh +sbcl --eval "(progn (ql:quickload :coleslaw) (coleslaw:main) (sb-ext:quit))" # or (sb-ext:exit) on SBCL >= 1.0.57 +* chmod +x your-blog/.git/hooks/post-receive +Now whenever you push a new commit to the server, coleslaw will update your blog automatically! +The only thing left to do is point a web server of your choice at the symlink /path/to/coleslaw/.curr + diff --git a/TODO b/TODO index 2e3c782..bc7dd78 100644 --- a/TODO +++ b/TODO @@ -18,8 +18,6 @@ TODO: ; doc themes and plugins ; fix plugins: s3 ;; Incremental compile: only "touched" posts+tags+months. By-20 must be redone, of course. -;; ^^ Long as we're overhauling, maybe come up with a commithook scheme that runs main -;; and main becomes load-config, compile-theme, compile-blog? ;; support old URLs via use of post-aliases? ;;; plugins: analytics, logging/monitoring, crossposting, disqus ;;;; write a proper version of escape considering wild pathnames and valid URL issues diff --git a/example.coleslawrc b/example.coleslawrc index a97bc3f..1ec0757 100644 --- a/example.coleslawrc +++ b/example.coleslawrc @@ -1,6 +1,5 @@ (:author "Brit Butler" - :domain "http://redlinernotes.com" - :interval 600 + :domain "http://blog.redlinernotes.com" :license "CC-BY-SA" :plugins nil :repo "/home/redline/projects/coleslaw/ignore/input/" diff --git a/src/coleslaw.lisp b/src/coleslaw.lisp index 9282205..1724ff7 100644 --- a/src/coleslaw.lisp +++ b/src/coleslaw.lisp @@ -37,8 +37,7 @@ If RAW is non-nil, write the content without wrapping it in the base template." (render-posts) (render-indices) (render-feed)) - (deploy staging) - (setf (last-published) (last-commit)))) + (deploy staging))) (defun update-symlink (path target) "Update the symlink at PATH to point to TARGET." @@ -58,8 +57,7 @@ If RAW is non-nil, write the content without wrapping it in the base template." (update-symlink ".curr" new-build))))) (defun main () + "Load the user's config, then compile and deploy the blog." (load-config) (compile-theme) - (loop do (if (blog-update-p) - (compile-blog) - (sleep (interval *config*))))) + (compile-blog)) diff --git a/src/config.lisp b/src/config.lisp index f54646c..cb3da9d 100644 --- a/src/config.lisp +++ b/src/config.lisp @@ -3,7 +3,6 @@ (defclass blog () ((author :initarg :author :initform "" :accessor author) (domain :initarg :domain :initform "" :accessor domain) - (interval :initarg :interval :initform 600 :accessor interval) (license :initarg :license :initform "CC-BY-SA" :accessor license) (plugins :initarg :plugins :initform '() :accessor plugins) (repo :initarg :repo :initform #p"/" :accessor repo) diff --git a/src/git.lisp b/src/git.lisp deleted file mode 100644 index 1320c92..0000000 --- a/src/git.lisp +++ /dev/null @@ -1,24 +0,0 @@ -(in-package :coleslaw) - -(defun last-commit () - "Retrieve the SHA1 hash of the most recent blog commit." - (multiple-value-bind (pid stdout stderr) - (with-current-directory (repo *config*) - (run-program "git" '("log" "-n 1"))) - (cl-ppcre:scan-to-strings "[0-9a-f]{40}" stdout))) - -(defun last-published () - "Retrieve the SHA1 hash of the most recent published blog." - (with-open-file (in "/home/redline/.coleslaw" :if-does-not-exist :create) - (read-line in nil))) - -(defun (setf last-published) (new-val) - (with-open-file (out "/home/redline/.coleslaw" - :direction :output - :if-exists :supersede - :if-does-not-exist :create) - (write-line new-val out))) - -(defun blog-update-p () - "Returns a non-nil value if the blog needs to be regenerated." - (mismatch (last-commit) (last-published)))