From 052e430ed4aa779c8f3615ad028a8268aa63e317 Mon Sep 17 00:00:00 2001 From: Brit Butler Date: Sat, 19 Feb 2011 18:25:02 -0500 Subject: [PATCH] Initial commit of protocol and defsystems. --- .gitignore | 2 ++ README | 1 + TODO | 1 + coleslaw-core.asd | 19 +++++++++++++++++++ coleslaw-dynamic.asd | 12 ++++++++++++ coleslaw-static.asd | 10 ++++++++++ core/coleslaw.lisp | 4 ++++ core/config.lisp | 11 +++++++++++ core/indices.lisp | 17 +++++++++++++++++ core/packages.lisp | 2 ++ core/posts.lisp | 19 +++++++++++++++++++ core/storage.lisp | 19 +++++++++++++++++++ dynamic/admin.lisp | 2 ++ dynamic/comments.lisp | 20 ++++++++++++++++++++ static/comments.lisp | 3 +++ 15 files changed, 142 insertions(+) create mode 100644 .gitignore create mode 100644 README create mode 100644 TODO create mode 100644 coleslaw-core.asd create mode 100644 coleslaw-dynamic.asd create mode 100644 coleslaw-static.asd create mode 100644 core/coleslaw.lisp create mode 100644 core/config.lisp create mode 100644 core/indices.lisp create mode 100644 core/packages.lisp create mode 100644 core/posts.lisp create mode 100644 core/storage.lisp create mode 100644 dynamic/admin.lisp create mode 100644 dynamic/comments.lisp create mode 100644 static/comments.lisp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3d894d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ +*.fasl diff --git a/README b/README new file mode 100644 index 0000000..0e5f75a --- /dev/null +++ b/README @@ -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. diff --git a/TODO b/TODO new file mode 100644 index 0000000..fe67489 --- /dev/null +++ b/TODO @@ -0,0 +1 @@ +Everything. diff --git a/coleslaw-core.asd b/coleslaw-core.asd new file mode 100644 index 0000000..de8bb1c --- /dev/null +++ b/coleslaw-core.asd @@ -0,0 +1,19 @@ +(defsystem :coleslaw-core + :name "coleslaw-core" + :description "Flexible Lisp Blogware, Core utilities" + :version "0.0.1" + :maintainer "Brit Butler " + :author "Brit Butler " + :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")))))) diff --git a/coleslaw-dynamic.asd b/coleslaw-dynamic.asd new file mode 100644 index 0000000..e850055 --- /dev/null +++ b/coleslaw-dynamic.asd @@ -0,0 +1,12 @@ +(defsystem :coleslaw-dynamic + :name "coleslaw-dynamic" + :description "Flexible Lisp Blogware, Dynamic+PostgreSQL edition" + :version "0.0.1" + :maintainer "Brit Butler " + :author "Brit Butler " + :licence "LLGPL" + :depends-on (:coleslaw-core :postmodern :restas) + :components ((:module dynamic + :components ((:file "comments") + (:file "admin" + :depends-on ("comments")))))) diff --git a/coleslaw-static.asd b/coleslaw-static.asd new file mode 100644 index 0000000..6974946 --- /dev/null +++ b/coleslaw-static.asd @@ -0,0 +1,10 @@ +(defsystem :coleslaw-static + :name "coleslaw-static" + :description "Flexible Lisp Blogware, Static+S3 edition" + :version "0.0.1" + :maintainer "Brit Butler " + :author "Brit Butler " + :licence "LLGPL" + :depends-on (:coleslaw-core :zs3 :trivial-timers) + :components ((:module static + :components ((:file "comments"))))) diff --git a/core/coleslaw.lisp b/core/coleslaw.lisp new file mode 100644 index 0000000..1979084 --- /dev/null +++ b/core/coleslaw.lisp @@ -0,0 +1,4 @@ +(in-package :coleslaw) + +(defgeneric start-coleslaw (&rest options) + (:documentation "Start the coleslaw server with any specified OPTIONS.")) diff --git a/core/config.lisp b/core/config.lisp new file mode 100644 index 0000000..8ca6c20 --- /dev/null +++ b/core/config.lisp @@ -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.")) diff --git a/core/indices.lisp b/core/indices.lisp new file mode 100644 index 0000000..5da7b52 --- /dev/null +++ b/core/indices.lisp @@ -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.")) diff --git a/core/packages.lisp b/core/packages.lisp new file mode 100644 index 0000000..6d5862a --- /dev/null +++ b/core/packages.lisp @@ -0,0 +1,2 @@ +(defpackage :coleslaw + (:use :cl :closure-template :local-time)) diff --git a/core/posts.lisp b/core/posts.lisp new file mode 100644 index 0000000..980415e --- /dev/null +++ b/core/posts.lisp @@ -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.")) diff --git a/core/storage.lisp b/core/storage.lisp new file mode 100644 index 0000000..a561784 --- /dev/null +++ b/core/storage.lisp @@ -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.")) diff --git a/dynamic/admin.lisp b/dynamic/admin.lisp new file mode 100644 index 0000000..fb7f3d6 --- /dev/null +++ b/dynamic/admin.lisp @@ -0,0 +1,2 @@ +(in-package :coleslaw) + diff --git a/dynamic/comments.lisp b/dynamic/comments.lisp new file mode 100644 index 0000000..ef96fc2 --- /dev/null +++ b/dynamic/comments.lisp @@ -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)) diff --git a/static/comments.lisp b/static/comments.lisp new file mode 100644 index 0000000..79bd31e --- /dev/null +++ b/static/comments.lisp @@ -0,0 +1,3 @@ +(in-package :coleslaw) + +;; disqus integration?