2013-04-21 12:13:03 -04:00
|
|
|
(eval-when (:compile-toplevel :load-toplevel)
|
|
|
|
(ql:quickload 'puri))
|
|
|
|
|
|
|
|
(defpackage :coleslaw-gh-pages
|
|
|
|
(:use :cl)
|
|
|
|
(:import-from :puri #:parse-uri #:uri-host)
|
2013-04-22 09:27:43 -04:00
|
|
|
(:import-from :coleslaw #:*config*
|
|
|
|
#:deploy
|
|
|
|
#:deploy-dir
|
|
|
|
#:domain
|
|
|
|
#:rel-path)
|
2013-04-21 12:13:03 -04:00
|
|
|
(:export #:enable))
|
|
|
|
|
|
|
|
(in-package :coleslaw-gh-pages)
|
|
|
|
|
|
|
|
(defvar *cname* nil
|
|
|
|
"The domain CNAME for github to serve pages from.")
|
|
|
|
|
|
|
|
(defmethod deploy :after (staging)
|
2013-04-22 09:27:43 -04:00
|
|
|
(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")
|
2013-04-21 12:13:03 -04:00
|
|
|
:direction :output
|
|
|
|
:if-exists :supersede
|
|
|
|
:if-does-not-exist :create)
|
|
|
|
(format out "~A~%" *cname*))))
|
|
|
|
|
|
|
|
(defun enable (&key cname)
|
|
|
|
(typecase cname
|
|
|
|
(string (setf *cname* cname))
|
|
|
|
(t (setf *cname* (uri-host (parse-uri (domain *config*)))))
|
|
|
|
(otherwise (error "Not a valid CNAME: ~A" cname))))
|