Add tests for nginx.conf directives (#1)

Adds tests to make sure all the `nginx.conf` directives (the redirects and rewrites and such) are all correct.

- Uses the `busted` framework
- The tests are run in a Docker container by the bash script `test.sh`
- Self-signed certs are generated in `Dockerfile` for all the domain names
- Adds new `Makefile` commands: `test`, `image-build` and `image-rm`

Reviewed-on: #1
Co-authored-by: Catalin Mititiuc <webdevcat@proton.me>
Co-committed-by: Catalin Mititiuc <webdevcat@proton.me>
This commit is contained in:
2025-06-16 20:18:05 -07:00
parent 449a41aa85
commit 406208f26c
8 changed files with 257 additions and 34 deletions

View File

@@ -15,15 +15,19 @@
### build docker image
$ docker build -t sitegen-openresty .
$ make image-build
### rebuild an existing docker image
$ make image-rm image-build
### generate a new site file
$ docker run --rm -w /opt -v $PWD:/opt sitegen-openresty sitegen new
$ docker run --rm -w /opt/app -v $PWD:/opt/app miti.sh sitegen new
### add an index page
$ docker run --rm -w /opt -v $PWD:/opt sitegen-openresty sitegen page /opt/ index
$ docker run --rm -w /opt/app -v $PWD:/opt/app miti.sh sitegen page /opt/app index
### add to `site.moon`
@@ -50,17 +54,9 @@
### build site
$ docker run --rm -w /opt/app -v $PWD:/opt/app sitegen-openresty sitegen
or
$ make build
### start server
$ docker run --rm -it --init -v $PWD:/opt/app -p 8080:8080 sitegen-openresty
or
### start dev server
$ make
@@ -70,6 +66,10 @@ Visit `localhost:8080` in web browser
$ docker exec -it container_name sitegen watch
### run tests
$ make test
### lint moonscript
$ make lint
@@ -100,8 +100,7 @@ to return `nil`, you will see this cryptic error:
Delete your `.sitegen_cache` file.
## todo
## thinking about
* draft documents
* treesitter highlighting for moonscript
* penlight library