Kaynağa Gözat

Initial commit of protocol and defsystems.

Brit Butler 14 yıl önce
işleme
052e430ed4

+ 2 - 0
.gitignore

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

+ 1 - 0
README

@@ -0,0 +1 @@
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 - 0
TODO

@@ -0,0 +1 @@
1
+Everything.

+ 19 - 0
coleslaw-core.asd

@@ -0,0 +1,19 @@
1
+(defsystem :coleslaw-core
2
+  :name "coleslaw-core"
3
+  :description "Flexible Lisp Blogware, Core utilities"
4
+  :version "0.0.1"
5
+  :maintainer "Brit Butler <redline6561@gmail.com>"
6
+  :author "Brit Butler <redline6561@gmail.com>"
7
+  :licence "LLGPL"
8
+  :depends-on (:cl-markdown :docutils :closure-template
9
+               :external-program :local-time) ; parenscript?
10
+  :components ((:module core
11
+                        :components ((:file "packages")
12
+                                     (:file "coleslaw"
13
+                                            :depends-on ("packages"))
14
+                                     (:file "storage"
15
+                                            :depends-on ("coleslaw"))
16
+                                     (:file "posts"
17
+                                            :depends-on ("storage"))
18
+                                     (:file "indices"
19
+                                            :depends-on ("posts"))))))

+ 12 - 0
coleslaw-dynamic.asd

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

+ 10 - 0
coleslaw-static.asd

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

+ 4 - 0
core/coleslaw.lisp

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

+ 11 - 0
core/config.lisp

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

+ 17 - 0
core/indices.lisp

@@ -0,0 +1,17 @@
1
+(in-package :coleslaw)
2
+
3
+(defgeneric create-index (name ids dates urls)
4
+  (:documentation "Create an index in *storage* with the given NAME, post IDs,
5
+post DATEs and post URLs."))
6
+
7
+(defgeneric get-index (name)
8
+  (:documentation "Retrieve the index matching NAME from *storage*."))
9
+
10
+(defgeneric add-to-index (index post)
11
+  (:documentation "Add the given POST to INDEX."))
12
+
13
+(defgeneric remove-from-index (index post)
14
+  (:documentation "Remove the given POST from INDEX."))
15
+
16
+(defgeneric render-index (index)
17
+  (:documentation "Generate the final HTML for INDEX."))

+ 2 - 0
core/packages.lisp

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

+ 19 - 0
core/posts.lisp

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

+ 19 - 0
core/storage.lisp

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

+ 2 - 0
dynamic/admin.lisp

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

+ 20 - 0
dynamic/comments.lisp

@@ -0,0 +1,20 @@
1
+(in-package :coleslaw)
2
+
3
+(defclass comment ()
4
+  ((id :initarg :id
5
+       :accessor id)
6
+   (post-id :initarg :post-id
7
+            :accessor post-id)
8
+   (author-ip :initarg :author-ip
9
+              :accessor author-ip)
10
+   (author-name :initarg :author-name
11
+                :accessor author-name)
12
+   (author-url :initarg :author-url
13
+               :accessor author-url)
14
+   (timestamp :initarg :timestamp
15
+              :accessor timestamp)
16
+   (content :initarg :content
17
+            :accessor content)
18
+   (parent :initarg :parent
19
+           :accessor parent))
20
+  (:metaclass dao-class))

+ 3 - 0
static/comments.lisp

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