[docs] adds a stolen shell script for creating the documentation ...

stolen from https://github.com/bendalab/thunderfish/blob/master/build-docs.sh
This commit is contained in:
Jan Grewe 2020-07-27 11:11:40 +02:00
parent b4d03325de
commit 0fcddd3d51
2 changed files with 42 additions and 0 deletions

42
build_docu.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
die () { echo "ERROR: $*" >&2; exit 2; }
for cmd in pdoc3; do
command -v "$cmd" >/dev/null ||
die "Missing $cmd; \`pip install $cmd\`"
done
PACKAGE="fishbook"
PACKAGEROOT="$(dirname "$(realpath "$0")")"
BUILDROOT="$PACKAGEROOT/site"
echo
echo "Clean up documentation of $PACKAGE"
echo
rm -rf "$BUILDROOT" 2> /dev/null || true
mkdir -p "$BUILDROOT"
echo "Building general documentation for $PACKAGE"
echo
cd "$PACKAGEROOT"
mkdocs build --config-file .mkdocs.yml --site-dir "$BUILDROOT"
cd - > /dev/null
echo
echo "Building API reference docs for $PACKAGE"
echo
cd "$PACKAGEROOT"
pdoc3 --html --output-dir "$BUILDROOT/api-tmp" $PACKAGE
mv "$BUILDROOT/api-tmp/$PACKAGE" "$BUILDROOT/api"
rmdir "$BUILDROOT/api-tmp"
cd - > /dev/null
echo
echo "Done. Docs in:"
echo
echo " file://$BUILDROOT/index.html"
echo