Sketch of the new design.
This commit is contained in:
parent
011d97b065
commit
c795b1bd59
4 changed files with 47 additions and 27 deletions
|
@ -5,7 +5,7 @@
|
|||
:license "BSD"
|
||||
:author "Brit Butler <redline6561@gmail.com>"
|
||||
:pathname "src/"
|
||||
:depends-on (:closure-template :cl-fad :local-time :alexandria)
|
||||
:depends-on (:closure-template :iolib.os :local-time :alexandria)
|
||||
:serial t
|
||||
:components ((:file "packages")
|
||||
(:file "coleslaw")
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
(in-package :coleslaw)
|
||||
|
||||
(defgeneric start-coleslaw (&rest options)
|
||||
(:documentation "Start the coleslaw server with any specified OPTIONS."))
|
||||
|
||||
(defgeneric stop-coleslaw (&rest options)
|
||||
(:documentation "Stop the coleslaw server with any specified OPTIONS."))
|
||||
|
||||
(defparameter *storage* nil
|
||||
"A db-spec for postmodern or a hash-table cache. It is expected that
|
||||
*storage* has methods for each Generic Function in coleslaw implemented.")
|
||||
|
@ -15,3 +9,20 @@
|
|||
|
||||
(defgeneric set-credentials (name credentials)
|
||||
(:documentation "Store the given CREDENTIALS in *storage* under NAME."))
|
||||
|
||||
(defun load-config ()
|
||||
nil)
|
||||
|
||||
(defun exit-handler ()
|
||||
nil)
|
||||
|
||||
(defun compile-blog ()
|
||||
nil)
|
||||
|
||||
(defun main ()
|
||||
(load-config)
|
||||
(unwind-protect
|
||||
(loop do (if (blog-update-p)
|
||||
(compile-blog)
|
||||
(sleep 600)))
|
||||
(exit-handler)))
|
||||
|
|
29
src/git.lisp
Normal file
29
src/git.lisp
Normal file
|
@ -0,0 +1,29 @@
|
|||
(in-package :coleslaw)
|
||||
|
||||
;; TODO:
|
||||
; Replace hardcoded paths (repo, .deploy) with *config*?
|
||||
; blog-update-p would be thing to make a generic in a plugin.
|
||||
|
||||
(defun last-commit ()
|
||||
"Retrieve the SHA1 hash of the most recent blog commit."
|
||||
(multiple-value-bind (pid stdout stderr)
|
||||
(iolib.os:with-current-directory "/home/redline/projects/coleslaw/"
|
||||
(iolib.os: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)))
|
|
@ -2,8 +2,6 @@
|
|||
(:use :cl :closure-template)
|
||||
(:export ;; coleslaw-core
|
||||
#:*storage*
|
||||
#:start-coleslaw
|
||||
#:stop-coleslaw
|
||||
#:get-credentials
|
||||
#:set-credentials
|
||||
|
||||
|
@ -28,24 +26,6 @@
|
|||
#:post-content
|
||||
#:post-aliases
|
||||
|
||||
;; comments
|
||||
#:make-comment
|
||||
#:add-comment
|
||||
#:remove-comment
|
||||
#:render-comments
|
||||
#:find-comments
|
||||
|
||||
#:author-name
|
||||
#:author-url
|
||||
#:author-ip
|
||||
|
||||
#:comment-id
|
||||
#:comment-post
|
||||
#:comment-author
|
||||
#:comment-timestamp
|
||||
#:comment-content
|
||||
#:comment-parent
|
||||
|
||||
;; indices
|
||||
#:make-index
|
||||
#:add-to-index
|
||||
|
|
Loading…
Add table
Reference in a new issue