Handle trailing slashes more gracefully. Kick off 0.9.7-dev.
This commit is contained in:
parent
a6a5b0b86b
commit
762ad5e44d
10 changed files with 28 additions and 16 deletions
6
NEWS.md
6
NEWS.md
|
@ -7,6 +7,12 @@ Legend:
|
||||||
A change to Coleslaw's exported interface. Plugins or Themes that have
|
A change to Coleslaw's exported interface. Plugins or Themes that have
|
||||||
not been upstreamed are effected and may require minor effort to fix.
|
not been upstreamed are effected and may require minor effort to fix.
|
||||||
|
|
||||||
|
## Changes for 0.9.7 (20xx):
|
||||||
|
|
||||||
|
* Coleslaw now handles **deploy-dir**, **repo**, and **staging-dir**
|
||||||
|
config options more gracefully. Previously, various errors could be
|
||||||
|
encountered if directory options lacked a trailing slash.
|
||||||
|
|
||||||
## Changes for 0.9.6 (2014-09-27):
|
## Changes for 0.9.6 (2014-09-27):
|
||||||
|
|
||||||
* **SITE-BREAKING CHANGE**: Coleslaw now defaults to a "basic" deploy
|
* **SITE-BREAKING CHANGE**: Coleslaw now defaults to a "basic" deploy
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(defsystem #:coleslaw
|
(defsystem #:coleslaw
|
||||||
:name "coleslaw"
|
:name "coleslaw"
|
||||||
:description "Flexible Lisp Blogware"
|
:description "Flexible Lisp Blogware"
|
||||||
:version "0.9.6"
|
:version "0.9.7-dev"
|
||||||
:license "BSD"
|
:license "BSD"
|
||||||
:author "Brit Butler <redline6561@gmail.com>"
|
:author "Brit Butler <redline6561@gmail.com>"
|
||||||
:pathname "src/"
|
:pathname "src/"
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
(format nil "~a.post" slug) output))))
|
(format nil "~a.post" slug) output))))
|
||||||
|
|
||||||
(defun export-post (title tags date content path output)
|
(defun export-post (title tags date content path output)
|
||||||
(with-open-file (out (merge-pathnames path (or output (repo *config*)))
|
(with-open-file (out (merge-pathnames path (or output (repo-dir *config*)))
|
||||||
:direction :output
|
:direction :output
|
||||||
:if-exists :supersede
|
:if-exists :supersede
|
||||||
:if-does-not-exist :create
|
:if-does-not-exist :create
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
|
|
||||||
(defun import-posts (filepath output &optional since)
|
(defun import-posts (filepath output &optional since)
|
||||||
(when (probe-file filepath)
|
(when (probe-file filepath)
|
||||||
(ensure-directories-exist (or output (repo *config*)))
|
(ensure-directories-exist (or output (repo-dir *config*)))
|
||||||
(let* ((xml (cxml:parse-file filepath (cxml-dom:make-dom-builder)))
|
(let* ((xml (cxml:parse-file filepath (cxml-dom:make-dom-builder)))
|
||||||
(posts (dom:get-elements-by-tag-name xml "item")))
|
(posts (dom:get-elements-by-tag-name xml "item")))
|
||||||
(loop for post across posts do (import-post post output since))
|
(loop for post across posts do (import-post post output since))
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
(let ((db-file (rel-path (user-homedir-pathname) ".coleslaw.db")))
|
(let ((db-file (rel-path (user-homedir-pathname) ".coleslaw.db")))
|
||||||
(setf coleslaw::*site* (cl-store:restore db-file))
|
(setf coleslaw::*site* (cl-store:restore db-file))
|
||||||
(loop for (status path) in (get-updated-files)
|
(loop for (status path) in (get-updated-files)
|
||||||
for file-path = (rel-path (repo *config*) path)
|
for file-path = (rel-path (repo-dir *config*) path)
|
||||||
do (update-content status file-path))
|
do (update-content status file-path))
|
||||||
(update-content-metadata)
|
(update-content-metadata)
|
||||||
;; Discover's :before method will delete any possibly outdated indexes.
|
;; Discover's :before method will delete any possibly outdated indexes.
|
||||||
|
|
|
@ -24,12 +24,12 @@ in REPO-DIR. Optionally, OLDREV is the revision prior to the last push."
|
||||||
|
|
||||||
(defun compile-blog (staging)
|
(defun compile-blog (staging)
|
||||||
"Compile the blog to a STAGING directory as specified in .coleslawrc."
|
"Compile the blog to a STAGING directory as specified in .coleslawrc."
|
||||||
(ensure-directories-exist (ensure-directory-pathname staging))
|
(ensure-directories-exist staging)
|
||||||
(with-current-directory staging
|
(with-current-directory staging
|
||||||
(dolist (dir (list (app-path "themes/~a/css" (theme *config*))
|
(dolist (dir (list (app-path "themes/~a/css" (theme *config*))
|
||||||
(app-path "themes/~a/img" (theme *config*))
|
(app-path "themes/~a/img" (theme *config*))
|
||||||
(app-path "themes/~a/js" (theme *config*))
|
(app-path "themes/~a/js" (theme *config*))
|
||||||
(merge-pathnames "static" (repo *config*))))
|
(merge-pathnames "static" (repo-dir *config*))))
|
||||||
(when (probe-file dir)
|
(when (probe-file dir)
|
||||||
(run-program "rsync --delete -raz ~a ." dir)))
|
(run-program "rsync --delete -raz ~a ." dir)))
|
||||||
(do-subclasses (ctype content)
|
(do-subclasses (ctype content)
|
||||||
|
@ -54,7 +54,7 @@ in REPO-DIR. Optionally, OLDREV is the revision prior to the last push."
|
||||||
(unless *config*
|
(unless *config*
|
||||||
(load-config (namestring current-working-directory))
|
(load-config (namestring current-working-directory))
|
||||||
(compile-theme (theme *config*)))
|
(compile-theme (theme *config*)))
|
||||||
(let* ((file (rel-path (repo *config*) path))
|
(let* ((file (rel-path (repo-dir *config*) path))
|
||||||
(content (construct content-type (read-content file))))
|
(content (construct content-type (read-content file))))
|
||||||
(write-file "tmp.html" (render-page content)))))
|
(write-file "tmp.html" (render-page content)))))
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
(license :initarg :license :reader license)
|
(license :initarg :license :reader license)
|
||||||
(page-ext :initarg :page-ext :reader page-ext)
|
(page-ext :initarg :page-ext :reader page-ext)
|
||||||
(plugins :initarg :plugins :reader plugins)
|
(plugins :initarg :plugins :reader plugins)
|
||||||
(repo :initarg :repo :accessor repo)
|
(repo :initarg :repo :accessor repo-dir)
|
||||||
(routing :initarg :routing :reader routing)
|
(routing :initarg :routing :reader routing)
|
||||||
(separator :initarg :separator :reader separator)
|
(separator :initarg :separator :reader separator)
|
||||||
(sitenav :initarg :sitenav :reader sitenav)
|
(sitenav :initarg :sitenav :reader sitenav)
|
||||||
|
@ -28,6 +28,14 @@
|
||||||
:separator ";;;;;"
|
:separator ";;;;;"
|
||||||
:staging-dir "/tmp/coleslaw"))
|
:staging-dir "/tmp/coleslaw"))
|
||||||
|
|
||||||
|
(defun dir-slot-reader (config name)
|
||||||
|
"Take CONFIG and NAME, and return a directory pathname for the matching SLOT."
|
||||||
|
(ensure-directory-pathname (slot-value config name)))
|
||||||
|
|
||||||
|
(defmethod deploy-dir ((config blog)) (dir-slot-reader config 'deploy-dir))
|
||||||
|
(defmethod repo-dir ((config blog)) (dir-slot-reader config 'repo))
|
||||||
|
(defmethod staging-dir ((config blog)) (dir-slot-reader config 'staging-dir))
|
||||||
|
|
||||||
(defparameter *config* nil
|
(defparameter *config* nil
|
||||||
"A variable to store the blog configuration and plugin settings.")
|
"A variable to store the blog configuration and plugin settings.")
|
||||||
|
|
||||||
|
@ -71,5 +79,5 @@ preferred over the home directory if provided."
|
||||||
(with-open-file (in (discover-config-path repo-dir) :external-format :utf-8)
|
(with-open-file (in (discover-config-path repo-dir) :external-format :utf-8)
|
||||||
(let ((config-form (read in)))
|
(let ((config-form (read in)))
|
||||||
(setf *config* (construct 'blog config-form)
|
(setf *config* (construct 'blog config-form)
|
||||||
(repo *config*) repo-dir)))
|
(repo-dir *config*) repo-dir)))
|
||||||
(load-plugins (plugins *config*)))
|
(load-plugins (plugins *config*)))
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
(with-open-file (in file :external-format :utf-8)
|
(with-open-file (in file :external-format :utf-8)
|
||||||
(let ((metadata (parse-metadata in))
|
(let ((metadata (parse-metadata in))
|
||||||
(content (slurp-remainder in))
|
(content (slurp-remainder in))
|
||||||
(filepath (enough-namestring file (repo *config*))))
|
(filepath (enough-namestring file (repo-dir *config*))))
|
||||||
(append metadata (list :text content :file filepath))))))
|
(append metadata (list :text content :file filepath))))))
|
||||||
|
|
||||||
;; Helper Functions
|
;; Helper Functions
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
(:documentation "Load all documents of the given DOC-TYPE into memory.")
|
(:documentation "Load all documents of the given DOC-TYPE into memory.")
|
||||||
(:method (doc-type)
|
(:method (doc-type)
|
||||||
(let ((file-type (format nil "~(~A~)" (class-name doc-type))))
|
(let ((file-type (format nil "~(~A~)" (class-name doc-type))))
|
||||||
(do-files (file (repo *config*) file-type)
|
(do-files (file (repo-dir *config*) file-type)
|
||||||
(let ((obj (construct (class-name doc-type) (read-content file))))
|
(let ((obj (construct (class-name doc-type) (read-content file))))
|
||||||
(add-document obj))))))
|
(add-document obj))))))
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
(:import-from :closure-template #:compile-template)
|
(:import-from :closure-template #:compile-template)
|
||||||
(:import-from :local-time #:format-rfc1123-timestring)
|
(:import-from :local-time #:format-rfc1123-timestring)
|
||||||
(:import-from :uiop #:getcwd
|
(:import-from :uiop #:getcwd
|
||||||
#:chdir
|
#:ensure-directory-pathname)
|
||||||
#:ensure-directory-pathname
|
|
||||||
#:directory-exists-p)
|
|
||||||
(:export #:main
|
(:export #:main
|
||||||
#:preview
|
#:preview
|
||||||
#:*config*
|
#:*config*
|
||||||
|
|
|
@ -38,8 +38,8 @@ BODY on files that match the given extension."
|
||||||
(defun (setf getcwd) (path)
|
(defun (setf getcwd) (path)
|
||||||
"Change the operating system's current directory to PATH."
|
"Change the operating system's current directory to PATH."
|
||||||
(setf path (ensure-directory-pathname path))
|
(setf path (ensure-directory-pathname path))
|
||||||
(unless (and (directory-exists-p path)
|
(unless (and (uiop:directory-exists-p path)
|
||||||
(chdir path))
|
(uiop:chdir path))
|
||||||
(error 'directory-does-not-exist :dir path))
|
(error 'directory-does-not-exist :dir path))
|
||||||
path)
|
path)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue