coleslaw/cli/launch/rebuild.lisp
Javier Olaechea 6ab3081beb Preliminary CLI work
* src/cli.lisp: utility functions for CLI processing.
  * cli/launch/build.lisp: Builds the blog/site
  * cli/launch/clean.lisp: Deletes the staging and deploy dir
  * cli/launch/rebuild.lisp: Same as clean and build.
  * cli/launch/serve.lisp: Doesn't work.
  * src/config.lisp: load-config now takes the path to the config file
    as an argument instead of trying to discover it itself.
2015-06-23 19:03:17 -05:00

18 lines
847 B
Common Lisp
Executable file

#!/usr/bin/cl -Q -sp coleslaw --entry rebuild
(defun rebuild (argv)
(let* ((parameters (coleslaw-cli:process-parameters argv))
(current-dir (uiop/os:getcwd))
(repo-dir (or (cdr (assoc :repo-dir parameters))
current-dir))
(config-file (or (cdr (assoc :config parameters))
(discover-config-path current-dir)))
(old-rev (inferior-shell:run/s
"git log --oneline -1 | awk -e '{print $1}'")))
(load-config config-file repo-dir)
(dolist (dir (list (staging-dir *config*)
(deploy-dir *config*)))
(uiop/filesystem:delete-directory-tree (pathname dir)
:if-does-not-exist :ignore
:validate t))
(main repo-dir old-rev)))