Explorar el Código

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

Brit Butler hace 12 años
padre
commit
e12f5edc79

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 1 - 1
docs/plugin-api.md


+ 4 - 2
examples/multi-site.coleslawrc

1
 (("/home/coleslaw/tmp/lisp-is-fun/" . (:author "Ralph Moritz"
1
 (("/home/coleslaw/tmp/lisp-is-fun/" . (:author "Ralph Moritz"
2
-                                      :deploy "/home/coleslaw/www/lisp-is-fun/"
2
+                                      :deploy-dir "/home/coleslaw/www/lisp-is-fun/"
3
                                       :domain "http://blub.co.za"
3
                                       :domain "http://blub.co.za"
4
                                       :feeds ("lisp")
4
                                       :feeds ("lisp")
5
                                       :plugins ((mathjax))
5
                                       :plugins ((mathjax))
6
                                       :sitenav ((:url "http://twitter.com/ralph_moeritz" :name "Twitter")
6
                                       :sitenav ((:url "http://twitter.com/ralph_moeritz" :name "Twitter")
7
                                                 (:url "http://github.com/ralph-moeritz" :name "Code"))
7
                                                 (:url "http://github.com/ralph-moeritz" :name "Code"))
8
+                                      :staging-dir "/tmp/coleslaw"
8
                                       :title "(lisp :is 'fun)"
9
                                       :title "(lisp :is 'fun)"
9
                                       :theme "hyde"))
10
                                       :theme "hyde"))
10
  ("/home/coleslaw/tmp/musings/" . (:author "Ralph Moritz"
11
  ("/home/coleslaw/tmp/musings/" . (:author "Ralph Moritz"
11
-                                  :deploy "/home/coleslaw/www/musings/"
12
+                                  :deploy-dir "/home/coleslaw/www/musings/"
12
                                   :domain "http://musings.co.za"
13
                                   :domain "http://musings.co.za"
13
                                   :feeds ("opinion")
14
                                   :feeds ("opinion")
14
                                   :plugins ((mathjax))
15
                                   :plugins ((mathjax))
15
                                   :sitenav ((:url "http://twitter.com/ralph_moeritz" :name "Twitter")
16
                                   :sitenav ((:url "http://twitter.com/ralph_moeritz" :name "Twitter")
16
                                             (:url "http://github.com/ralph-moeritz" :name "Code"))
17
                                             (:url "http://github.com/ralph-moeritz" :name "Code"))
18
+                                  :staging-dir "/tmp/coleslaw"
17
                                   :title "Musings"
19
                                   :title "Musings"
18
                                   :theme "hyde")))
20
                                   :theme "hyde")))

+ 2 - 1
examples/single-site.coleslawrc

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

+ 9 - 5
plugins/gh-pages.lisp

