A serverside commithook should kick off the compile.
This commit is contained in:
parent
5df157b368
commit
37d6b3ccd7
6 changed files with 20 additions and 34 deletions
16
README
16
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
|
||||
|
||||
|
|
2
TODO
2
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
|
||||
|
|
|
@ -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/"
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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)
|
||||
|
|
24
src/git.lisp
24
src/git.lisp
|
@ -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)))
|
Loading…
Add table
Reference in a new issue