1
0
Fork 0
mirror of https://github.com/Luzifer/3dmodels.git synced 2024-10-18 05:04:19 +00:00

Add README generator

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-01-03 15:38:04 +01:00
parent 66c5f01e3b
commit 94145f57bf
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
4 changed files with 33 additions and 1 deletions

View file

@ -1,9 +1,21 @@
sourcefiles := $(wildcard *.jscad)
default: $(sourcefiles)
default: $(sourcefiles) README.md
### Generators
%.jscad: docker-build
docker run --rm -i -v "$(CURDIR):$(CURDIR)" -w "$(CURDIR)" registry.local/openjscad:cli "$@"
README.md:
bash ci/gen_readme.sh
.PHONY: README.md
### Helpers
auto-hook-pre-commit: README.md
git diff --exit-code README.md || git add README.md
docker-build:
docker build -q -f ci/Dockerfile.compile -t registry.local/openjscad:cli ci

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# Luzifer / 3dmodels
| Model | Source | Version | Title |
| ----- | ------ | ------- | ----- |
| [`sonoff_dev_housing.stl`](sonoff_dev_housing.stl) | [`sonoff_dev_housing.jscad`](sonoff_dev_housing.jscad) | 0.1 | Sonoff DEV box for lamp post |

4
README.tpl.md Normal file
View file

@ -0,0 +1,4 @@
# Luzifer / 3dmodels
| Model | Source | Version | Title |
| ----- | ------ | ------- | ----- |

11
ci/gen_readme.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail
# Reset README to template stub
cp README.tpl.md README.md
for filename in *.jscad; do
title=$(awk -F ':' '/title\s*:/{ print $2 }' "${filename}")
rev=$(awk -F ':' '/revision\s*:/{ print $2 }' "${filename}")
echo "| [\`${filename%%.jscad}.stl\`](${filename%%.jscad}.stl) | [\`${filename}\`](${filename}) | ${rev# *} | ${title# *} |" >>README.md
done