diff --git a/Makefile b/Makefile index 6b556c23571bc6834b545600d9f7859440443fc5..98574bbbd01ef4776a88d84b021f74476fbbfb0b 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ all: build +serve: static favicon + sbcl --load test-serve.lisp + static: mkdir -p output/static # cp -rf content/static/* output/static diff --git a/README.md b/README.md index 1f2f51b77953c5b1964a9f8ba85f2b0585b4521a..b8e535febad6b8211af42e4fcf3c169cd5049f2b 100644 --- a/README.md +++ b/README.md @@ -49,9 +49,8 @@ in `layout/static/` takes precedence. ## Execution -### From command line (recommended) -Using Make. +### From command line, using make: The Makefile contains various useful commands. @@ -59,34 +58,36 @@ Among them: * `make` - to generate the site. * `make clean` - to remove the generated files from output directory +* `make pyserve` - to run a secondary (python) server on port 8000 (crashes if 8000 is busy). -### From Lisp ### + +### 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 load the site-generating code and generate the static pages into `output/` - (load ".../cl-site/build.lisp") ;; replace with your actual path to cl-site/ +* To generate the static pages and start the test server: -Or (step by step): + (load ".../cl-site/test-serve.lisp") ;; replace with your actual path to cl-site/ -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*`). + This will start serving the site on port 8008 (or subsequent port + numbers, if 8008 is busy). -Then, load the system with this command: +### Known Problems - (ql:quickload :cl-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. -To generate the site: - (cl-site:make-site) -The output files will be generated in the `output/` directory. To clean any old files from output/ directory: diff --git a/build.lisp b/build.lisp index e6d9db2644549141e019cef95d1db4cc9d40d24b..7e88635b780d0f6556456eb10d2f4fa7559c4a5d 100644 --- a/build.lisp +++ b/build.lisp @@ -5,4 +5,6 @@ (ql:quickload :cl-site) -(cl-site::make-site) +(cl-site:make-site) + + diff --git a/cl-site-test-serve.asd b/cl-site-test-serve.asd new file mode 100644 index 0000000000000000000000000000000000000000..43f805545ee794735a7bd34aaa999f767d74ca22 --- /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 1bf48f2b4ecccbdb77be9d1a7e9a42da9cf4758a..5837e9c8c1a9ae2dbf057f26ecfb647a06886e01 100644 --- a/cl-site.asd +++ b/cl-site.asd @@ -17,7 +17,6 @@ (:file "helpers") (:file "process") (:file "main"))) - (:module package :pathname "" :components ((:file "package")))) diff --git a/test-serve.lisp b/test-serve.lisp new file mode 100644 index 0000000000000000000000000000000000000000..e265cfa48d444fdb653291114afd89e31de675a6 --- /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)))) +