4
 (defpackage :coleslaw-gh-pages
4
 (defpackage :coleslaw-gh-pages
5
   (:use :cl)
5
   (:use :cl)
6
   (:import-from :puri #:parse-uri #:uri-host)
6
   (:import-from :puri #:parse-uri #:uri-host)
7
-  (:import-from :coleslaw #:*config* #:deploy #:domain #:rel-path)
7
+  (:import-from :coleslaw #:*config*
8
+                          #:deploy
9
+                          #:deploy-dir
10
+                          #:domain
11
+                          #:rel-path)
8
   (:export #:enable))
12
   (:export #:enable))
9
 
13
 
10
 (in-package :coleslaw-gh-pages)
14
 (in-package :coleslaw-gh-pages)
13
   "The domain CNAME for github to serve pages from.")
17
   "The domain CNAME for github to serve pages from.")
14
 
18
 
15
 (defmethod deploy :after (staging)
19
 (defmethod deploy :after (staging)
16
-  (let ((base (truename (rel-path (deploy *config*) ".curr"))))
17
-    (delete-file (rel-path base "index.html"))
18
-    (cl-fad:copy-file (rel-path base "1.html") (rel-path base "index.html"))
19
-    (with-open-file (out (rel-path base "CNAME")
20
+  (let ((blog (truename (rel-path (deploy-dir *config*) ".curr"))))
21
+    (delete-file (rel-path blog "index.html"))
22
+    (cl-fad:copy-file (rel-path blog "1.html") (rel-path blog "index.html"))
23
+    (with-open-file (out (rel-path blog "CNAME")
20
                      :direction :output
24
                      :direction :output
21
                      :if-exists :supersede
25
                      :if-exists :supersede
22
                      :if-does-not-exist :create)
26
                      :if-does-not-exist :create)

+ 2 - 1
plugins/s3.lisp

4
 (defpackage :coleslaw-s3
4
 (defpackage :coleslaw-s3
5
   (:use :cl)
5
   (:use :cl)
6
   (:import-from :coleslaw #:deploy
6
   (:import-from :coleslaw #:deploy
7
+                          #:deploy-dir
7
                           #:*config*)
8
                           #:*config*)
8
   (:export #:enable))
9
   (:export #:enable))
9
 
10
 
45
     (cl-fad:walk-directory dir #'upload)))
46
     (cl-fad:walk-directory dir #'upload)))
46
 
47
 
47
 (defmethod deploy :after (staging)
48
 (defmethod deploy :after (staging)
48
-  (let ((blog (deploy *config*)))
49
+  (let ((blog (deploy-dir *config*)))
49
     (loop for key across (zs3:all-keys *bucket*)
50
     (loop for key across (zs3:all-keys *bucket*)
50
        do (setf (gethash (zs3:etag key) *cache*) key))
51
        do (setf (gethash (zs3:etag key) *cache*) key))
51
     (dir->s3 blog)
52
     (dir->s3 blog)

+ 4 - 3
src/coleslaw.lisp

57
 (defgeneric deploy (staging)
57
 (defgeneric deploy (staging)
58
   (:documentation "Deploy the STAGING dir, updating the .prev and .curr symlinks.")
58
   (:documentation "Deploy the STAGING dir, updating the .prev and .curr symlinks.")
59
   (:method (staging)
59
   (:method (staging)
60
-    (let* ((dest (deploy *config*))
60
+    (let* ((dest (deploy-dir *config*))
61
            (new-build (rel-path dest "generated/~a" (get-universal-time)))
61
            (new-build (rel-path dest "generated/~a" (get-universal-time)))
62
            (prev (rel-path dest ".prev"))
62
            (prev (rel-path dest ".prev"))
63
            (curr (rel-path dest ".curr")))
63
            (curr (rel-path dest ".curr")))
75
   (load-config config-key)
75
   (load-config config-key)
76
   (load-content)
76
   (load-content)
77
   (compile-theme (theme *config*))
77
   (compile-theme (theme *config*))
78
-  (compile-blog (staging *config*))
79
-  (deploy (staging *config*)))
78
+  (let ((blog (staging-dir *config*)))
79
+    (compile-blog blog)
80
+    (deploy blog)))
80
 
81
 
81
 (defun preview (path &optional (content-type 'post))
82
 (defun preview (path &optional (content-type 'post))
82
   "Render the content at PATH under user's configured repo and save it to
83
   "Render the content at PATH under user's configured repo and save it to

+ 11 - 11
src/config.lisp

1
 (in-package :coleslaw)
1
 (in-package :coleslaw)
2
 
2
 
3
 (defclass blog ()
3
 (defclass blog ()
4
-  ((author :initarg :author :initform "" :accessor author)
5
-   (deploy :initarg :deploy :initform nil :accessor deploy)
6
-   (domain :initarg :domain :initform "" :accessor domain)
7
-   (feeds :initarg :feeds :initform nil :accessor feeds)
8
-   (license :initarg :license :initform nil :accessor license)
9
-   (plugins :initarg :plugins :initform nil :accessor plugins)
10
-   (repo :initarg :repo :initform #p"/" :accessor repo)
11
-   (sitenav :initarg :sitenav :initform nil :accessor sitenav)
12
-   (staging :initarg :staging :initform #p"/tmp/coleslaw/" :accessor staging)
13
-   (title :initarg :title :initform "" :accessor title)
14
-   (theme :initarg :theme :initform "hyde" :accessor theme)))
4
+  ((author      :initarg :author      :accessor author)
5
+   (deploy-dir  :initarg :deploy-dir  :accessor deploy-dir)
6
+   (domain      :initarg :domain      :accessor domain)
7
+   (feeds       :initarg :feeds       :accessor feeds)
8
+   (license     :initarg :license     :accessor license)
9
+   (plugins     :initarg :plugins     :accessor plugins)
10
+   (repo        :initarg :repo        :accessor repo)
11
+   (sitenav     :initarg :sitenav     :accessor sitenav)
12
+   (staging-dir :initarg :staging-dir :accessor staging-dir)
13
+   (title       :initarg :title       :accessor title)
14
+   (theme       :initarg :theme       :accessor theme)))
15
 
15
 
16
 (define-condition unknown-config-section-error (error)
16
 (define-condition unknown-config-section-error (error)
17
   ((text :initarg :text :reader text)))
17
   ((text :initarg :text :reader text)))

+ 2 - 1
src/content.lisp

9
 
9
 
10
 (defun make-tag (str)
10
 (defun make-tag (str)
11
   "Takes a string and returns a TAG instance with a name and slug."
11
   "Takes a string and returns a TAG instance with a name and slug."
12
-  (make-instance 'tag :name (string-trim " " str) :slug (slugify str)))
12
+  (let ((trimmed (string-trim " " str)))
13
+    (make-instance 'tag :name trimmed :slug (slugify trimmed))))
13
 
14
 
14
 (defun tag-slug= (a b)
15
 (defun tag-slug= (a b)
15
   "Test if the slugs for tag A and B are equal."
16
   "Test if the slugs for tag A and B are equal."

+ 4 - 4
src/indices.lisp

18
 (defclass int-index (index) ())
18
 (defclass int-index (index) ())
19
 
19
 
20
 (defmethod page-path ((object index))
20
 (defmethod page-path ((object index))
21
-  (rel-path (staging *config*) (index-id object)))
21
+  (rel-path (staging-dir *config*) (index-id object)))
22
 (defmethod page-path ((object tag-index))
22
 (defmethod page-path ((object tag-index))
23
-  (rel-path (staging *config*) "tag/~a" (index-id object)))
23
+  (rel-path (staging-dir *config*) "tag/~a" (index-id object)))
24
 (defmethod page-path ((object date-index))
24
 (defmethod page-path ((object date-index))
25
-  (rel-path (staging *config*) "date/~a" (index-id object)))
25
+  (rel-path (staging-dir *config*) "date/~a" (index-id object)))
26
 (defmethod page-path ((object int-index))
26
 (defmethod page-path ((object int-index))
27
-  (rel-path (staging *config*) "~d" (index-id object)))
27
+  (rel-path (staging-dir *config*) "~d" (index-id object)))
28
 
28
 
29
 (defun all-months ()
29
 (defun all-months ()
30
   "Retrieve a list of all months with published content."
30
   "Retrieve a list of all months with published content."

+ 1 - 1
src/posts.lisp

11
                                   :next next)))
11
                                   :next next)))
12
 
12
 
13
 (defmethod page-path ((object post))
13
 (defmethod page-path ((object post))
14
-  (rel-path (staging *config*) "posts/~a" (content-slug object)))
14
+  (rel-path (staging-dir *config*) "posts/~a" (content-slug object)))
15
 
15
 
16
 (defmethod initialize-instance :after ((object post) &key)
16
 (defmethod initialize-instance :after ((object post) &key)
17
   (with-accessors ((title post-title)
17
   (with-accessors ((title post-title)