-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
executable file
·71 lines (58 loc) · 1.93 KB
/
run.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Get the operating system
OS=$(uname -s)
# Get the right open command
OPEN='xdg-open'
if [ "$OS" == "Darwin" ]; then
OPEN='open'
fi
# Create a virtual environment if it doesn't alreay exist
echo "Creating a virtual environment if it doesn't already exist"
python3 -m venv dgv
# Activate the virtual environment
echo "Activating the virtual environment"
source dgv/bin/activate
# Install the required packages
echo "Installing the required packages"
pip install -r requirements.txt
# Check for doc and doc_pub directories
echo "Checking for doc and doc_pub directories"
if [ ! -d "./build/doc" ]; then
echo "Creating the doc directory"
mkdir -p build/doc
fi
if [ ! -d "./build/doc/pub" ]; then
echo "Creating the pub directory"
mkdir -p build/doc/pub
echo "Creating sphinx template which will be used to publish documentation..."
cd build/doc/pub
cp ../../../pub_template/* ./
mkdir _static
mkdir _templates
cd -
fi
# Run the application
echo "Running the doc-gen application"
python ./src/docgen.py $1 $2 $3 $4 $5 $6 $7 $8 $9
# Clear .md files from the doc_pub directory
echo "Clearing .md files from the doc_pub directory"
rm ./build/doc/pub/*.md
# Copy generated .md files to the pub directory
echo "Copying generated .md files to the pub directory"
cp ./build/doc/*.md ./build/doc/pub/
# Create index.rst file
echo "Creating ./build/doc/pub/index.rst file"
python ./src/docgen/create_index_rst.py
# Run sphinx, `make html` in the doc_pub directory
cd ./build/doc/pub
make html
cd -
echo "Documentation generation complete and can be viewed at ./build/doc/pub/_build/html/index.html"
# Deactivate the virtual environment
echo "Deactivating the virtual environment"
deactivate
# query the user if they would like to view the generated documentation
echo "Would you like to view the generated documentation? (y/n)"
read view_doc
if [ $view_doc == "y" ]; then
eval $OPEN "./build/doc/pub/_build/html/index.html" &
fi