Initial commit of protocol and defsystems.

This commit is contained in:
Brit Butler 2011-02-19 18:25:02 -05:00
commit 052e430ed4
15 changed files with 142 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*~
*.fasl

1
README Normal file
View file

@ -0,0 +1 @@
Coleslaw aims to be flexible blog software suitable for replacing a single-user wordpress install or jekyll. The primary difference is that the coleslaw-dynamic backend uses PostgreSQL and RESTAS to generate and serve the site while the coleslaw-static backend compiles a static site to be served by Amazon S3.

1
TODO Normal file
View file

@ -0,0 +1 @@
Everything.

19
coleslaw-core.asd Normal file
View file

@ -0,0 +1,19 @@
(defsystem :coleslaw-core
:name "coleslaw-core"
:description "Flexible Lisp Blogware, Core utilities"
:version "0.0.1"
:maintainer "Brit Butler <redline6561@gmail.com>"
:author "Brit Butler <redline6561@gmail.com>"
:licence "LLGPL"
:depends-on (:cl-markdown :docutils :closure-template
:external-program :local-time) ; parenscript?
:components ((:module core
:components ((:file "packages")
(:file "coleslaw"
:depends-on ("packages"))
(:file "storage"
:depends-on ("coleslaw"))
(:file "posts"
:depends-on ("storage"))
(:file "indices"
:depends-on ("posts"))))))

12
coleslaw-dynamic.asd Normal file
View file

@ -0,0 +1,12 @@
(defsystem :coleslaw-dynamic
:name "coleslaw-dynamic"
:description "Flexible Lisp Blogware, Dynamic+PostgreSQL edition"
:version "0.0.1"
:maintainer "Brit Butler <redline6561@gmail.com>"
:author "Brit Butler <redline6561@gmail.com>"
:licence "LLGPL"
:depends-on (:coleslaw-core :postmodern :restas)
:components ((:module dynamic
:components ((:file "comments")
(:file "admin"
:depends-on ("comments"))))))

10
coleslaw-static.asd Normal file
View file

@ -0,0 +1,10 @@
(defsystem :coleslaw-static
:name "coleslaw-static"
:description "Flexible Lisp Blogware, Static+S3 edition"
:version "0.0.1"
:maintainer "Brit Butler <redline6561@gmail.com>"
:author "Brit Butler <redline6561@gmail.com>"
:licence "LLGPL"
:depends-on (:coleslaw-core :zs3 :trivial-timers)
:components ((:module static
:components ((:file "comments")))))

4
core/coleslaw.lisp Normal file
View file

@ -0,0 +1,4 @@
(in-package :coleslaw)
(defgeneric start-coleslaw (&rest options)
(:documentation "Start the coleslaw server with any specified OPTIONS."))

11
core/config.lisp Normal file
View file

@ -0,0 +1,11 @@
(in-package :coleslaw)
(defparameter *credentials* nil
"A map of names to credentials, potentially an alist. Names should be
keywords or symbols, credentials should be dotted pairs.")
(defgeneric get-credentials (name)
(:documentation "Retrieve the credentials keyed by NAME from *credentials*."))
(defgeneric set-credentials (name credentials)
(:documentation "Store the given CREDENTIALS in *credentials* under NAME."))

17
core/indices.lisp Normal file
View file

@ -0,0 +1,17 @@
(in-package :coleslaw)
(defgeneric create-index (name ids dates urls)
(:documentation "Create an index in *storage* with the given NAME, post IDs,
post DATEs and post URLs."))
(defgeneric get-index (name)
(:documentation "Retrieve the index matching NAME from *storage*."))
(defgeneric add-to-index (index post)
(:documentation "Add the given POST to INDEX."))
(defgeneric remove-from-index (index post)
(:documentation "Remove the given POST from INDEX."))
(defgeneric render-index (index)
(:documentation "Generate the final HTML for INDEX."))

2
core/packages.lisp Normal file
View file

@ -0,0 +1,2 @@
(defpackage :coleslaw
(:use :cl :closure-template :local-time))

19
core/posts.lisp Normal file
View file

@ -0,0 +1,19 @@
(in-package :coleslaw)
(defgeneric add-post (id title timestamp permalink tags
content &key &allow-other-keys)
(:documentation "Create a post with the given ID, TITLE, TIMESTAMP,
PERMALINK, TAGS and CONTENT and add it to *storage*."))
(defgeneric prettify-code (post)
(:documentation "Ensure that any escaped code in POST is prettified."))
(defgeneric prettify-math-p (post)
(:documentation "Returns T if post needs MathJAX loaded, NIL otherwise."))
(defgeneric render-post (post)
(:documentation "Generate the final HTML for POST."))
(defgeneric remove-post (post)
(:documentation "Remove POST from *storage* and, if necessary,
update the running site."))

19
core/storage.lisp Normal file
View file

@ -0,0 +1,19 @@
(in-package :coleslaw)
(defparameter *storage* nil
"A db-spec for postmodern or a hash-table cache of metadata.
It is expected that *storage* has methods for each Generic Function
in coleslaw-core implemented.")
(defgeneric find-by-id (id)
(:documentation "Retrieve a POST object from *storage* matching ID."))
(defgeneric find-by-tag (tag)
(:documentation "Retrieve all POST objects from *storage* tagged with TAG."))
(defgeneric find-by-date (date)
(:documentation "Retrieve all POST objects from *storage* matching DATE."))
(defgeneric find-by-range (start end)
(:documentation "Retrieve all POST objects from *storage* with ids between
START and END."))

2
dynamic/admin.lisp Normal file
View file

@ -0,0 +1,2 @@
(in-package :coleslaw)

20
dynamic/comments.lisp Normal file
View file

@ -0,0 +1,20 @@
(in-package :coleslaw)
(defclass comment ()
((id :initarg :id
:accessor id)
(post-id :initarg :post-id
:accessor post-id)
(author-ip :initarg :author-ip
:accessor author-ip)
(author-name :initarg :author-name
:accessor author-name)
(author-url :initarg :author-url
:accessor author-url)
(timestamp :initarg :timestamp
:accessor timestamp)
(content :initarg :content
:accessor content)
(parent :initarg :parent
:accessor parent))
(:metaclass dao-class))

3
static/comments.lisp Normal file
View file

@ -0,0 +1,3 @@
(in-package :coleslaw)
;; disqus integration?