/
generate_docs.sh
executable file
·36 lines (24 loc) · 968 Bytes
/
generate_docs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
###
# Utility script to auto-generate/auto-update sphinx docs for project.
# Forces entire docs build folder to re-build, in order to skip issue where sometimes docs don't update.
##
# Stop on error.
set -e
# Ensure bash is executing from project root, regardless of where it was invoked from.
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Forcibly remove existing generated docs, to ensure build command actually updates everything properly.
if [[ -d "./docs/build/" ]]
then
rm -r "./docs/build/"
fi
mkdir "./docs/build/"
# Auto-generate docs source files, from actual Python code in project.
sphinx-apidoc -o ./docs/source/api/ ./django_expanded_test_cases/
# Remove modules .rst file, because we don't actually care about it.
if [[ -f "./docs/source/api/modules.rst" ]]
then
rm ./docs/source/api/modules.rst
fi
# Generate sphinx docs from source files.
sphinx-build ./docs/source/ ./docs/build/