Moving vpn-instance yang from VPNMgr > NeutronVPN
[integration/test.git] / docs / build-integration-robot-libdoc.sh
1 #!/bin/bash
2 # @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
3 ##############################################################################
4 # Copyright (c) 2016 Red Hat, Inc. and others.
5 # Copyright (c) 2017 The Linux Foundation and others.
6 #
7 # All rights reserved. This program and the accompanying materials
8 # are made available under the terms of the Eclipse Public License v1.0
9 # which accompanies this distribution, and is available at
10 # http://www.eclipse.org/legal/epl-v10.html
11 ##############################################################################
12
13 CSIT_DIR="../csit/libraries"
14 ROBOT_DIR="$(pwd)/_static/integration/robot"
15 TMP_ROBOT_DIR="$(pwd)/_build/robot"
16
17 mkdir -p "$ROBOT_DIR" "$TMP_ROBOT_DIR"
18
19 # --- START BUILD ROBOT DOCS --- #
20 pushd "$CSIT_DIR"
21 csit_dirs=($(find . -type d | sed 's#./##'))
22 csit_files=($(find . -type f -name "*.py" -o -name "*.robot" | sed 's#./##'))
23
24 pushd "$ROBOT_DIR"
25 mkdir -p ${csit_dirs[*]}
26 popd
27 pushd "$TMP_ROBOT_DIR"
28 mkdir -p ${csit_dirs[*]}
29 popd
30
31 if hash parallel 2>/dev/null; then
32     parallel --jobs 200% --halt now,fail=1 python -m robot.libdoc "{}" "$TMP_ROBOT_DIR/{}.html" ::: ${csit_files[*]}
33 else
34     for f in "${csit_files[@]}"; do
35         python -m robot.libdoc "$f" "$TMP_ROBOT_DIR/$f.html"
36     done
37 fi
38 popd
39 # --- END BUILD ROBOT DOCS --- #
40
41 # --- START BUILD ROBOT INDEX --- #
42 pushd "$TMP_ROBOT_DIR"
43 echo "<html><body><ul>" > "$ROBOT_DIR/index.html"
44
45 html_files=($(find . -type f -name "*.html" | sed 's#./##'))
46 for f in "${html_files[@]}"; do
47     sed 's/black/orange/; s/white/black/; s/^<body>/<body><img src="..\/..\/logo.png">/' "$f" > "$ROBOT_DIR/$f"
48     echo "<li><a href=\"$f\">$f</a></li>" >> "$ROBOT_DIR/index.html"
49 done
50
51 echo "</ul></body></html>" >> "$ROBOT_DIR/index.html"
52 popd
53 # --- END BUILD ROBOT INDEX --- #