Make deploy location configurable.
This commit is contained in:
parent
37d6b3ccd7
commit
49e1504477
4 changed files with 13 additions and 12 deletions
3
README
3
README
|
@ -28,9 +28,8 @@ Server side setup:
|
||||||
(push "/path/to/coleslaw/" asdf:*central-registry*) to your lisp's init file. (e.g. ~/.sbclrc for SBCL)
|
(push "/path/to/coleslaw/" asdf:*central-registry*) to your lisp's init file. (e.g. ~/.sbclrc for SBCL)
|
||||||
-- You may need to (require 'asdf) in that file first or even create it! (Don't panic.)
|
-- You may need to (require 'asdf) in that file first or even create it! (Don't panic.)
|
||||||
This is only temporarily necessary until coleslaw is in quicklisp.
|
This is only temporarily necessary until coleslaw is in quicklisp.
|
||||||
* cp coleslaw/example.coleslawrc ~/.coleslawrc # and edit as necessary for your repo location, etc
|
* cp coleslaw/example.coleslawrc ~/.coleslawrc # and edit as necessary for your repo location, deploy location, etc
|
||||||
* Edit your-blog/.git/hooks/post-receieve and insert:
|
* Edit your-blog/.git/hooks/post-receieve and insert:
|
||||||
#!/bin/sh
|
|
||||||
sbcl --eval "(progn (ql:quickload :coleslaw) (coleslaw:main) (sb-ext:quit))" # or (sb-ext:exit) on SBCL >= 1.0.57
|
sbcl --eval "(progn (ql:quickload :coleslaw) (coleslaw:main) (sb-ext:quit))" # or (sb-ext:exit) on SBCL >= 1.0.57
|
||||||
* chmod +x your-blog/.git/hooks/post-receive
|
* chmod +x your-blog/.git/hooks/post-receive
|
||||||
Now whenever you push a new commit to the server, coleslaw will update your blog automatically!
|
Now whenever you push a new commit to the server, coleslaw will update your blog automatically!
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
:serial t
|
:serial t
|
||||||
:components ((:file "packages")
|
:components ((:file "packages")
|
||||||
(:file "config")
|
(:file "config")
|
||||||
(:file "git")
|
|
||||||
(:file "util")
|
(:file "util")
|
||||||
(:file "plugins")
|
(:file "plugins")
|
||||||
(:file "themes")
|
(:file "themes")
|
||||||
|
|
|
@ -36,8 +36,7 @@ If RAW is non-nil, write the content without wrapping it in the base template."
|
||||||
(run-program "cp" `("-R" ,(namestring dir) ".")))))
|
(run-program "cp" `("-R" ,(namestring dir) ".")))))
|
||||||
(render-posts)
|
(render-posts)
|
||||||
(render-indices)
|
(render-indices)
|
||||||
(render-feed))
|
(render-feed))))
|
||||||
(deploy staging)))
|
|
||||||
|
|
||||||
(defun update-symlink (path target)
|
(defun update-symlink (path target)
|
||||||
"Update the symlink at PATH to point to TARGET."
|
"Update the symlink at PATH to point to TARGET."
|
||||||
|
@ -46,18 +45,21 @@ If RAW is non-nil, write the content without wrapping it in the base template."
|
||||||
(defgeneric deploy (dir)
|
(defgeneric deploy (dir)
|
||||||
(:documentation "Deploy DIR, updating the .prev and .curr symlinks.")
|
(:documentation "Deploy DIR, updating the .prev and .curr symlinks.")
|
||||||
(:method (dir)
|
(:method (dir)
|
||||||
(let ((new-build (app-path "generated/~a" (get-universal-time))))
|
(let ((new-build (app-path "generated/~a" (get-universal-time)))
|
||||||
|
(prev (merge-pathnames ".prev" (deploy *config*)))
|
||||||
|
(curr (merge-pathnames ".curr" (deploy *config*))))
|
||||||
(ensure-directories-exist new-build)
|
(ensure-directories-exist new-build)
|
||||||
(with-current-directory coleslaw-conf:*basedir*
|
(with-current-directory coleslaw-conf:*basedir*
|
||||||
(run-program "mv" (mapcar #'namestring (list dir new-build)))
|
(run-program "mv" (mapcar #'namestring (list dir new-build)))
|
||||||
(when (probe-file (app-path ".prev"))
|
(when (probe-file prev)
|
||||||
(delete-directory-and-files (read-symlink (app-path ".prev"))))
|
(delete-directory-and-files (read-symlink prev)))
|
||||||
(when (probe-file (app-path ".curr"))
|
(when (probe-file curr)
|
||||||
(update-symlink ".prev" (read-symlink (app-path ".curr"))))
|
(update-symlink prev (read-symlink curr)))
|
||||||
(update-symlink ".curr" new-build)))))
|
(update-symlink curr new-build)))))
|
||||||
|
|
||||||
(defun main ()
|
(defun main ()
|
||||||
"Load the user's config, then compile and deploy the blog."
|
"Load the user's config, then compile and deploy the blog."
|
||||||
(load-config)
|
(load-config)
|
||||||
(compile-theme)
|
(compile-theme)
|
||||||
(compile-blog))
|
(compile-blog)
|
||||||
|
(deploy (staging *config*)))
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
(defclass blog ()
|
(defclass blog ()
|
||||||
((author :initarg :author :initform "" :accessor author)
|
((author :initarg :author :initform "" :accessor author)
|
||||||
|
(deploy :initarg :deploy :initform nil :accessor deploy)
|
||||||
(domain :initarg :domain :initform "" :accessor domain)
|
(domain :initarg :domain :initform "" :accessor domain)
|
||||||
(license :initarg :license :initform "CC-BY-SA" :accessor license)
|
(license :initarg :license :initform "CC-BY-SA" :accessor license)
|
||||||
(plugins :initarg :plugins :initform '() :accessor plugins)
|
(plugins :initarg :plugins :initform '() :accessor plugins)
|
||||||
|
|
Loading…
Add table
Reference in a new issue