diff --git a/docs/config.md b/docs/config.md index 5814c579..4ed5e8a7 100644 --- a/docs/config.md +++ b/docs/config.md @@ -2,8 +2,8 @@ ## Where -Coleslaw needs a `.coleslawrc` file to operate properly. That file is usually located at -$HOME/.coleslawrc but may also be placed in the blog repo itself. +Coleslaw needs a configuration file to operate properly. It can has any name and +is usally placed in the blog repo itself. ## What diff --git a/src/coleslaw.lisp b/src/coleslaw.lisp index d70d062f..900a03bc 100644 --- a/src/coleslaw.lisp +++ b/src/coleslaw.lisp @@ -3,10 +3,11 @@ (defvar *last-revision* nil "The git revision prior to the last push. For use with GET-UPDATED-FILES.") -(defun main (repo-dir &optional oldrev) +(defun main (&optional (config-file #p"~/.coleslawrc") oldrev) "Load the user's config file, then compile and deploy the blog stored -in REPO-DIR. Optionally, OLDREV is the revision prior to the last push." - (load-config repo-dir) + where the CONF-FILE is stored. Optionally, OLDREV is the revision prior to + the last push." + (load-config config-file) (setf *last-revision* oldrev) (load-content) (compile-theme (theme *config*)) diff --git a/src/config.lisp b/src/config.lisp index 1d55c9c1..f2522cdb 100644 --- a/src/config.lisp +++ b/src/config.lisp @@ -69,19 +69,10 @@ are in the plugins folder in coleslaw's source directory." (destructuring-bind (name &rest args) plugin (enable-plugin name args)))) -(defun discover-config-path (repo-path) - "Check the supplied REPO-PATH for a .coleslawrc and if one -doesn't exist, use the .coleslawrc in the home directory." - (let ((repo-config (rel-path repo-path ".coleslawrc"))) - (if (file-exists-p repo-config) - repo-config - (rel-path (user-homedir-pathname) ".coleslawrc")))) - -(defun load-config (&optional (repo-dir "")) - "Find and load the coleslaw configuration from .coleslawrc. REPO-DIR will be -preferred over the home directory if provided." - (with-open-file (in (discover-config-path repo-dir) :external-format :utf-8) +(defun load-config (config-file) + "Load CONFIG-FILE, the coleslaw configuration file." + (with-open-file (in config-file :external-format :utf-8) (let ((config-form (read in))) (setf *config* (construct 'blog config-form) - (repo-dir *config*) repo-dir))) + (repo-dir *config*) (directory-namestring config-file)))) (load-plugins (plugins *config*)))