mirror of
https://github.com/Luzifer/3dmodels.git
synced 2024-12-23 02:41:19 +00:00
Add README generator
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
66c5f01e3b
commit
94145f57bf
4 changed files with 33 additions and 1 deletions
14
Makefile
14
Makefile
|
@ -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
5
README.md
Normal 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
4
README.tpl.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Luzifer / 3dmodels
|
||||
|
||||
| Model | Source | Version | Title |
|
||||
| ----- | ------ | ------- | ----- |
|
11
ci/gen_readme.sh
Executable file
11
ci/gen_readme.sh
Executable 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
|
Loading…
Reference in a new issue