Fix gh-pages recursive call by renaming deploy->deploy-dir.

This commit is contained in:
Brit Butler 2013-04-22 09:27:43 -04:00
parent c7b36f65c3
commit e12f5edc79
10 changed files with 40 additions and 30 deletions

View file

@ -19,7 +19,7 @@
* **New markup formats**, for example the [ReStructuredText plugin](http://github.com/redline6561/coleslaw/blob/master/plugins/rst.lisp), can be created by definining an appropriate `render-content` method. The method takes `text` and `format` arguments and is [EQL-specialized](http://www.gigamonkeys.com/book/object-reorientation-generic-functions.html#defmethod) on the format. Format should be a keyword matching the file extension (or pathname-type) of the markup format. (eg. `:rst` for ReStructuredText)
* **New hosting options**, for example the [Amazon S3 plugin](http://github.com/redline6561/coleslaw/blob/master/plugins/s3.lisp), can be created by definining a `deploy :after` method. The method takes a staging directory, likely uninteresting in the `:after` stage. But by importing `*config*` from the coleslaw package and getting its deploy location with `(deploy *config*)` a number of interesting options become possible.
* **New hosting options**, for example the [Amazon S3 plugin](http://github.com/redline6561/coleslaw/blob/master/plugins/s3.lisp), can be created by definining a `deploy :after` method. The method takes a staging directory, likely uninteresting in the `:after` stage. But by importing `*config*` from the coleslaw package and getting its deploy location with `(deploy-dir *config*)` a number of interesting options become possible.
* **New content types**, for example a bookmark-like content type such as ["shouts"](http://paste.lisp.org/display/134453). This has not yet been attempted as a plugin but should be possible without much difficulty.

View file

@ -1,18 +1,20 @@
(("/home/coleslaw/tmp/lisp-is-fun/" . (:author "Ralph Moritz"
:deploy "/home/coleslaw/www/lisp-is-fun/"
:deploy-dir "/home/coleslaw/www/lisp-is-fun/"
:domain "http://blub.co.za"
:feeds ("lisp")
:plugins ((mathjax))
:sitenav ((:url "http://twitter.com/ralph_moeritz" :name "Twitter")
(:url "http://github.com/ralph-moeritz" :name "Code"))
:staging-dir "/tmp/coleslaw"
:title "(lisp :is 'fun)"
:theme "hyde"))
("/home/coleslaw/tmp/musings/" . (:author "Ralph Moritz"
:deploy "/home/coleslaw/www/musings/"
:deploy-dir "/home/coleslaw/www/musings/"
:domain "http://musings.co.za"
:feeds ("opinion")
:plugins ((mathjax))
:sitenav ((:url "http://twitter.com/ralph_moeritz" :name "Twitter")
(:url "http://github.com/ralph-moeritz" :name "Code"))
:staging-dir "/tmp/coleslaw"
:title "Musings"
:theme "hyde")))

View file

@ -1,5 +1,5 @@
(:author "Brit Butler"
:deploy "/home/git/blog/"
:deploy-dir "/home/git/blog/"
:domain "http://blog.redlinernotes.com"
:feeds ("lisp")
:plugins ((mathjax)
@ -11,5 +11,6 @@
(:url "http://github.com/redline6561" :name "Code")
(:url "http://soundcloud.com/redlinernotes" :name "Music")
(:url "http://redlinernotes.com/docs/talks/" :name "Talks"))
:staging-dir "/tmp/coleslaw/"
:title "Improved Means for Achieving Deteriorated Ends"
:theme "hyde")

View file

@ -4,7 +4,11 @@
(defpackage :coleslaw-gh-pages
(:use :cl)
(:import-from :puri #:parse-uri #:uri-host)
(:import-from :coleslaw #:*config* #:deploy #:domain #:rel-path)
(:import-from :coleslaw #:*config*
#:deploy
#:deploy-dir
#:domain
#:rel-path)
(:export #:enable))
(in-package :coleslaw-gh-pages)
@ -13,10 +17,10 @@
"The domain CNAME for github to serve pages from.")
(defmethod deploy :after (staging)
(let ((base (truename (rel-path (deploy *config*) ".curr"))))
(delete-file (rel-path base "index.html"))
(cl-fad:copy-file (rel-path base "1.html") (rel-path base "index.html"))
(with-open-file (out (rel-path base "CNAME")
(let ((blog (truename (rel-path (deploy-dir *config*) ".curr"))))
(delete-file (rel-path blog "index.html"))
(cl-fad:copy-file (rel-path blog "1.html") (rel-path blog "index.html"))
(with-open-file (out (rel-path blog "CNAME")
:direction :output
:if-exists :supersede
:if-does-not-exist :create)

View file

@ -4,6 +4,7 @@
(defpackage :coleslaw-s3
(:use :cl)
(:import-from :coleslaw #:deploy
#:deploy-dir
#:*config*)
(:export #:enable))
@ -45,7 +46,7 @@ and the secret key on the second.")
(cl-fad:walk-directory dir #'upload)))
(defmethod deploy :after (staging)
(let ((blog (deploy *config*)))
(let ((blog (deploy-dir *config*)))
(loop for key across (zs3:all-keys *bucket*)
do (setf (gethash (zs3:etag key) *cache*) key))
(dir->s3 blog)

View file

@ -57,7 +57,7 @@ Additional args to render CONTENT can be passed via RENDER-ARGS."
(defgeneric deploy (staging)
(:documentation "Deploy the STAGING dir, updating the .prev and .curr symlinks.")
(:method (staging)
(let* ((dest (deploy *config*))
(let* ((dest (deploy-dir *config*))
(new-build (rel-path dest "generated/~a" (get-universal-time)))
(prev (rel-path dest ".prev"))
(curr (rel-path dest ".curr")))
@ -75,8 +75,9 @@ compile and deploy the blog."
(load-config config-key)
(load-content)
(compile-theme (theme *config*))
(compile-blog (staging *config*))
(deploy (staging *config*)))
(let ((blog (staging-dir *config*)))
(compile-blog blog)
(deploy blog)))
(defun preview (path &optional (content-type 'post))
"Render the content at PATH under user's configured repo and save it to

View file

@ -1,17 +1,17 @@
(in-package :coleslaw)
(defclass blog ()
((author :initarg :author :initform "" :accessor author)
(deploy :initarg :deploy :initform nil :accessor deploy)
(domain :initarg :domain :initform "" :accessor domain)
(feeds :initarg :feeds :initform nil :accessor feeds)
(license :initarg :license :initform nil :accessor license)
(plugins :initarg :plugins :initform nil :accessor plugins)
(repo :initarg :repo :initform #p"/" :accessor repo)
(sitenav :initarg :sitenav :initform nil :accessor sitenav)
(staging :initarg :staging :initform #p"/tmp/coleslaw/" :accessor staging)
(title :initarg :title :initform "" :accessor title)
(theme :initarg :theme :initform "hyde" :accessor theme)))
((author :initarg :author :accessor author)
(deploy-dir :initarg :deploy-dir :accessor deploy-dir)
(domain :initarg :domain :accessor domain)
(feeds :initarg :feeds :accessor feeds)
(license :initarg :license :accessor license)
(plugins :initarg :plugins :accessor plugins)
(repo :initarg :repo :accessor repo)
(sitenav :initarg :sitenav :accessor sitenav)
(staging-dir :initarg :staging-dir :accessor staging-dir)
(title :initarg :title :accessor title)
(theme :initarg :theme :accessor theme)))
(define-condition unknown-config-section-error (error)
((text :initarg :text :reader text)))

View file

@ -9,7 +9,8 @@
(defun make-tag (str)
"Takes a string and returns a TAG instance with a name and slug."
(make-instance 'tag :name (string-trim " " str) :slug (slugify str)))
(let ((trimmed (string-trim " " str)))
(make-instance 'tag :name trimmed :slug (slugify trimmed))))
(defun tag-slug= (a b)
"Test if the slugs for tag A and B are equal."

View file

@ -18,13 +18,13 @@
(defclass int-index (index) ())
(defmethod page-path ((object index))
(rel-path (staging *config*) (index-id object)))
(rel-path (staging-dir *config*) (index-id object)))
(defmethod page-path ((object tag-index))
(rel-path (staging *config*) "tag/~a" (index-id object)))
(rel-path (staging-dir *config*) "tag/~a" (index-id object)))
(defmethod page-path ((object date-index))
(rel-path (staging *config*) "date/~a" (index-id object)))
(rel-path (staging-dir *config*) "date/~a" (index-id object)))
(defmethod page-path ((object int-index))
(rel-path (staging *config*) "~d" (index-id object)))
(rel-path (staging-dir *config*) "~d" (index-id object)))
(defun all-months ()
"Retrieve a list of all months with published content."

View file

@ -11,7 +11,7 @@
:next next)))
(defmethod page-path ((object post))
(rel-path (staging *config*) "posts/~a" (content-slug object)))
(rel-path (staging-dir *config*) "posts/~a" (content-slug object)))
(defmethod initialize-instance :after ((object post) &key)
(with-accessors ((title post-title)