From 5992e6ea2859f83bbce1e8a6dd013a28b650643c Mon Sep 17 00:00:00 2001 From: Brit Butler Date: Wed, 22 Aug 2012 00:16:41 -0400 Subject: [PATCH] Minor source reorg. --- coleslaw.asd | 3 ++- src/coleslaw.lisp | 25 ------------------------- src/plugins.lisp | 5 +---- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/coleslaw.asd b/coleslaw.asd index 91971fe..0db7d9f 100644 --- a/coleslaw.asd +++ b/coleslaw.asd @@ -10,8 +10,9 @@ :components ((:file "packages") (:file "config") (:file "git") - (:file "themes") + (:file "util") (:file "plugins") + (:file "themes") (:file "coleslaw") (:file "feeds") (:file "posts") diff --git a/src/coleslaw.lisp b/src/coleslaw.lisp index db31214..9282205 100644 --- a/src/coleslaw.lisp +++ b/src/coleslaw.lisp @@ -1,30 +1,5 @@ (in-package :coleslaw) -(defun app-path (path &rest args) - "Take a relative PATH and return the corresponding pathname beneath coleslaw. -If ARGS is provided, use (apply 'format nil PATH ARGS) as the value of PATH." - (merge-pathnames (apply 'format nil path args) coleslaw-conf:*basedir*)) - -(defun to-pathname (file &optional (parent coleslaw-conf:*basedir*)) - "Convert an iolib file-path back to a pathname." - (merge-pathnames (file-path-namestring file) parent)) - -(defun read-symlink (path) - "A trivial wrapper over iolib.os that returns the pathname in the symlink PATH." - (to-pathname (iolib.os:read-symlink path))) - -(defmacro do-files ((var path &optional extension) &body body) - "For each file under PATH, run BODY. If EXTENSION is provided, only run BODY -on files that match the given extension." - (alexandria:with-gensyms (ext) - `(mapcar (lambda (,var) - ,@(if extension - `((let ((,ext (pathname-type ,var))) - (when (and ,ext (string= ,ext ,extension)) - ,@body))) - `,body)) - (list-directory ,path)))) - (defun render-page (path html &optional raw) "Populate the base template with the provided HTML and write it out to PATH. If RAW is non-nil, write the content without wrapping it in the base template." diff --git a/src/plugins.lisp b/src/plugins.lisp index 06d5c88..52655cf 100644 --- a/src/plugins.lisp +++ b/src/plugins.lisp @@ -5,10 +5,7 @@ resulting pathnames. It is expected that the matching *.lisp files are in the plugins folder in coleslaw's source directory." (let ((files (mapcar (lambda (sym) - (merge-pathnames - (concatenate 'string "plugins/" - (string-downcase (symbol-name sym))) - coleslaw-conf:*basedir*)) + (app-path "plugins/~a" (string-downcase (symbol-name sym)))) plugins))) (map nil (lambda (file) (compile-file file)