Bladeren bron

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

Brit Butler 12 jaren geleden
bovenliggende
commit
e12f5edc79
10 gewijzigde bestanden met toevoegingen van 40 en 30 verwijderingen
  1. 1 1
      docs/plugin-api.md
  2. 4 2
      examples/multi-site.coleslawrc
  3. 2 1
      examples/single-site.coleslawrc
  4. 9 5
      plugins/gh-pages.lisp
  5. 2 1
      plugins/s3.lisp
  6. 4 3
      src/coleslaw.lisp
  7. 11 11
      src/config.lisp
  8. 2 1
      src/content.lisp
  9. 4 4
      src/indices.lisp
  10. 1 1
      src/posts.lisp

File diff suppressed because it is too large
+ 1 - 1
docs/plugin-api.md


+ 4 - 2
examples/multi-site.coleslawrc

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

+ 2 - 1
examples/single-site.coleslawrc

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

+ 9 - 5
plugins/gh-pages.lisp

@@ -4,7 +4,11 @@
4 4
 (defpackage :coleslaw-gh-pages
5 5
   (:use :cl)
6 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 12
   (:export #:enable))
9 13
 
10 14
 (in-package :coleslaw-gh-pages)
@@ -13,10 +17,10 @@
13 17
   "The domain CNAME for github to serve pages from.")
14 18
 
15 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 24
                      :direction :output
21 25
                      :if-exists :supersede
22 26
                      :if-does-not-exist :create)

+ 2 - 1
plugins/s3.lisp

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

+ 4 - 3
src/coleslaw.lisp

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

+ 11 - 11
src/config.lisp

@@ -1,17 +1,17 @@
1 1
 (in-package :coleslaw)
2 2
 
3 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 16
 (define-condition unknown-config-section-error (error)
17 17
   ((text :initarg :text :reader text)))

+ 2 - 1
src/content.lisp

@@ -9,7 +9,8 @@
9 9
 
10 10
 (defun make-tag (str)
11 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 15
 (defun tag-slug= (a b)
15 16
   "Test if the slugs for tag A and B are equal."

+ 4 - 4
src/indices.lisp

@@ -18,13 +18,13 @@
18 18
 (defclass int-index (index) ())
19 19
 
20 20
 (defmethod page-path ((object index))
21
-  (rel-path (staging *config*) (index-id object)))
21
+  (rel-path (staging-dir *config*) (index-id object)))
22 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 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 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 29
 (defun all-months ()
30 30
   "Retrieve a list of all months with published content."

+ 1 - 1
src/posts.lisp

@@ -11,7 +11,7 @@
11 11
                                   :next next)))
12 12
 
13 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 16
 (defmethod initialize-instance :after ((object post) &key)
17 17
   (with-accessors ((title post-title)