-
Notifications
You must be signed in to change notification settings - Fork 2
/
update_docs.sh
executable file
·55 lines (46 loc) · 1.28 KB
/
update_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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Run this script to build and deploy the mkdocs docs in /docs
JUPYTER_SOURCE="docs/jupyter_source"
JUPYTER_BUILD="docs/docs/jupyter_build"
AUTODOC_MODULES=("divvy")
AUTODOC_BUILD="docs/docs/autodoc_build"
USAGE_TEMPLATE=""
USAGE_CMDS=("")
RENDERED_DIR="$CODEBASE/code.databio.org/divvy"
# Build jupyter source documents into markdown
if [ ! -z "$JUPYTER_SOURCE" ]
then
for NB in `ls "$JUPYTER_SOURCE"/*.ipynb`
do
jupyter nbconvert --execute --to markdown "$NB" --output-dir "$JUPYTER_BUILD"
done
else
echo "No JUPYTER_SOURCE provided."
fi
# Build python autodocs into markdown
if [ ! -z "$AUTODOC_MODULES" ]
then
for MODULE in $AUTODOC_MODULES
do
python $CODEBASE/gendocs.py $MODULE > $AUTODOC_BUILD/$MODULE.md
done
else
echo "No AUTODOC_MODULES provided."
fi
# Build an auto-usage page in markdown
if [ ! -z "$USAGE_CMDS" ]
then
cp $USAGE_TEMPLATE usage_temp.md
for cmd in "$USAGE_CMDS"; do
echo $cmd
echo -e "\n\`$cmd\`" >> usage_temp.md
echo -e '```' >> usage_temp.md
$cmd >> usage_temp.md 2>&1
echo -e '```' >> usage_temp.md
done
mv usage_temp.md docs/docs/usage.md
cat docs/docs/usage.md
else
echo "No USAGE_CMDS provided."
fi
# Render completed docs into output folder with `mkdocs`
mkdocs build -f docs/mkdocs.yml -d "$RENDERED_DIR"