diff --git a/README.md b/README.md index 9b027aa..127d8f0 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ The static-site generator behind jlt-commons project documentation. A project writes markdown; this turns it into a site that GitHub Pages serves. -It is a small babashka program, and `build`/`clean` also run under `jolt` -(jolt reads `bb.edn` tasks directly). `test` and `serve` still need `bb`: -jolt doesn't bundle `clojure.test` or `http-kit`. External dependencies +It is a small babashka program, and `build`, `clean` and `test` also run +under `jolt` (jolt reads `bb.edn` tasks directly). `serve` still needs `bb`: +it binds the port with `http-kit`, which jolt doesn't have. External dependencies (`markdown-clj`, `selmer`, and the `jolt-lang/yaml`/`jolt-lang/time` shims that make those two resolve under jolt) are fetched on first run. @@ -91,15 +91,15 @@ callout. ```bash jolt run build ../your-project # generate ../your-project/_site/ jolt run clean ../your-project # delete the build output -bb test # the test suite +jolt test # the test suite (or bb test) bb serve ../your-project # build, then serve, honouring :base-path bb serve ../your-project 4000 ``` -`build`/`clean` run under either tool. Under `jolt` it's `jolt run `, -not bare `jolt `: `build` collides with jolt's own native -`build -m NS` compiler subcommand. `test` and `serve` stay `bb`-only, -since jolt doesn't bundle `clojure.test` or `http-kit`. +`build`, `clean` and `test` run under either tool. Under `jolt` it's +`jolt run `, not bare `jolt `: `build` collides with jolt's own +native `build -m NS` compiler subcommand. `serve` stays `bb`-only, since it +uses `http-kit`. `_site/` is generated. Add it to the project's `.gitignore`. diff --git a/bb.edn b/bb.edn index 3f39213..98dbf30 100644 --- a/bb.edn +++ b/bb.edn @@ -60,11 +60,11 @@ (println "docs-engine — the jlt-commons documentation site generator\n") (println " jolt run build generate /_site/") (println " jolt run clean delete /_site/") - (println " bb test run the test suite") + (println " jolt test run the test suite") (println " bb serve [port] build, then serve at localhost:3000\n") - (println "build/clean run under either tool (jolt run , not bare jolt :") - (println "build collides with jolt's own build -m NS subcommand). test/serve stay") - (println "bb-only: jolt doesn't bundle clojure.test or http-kit.\n") + (println "build/clean/test run under either tool (jolt run , not bare jolt :") + (println "build collides with jolt's own build -m NS subcommand). serve stays") + (println "bb-only: it uses http-kit.\n") (println "A project configures itself in docs/site.edn. See README.md."))} test {:doc "Run the full test suite" diff --git a/src/site/core.clj b/src/site/core.clj index 5fb753b..27e93c9 100644 --- a/src/site/core.clj +++ b/src/site/core.clj @@ -379,13 +379,12 @@ ;; ;; Everything below builds a plain Ring handler `(fn [req]) -> {:status ;; :headers :body}` and touches no HTTP-server library at all, so it costs -;; build/clean/test nothing. site.serve (bb/JVM) and site.serve.jolt (jolt) -;; are the two thin wrappers that actually bind a port, each requiring the -;; one HTTP-server library their own host has: org.httpkit.server for -;; bb/JVM, ring-chez.adapter for jolt. Splitting it this way is what makes -;; build/clean/test loadable under jolt at all — org.httpkit.server isn't -;; resolvable there, and previously every task here required it via this -;; namespace regardless of whether it ever started a server. +;; build/clean/test nothing. site.serve is the thin wrapper that actually +;; binds a port, with org.httpkit.server, so `serve` runs under bb only. +;; Splitting it this way is what makes build/clean/test loadable under jolt +;; at all — org.httpkit.server isn't resolvable there, and previously every +;; task here required it via this namespace regardless of whether it ever +;; started a server. (defn- content-type [path] (cond diff --git a/src/site/serve.clj b/src/site/serve.clj index 2297514..76e605a 100644 --- a/src/site/serve.clj +++ b/src/site/serve.clj @@ -4,12 +4,8 @@ library involved at all; this namespace is the thin wrapper around org.httpkit.server that turns it into a running server. - Jolt never loads this file. site/serve.jolt is the jolt-native twin - (ring-chez.adapter instead of http-kit) — jolt's require resolves - .jolt before .clj (see the docs-engine README, \"Local preview - server: two hosts, one namespace\"), so the two never collide, and - babashka/JVM never see the .jolt file at all, since their own require - only ever looks for .clj/.cljc." + http-kit isn't available under jolt, so `serve` is bb-only; no other + task requires this namespace." (:require [org.httpkit.server :as hk] [site.core :as core]))