aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/doc_gen/run_doc.sh
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2016-11-23 09:42:29 +0100
committerPeter Mikus <pmikus@cisco.com>2016-11-28 07:30:55 +0000
commit4dadc7a005ca99aa5a14ac650e9aa187cea10619 (patch)
tree2fc5ac6e8a875dfbf223c4789e24f3bab0b689bc /resources/tools/doc_gen/run_doc.sh
parent4bda4f8b55b0d431b514663e8e90fccd97ad31d4 (diff)
CSIT-474: CSIT doc auto-generation
- See resources/tools/doc_gen/README.rst for details Change-Id: Ie5704c93a41e456d65fcd6df2d9d8c96987deebb Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/doc_gen/run_doc.sh')
-rwxr-xr-xresources/tools/doc_gen/run_doc.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/resources/tools/doc_gen/run_doc.sh b/resources/tools/doc_gen/run_doc.sh
new file mode 100755
index 0000000000..bbb9940468
--- /dev/null
+++ b/resources/tools/doc_gen/run_doc.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+WORKING_DIR='tmp'
+BUILD_DIR='_build'
+
+# Clean-up when finished:
+trap 'rm -rf ${WORKING_DIR}; exit' EXIT
+trap 'rm -rf ${WORKING_DIR}; exit' ERR
+
+# Remove the old build:
+rm -rf ${BUILD_DIR} || true
+rm -rf ${WORKING_DIR} || true
+
+# Create working directories
+mkdir ${BUILD_DIR}
+mkdir --parents ${WORKING_DIR}/resources/libraries/python/
+mkdir --parents ${WORKING_DIR}/resources/libraries/robot/
+mkdir --parents ${WORKING_DIR}/tests/
+
+# Copy the Sphinx source files:
+cp -r src/* ${WORKING_DIR}/
+
+# Copy the source files to be processed:
+rsync -a --include '*/' --include '*.py' --exclude '*' ../../../resources/libraries/python/ ${WORKING_DIR}/resources/libraries/python/
+cp ../../../resources/__init__.py ${WORKING_DIR}/resources/
+cp ../../../resources/libraries/__init__.py ${WORKING_DIR}/resources/libraries/
+rsync -a --include '*/' --include '*.robot' --exclude '*' ../../../resources/libraries/robot/ ${WORKING_DIR}/resources/libraries/robot/
+rsync -a --include '*/' --include '*.robot' --exclude '*' ../../../tests/ ${WORKING_DIR}/tests/
+
+# Create virtual environment:
+virtualenv ${WORKING_DIR}/env
+. ${WORKING_DIR}/env/bin/activate
+
+# Install CSIT requirements:
+pip install -r ../../../requirements.txt
+# Install Sphinx:
+pip install -r ${WORKING_DIR}/requirements.txt
+
+export PYTHONPATH=`pwd`
+
+# Generate rst files:
+./gen_rst.py
+
+# Generate the documentation:
+sphinx-build -vvv -b html ${WORKING_DIR}/ ${BUILD_DIR}/ \ No newline at end of file