From 9ed5df15bba14d264684cde38e21ddc0856a5260 Mon Sep 17 00:00:00 2001 From: ClementTsang <34804052+ClementTsang@users.noreply.github.com> Date: Sat, 4 Feb 2023 04:58:12 -0500 Subject: [PATCH] docs: add script to serve mkdocs locally --- docs/README.md | 2 ++ docs/serve.sh | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 docs/serve.sh diff --git a/docs/README.md b/docs/README.md index 528822e8..66092dd0 100644 --- a/docs/README.md +++ b/docs/README.md @@ -7,6 +7,8 @@ Documentation is currently built using Python 3.11, though it should work fine w ## Running locally +One way is to just run `serve.sh`. Alternatively, the manual steps are: + ```bash # Change directories to the documentation. cd docs/ diff --git a/docs/serve.sh b/docs/serve.sh new file mode 100755 index 00000000..ad833056 --- /dev/null +++ b/docs/serve.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +VENV_PATH="./venv/" +PYTHON_CMD=${1:-python} + +if [ ! -d $VENV_PATH ]; then + echo "venv not found, creating one using the command '${PYTHON_CMD}'..."; + $PYTHON_CMD -m venv venv; + source ./venv/bin/activate; + pip install --upgrade pip; + pip install -r requirements.txt; + ./venv/bin/mkdocs serve; +else + echo "venv already found."; + source ./venv/bin/activate; + ./venv/bin/mkdocs serve; +fi; +