-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a command line utility to build static site from the cli.
- Loading branch information
1 parent
551e476
commit 7574ac9
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
.*.~undo-tree~ | ||
*.fasl | ||
/example/stage/ | ||
/stage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
#|-*- mode:lisp -*-|# | ||
#| | ||
exec ros -Q -- $0 "$@" | ||
|# | ||
(progn | ||
(ros:ensure-asdf) | ||
#+quicklisp | ||
(ql:quickload '("staticl" | ||
"staticl/main") | ||
:silent t)) | ||
|
||
(in-package #:staticl/main) | ||
|
||
;;; vim: set ft=lisp lisp: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
(uiop:define-package #:staticl/main | ||
(:use #:cl) | ||
(:import-from #:staticl/core | ||
#:stage) | ||
(:import-from #:defmain | ||
#:subcommand | ||
#:defcommand | ||
#:defmain)) | ||
(in-package #:staticl/main) | ||
|
||
|
||
(defvar *verbose* nil) | ||
|
||
|
||
(defmain (main :program-name "staticl") ((verbose "Output more information" | ||
:flag t) | ||
&subcommand) | ||
(let ((*verbose* verbose)) | ||
(defmain:subcommand))) | ||
|
||
|
||
(defcommand (main generate) ((source-dir "A with site's source files." | ||
:default (namestring | ||
(uiop:ensure-directory-pathname | ||
*default-pathname-defaults*))) | ||
(output-dir "An output directory to write HTML files to." | ||
:default (namestring | ||
(uiop:ensure-directory-pathname | ||
(merge-pathnames "stage"))))) | ||
"Generates HTML static site from the source files." | ||
(let ((source-dir (uiop:ensure-directory-pathname | ||
source-dir)) | ||
(output-dir (uiop:ensure-directory-pathname | ||
output-dir))) | ||
(unless (probe-file (merge-pathnames ".staticlrc" | ||
source-dir)) | ||
(format *standard-output* | ||
"Config file .staticlrc is missing from the ~A directory.~%" | ||
(namestring source-dir)) | ||
(uiop:quit 1)) | ||
|
||
(stage :root-dir source-dir | ||
:stage-dir output-dir) | ||
(when *verbose* | ||
(format t "Site was written to: ~A~%" | ||
(namestring output-dir))))) |