From 490fd1991afbe98a37cdc18db049d71f7c0a617e Mon Sep 17 00:00:00 2001 From: Dave Cooper Date: Fri, 19 Oct 2018 19:33:20 -0400 Subject: [PATCH] Separated the test server out from the main make command --- Makefile | 2 +- README.md | 35 ++++++++++++----------------------- build.lisp | 8 +------- cl-site-test-serve.asd | 16 ++++++++++++++++ cl-site.asd | 5 ++--- test-serve.lisp | 20 ++++++++++++++++++++ 6 files changed, 52 insertions(+), 34 deletions(-) create mode 100644 cl-site-test-serve.asd create mode 100644 test-serve.lisp diff --git a/Makefile b/Makefile index d4be629..5ffe37a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ all: build serve: static favicon - sbcl --load build.lisp + sbcl --load test-serve.lisp static: mkdir -p output/static diff --git a/README.md b/README.md index 3638eb9..8771aa7 100644 --- a/README.md +++ b/README.md @@ -50,9 +50,7 @@ in `layout/static/` takes precedence. ## Execution -### From command line - -Using Make. +### From command line, using make: The Makefile contains various useful commands. @@ -64,42 +62,33 @@ Among them: * `make pyserve` - to run a secondary (python) server on port 8000 (crashes if 8000 is busy). - ### From Lisp (The following assumes you have a reasonably recent Quicklisp loaded) -* Either (in one fell swoop): +* To generate the static pages: (load ".../cl-site/build.lisp") ;; replace with your actual path to cl-site/ - This will also start serving the site on port 8008 (or subsequent port - numbers, if 8008 is busy). So you can visit the site to test it at: - - `http://localhost:8008` - + This will load the site-generating code and generate the static pages into `output/` -* Or (step by step): - First, make sure your `cl-site/` directory (the directory containing - this file) is pushed onto `ql:*local-project-directories*` or you - have this directory moved or linked under your - `quicklisp/local-projects/` directory (see `build.lisp` for example - of how to push onto `ql:*local-project-directories*`). +* To generate the static pages and start the test server: - Then, load the system with this command: + (load ".../cl-site/test-serve.lisp") ;; replace with your actual path to cl-site/ - (ql:quickload :cl-site) + This will start serving the site on port 8008 (or subsequent port + numbers, if 8008 is busy). - To generate the site: +### Known Problems - (cl-site:make-site) + The test server crashes on load with `invalid number of arguments` on + certain 1.3.1 releases of SBCL (apparently a problem with the + `ironclad` library from quicklisp with this sbcl version). If you get + this error, try upgrading your SBCL or use CCL. - The output files will be generated in the `output/` directory. - To clean any old files from output/ directory: - (cl-site:make-clean) diff --git a/build.lisp b/build.lisp index 7241b5e..55272ad 100644 --- a/build.lisp +++ b/build.lisp @@ -8,12 +8,6 @@ (ql:quickload :cl-site) -(cl-site::make-site) +(cl-site:make-site) -;; -;; Start aserve, publish site directory & pages, set default package. -;; -(cl-site:start-aserve) -(cl-site:publish-cl-site) -(setq *package* (find-package :cl-site)) diff --git a/cl-site-test-serve.asd b/cl-site-test-serve.asd new file mode 100644 index 0000000..43f8055 --- /dev/null +++ b/cl-site-test-serve.asd @@ -0,0 +1,16 @@ +;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- +(in-package :cl-user) + +(asdf:defsystem cl-site-test-serve + :name "cl-site-test-serve" + :version "0.0.1" + :maintainer "Common-Lisp.Net maintainers" + :author "Dave Cooper & Common-Lisp.Net maintainers" + :licence "TBD" + :description "Test server for common-lisp.net, written in CL" + :depends-on (:cl-site :aserve) + :components ((:module source + :pathname "" + :serial t + :components ((:file "publish"))))) + diff --git a/cl-site.asd b/cl-site.asd index b832111..5837e9c 100644 --- a/cl-site.asd +++ b/cl-site.asd @@ -8,7 +8,7 @@ :author "C. Yang & Common-Lisp.Net maintainers" :licence "TBD" :description "Static site generator for common-lisp.net, written in CL" - :depends-on (:cl-mustache :plump :markdown.cl :closer-mop :cl-who :cl-yaml :aserve) + :depends-on (:cl-mustache :plump :markdown.cl :closer-mop :cl-who :cl-yaml) :components ((:module source :pathname "" :serial t @@ -16,8 +16,7 @@ :components ((:file "globals") (:file "helpers") (:file "process") - (:file "main") - (:file "publish"))) + (:file "main"))) (:module package :pathname "" :components ((:file "package")))) diff --git a/test-serve.lisp b/test-serve.lisp new file mode 100644 index 0000000..e265cfa --- /dev/null +++ b/test-serve.lisp @@ -0,0 +1,20 @@ +(in-package :cl-user) + +(uiop:with-current-directory (*load-truename*) + (load "build")) + +(ql:quickload :cl-site-test-serve) + +;; +;; Start aserve, publish site directory & pages, set default package. +;; +(cl-site:start-aserve) +(cl-site:publish-cl-site) +(setq *package* (find-package :cl-site)) + +(let ((wserver net.aserve:*wserver*)) + (when wserver + ;; FLAG replace with `usocket:get-local-port` after upgrading to zaserve. + (let ((port (acl-compat.socket::port(net.aserve:wserver-socket wserver)))) + (format t "You may now visit http://localhost:~a to test the site.~%" port)))) + -- GitLab