diff --git a/tools/build-all-rst.sh b/tools/build-all-rst.sh new file mode 100755 index 00000000..814b0bb8 --- /dev/null +++ b/tools/build-all-rst.sh @@ -0,0 +1,6 @@ +#!/bin/bash -e + +mkdir -p publish-docs + +tools/build-rst.sh doc/ha-guide --build build \ + --target draft/ha-guide diff --git a/tools/build-rst.sh b/tools/build-rst.sh new file mode 100755 index 00000000..c4b83830 --- /dev/null +++ b/tools/build-rst.sh @@ -0,0 +1,78 @@ +#!/bin/bash -xe +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +DIRECTORY=$1 + +if [ -z "$DIRECTORY" ] ; then + echo "usage $0 DIRECTORY options" + echo "Options are:" + echo "--glossary: Build glossary" + echo "--tag TAG: Use given tag for building" + echo "--target TARGET: Copy files to publish-docs/$TARGET" + echo "--build BUILD: Name of build directory" + exit 1 +fi + +GLOSSARY=0 +TARGET="" +TAG="" +TAG_OPT="" +BUILD="" + +while [[ $# > 1 ]] ; do + option="$1" + case $option in + --glossary) + GLOSSARY=1 + ;; + --tag) + TAG="$2" + TAG_OPT="-t $2" + shift + ;; + --target) + TARGET="$2" + shift + ;; + --build) + BUILD="$2" + shift + ;; + esac + shift +done + + +if [ "$GLOSSARY" -eq "1" ] ; then + echo "Generating Glossary" + tools/glossary2rst.py doc/common-rst/glossary.rst +fi + +if [ -z "$BUILD" ] ; then + if [ -z "$TAG" ] ; then + BUILD_DIR="$DIRECTORY/build/html" + else + BUILD_DIR="$DIRECTORY/build-${TAG}/html" + fi +else + BUILD_DIR="$DIRECTORY/$BUILD/html" +fi + +sphinx-build -E -W $TAG_OPT $DIRECTORY/source $BUILD_DIR + +# Copy RST +if [ "$TARGET" != "" ] ; then + mkdir -p publish-docs/$TARGET + rsync -a $BUILD_DIR/ publish-docs/$TARGET/ +fi diff --git a/tox.ini b/tox.ini index 7a8f5485..44a72d90 100644 --- a/tox.ini +++ b/tox.ini @@ -39,10 +39,7 @@ commands = openstack-doc-test --check-deletions {posargs} [testenv:checkbuild] commands = # Build and copy RST Guides - sphinx-build -W doc/ha-guide/source doc/ha-guide/build/html - # Copy RST ha-guide - mkdir -p publish-docs/draft/ha-guide/ - rsync -a doc/ha-guide/build/html/ publish-docs/draft/ha-guide/ + {toxinidir}/tools/build-all-rst.sh # Build DocBook Guide openstack-doc-test --check-build {posargs} @@ -52,10 +49,7 @@ commands = # over. commands = # Build and copy RST Guides - sphinx-build -W doc/ha-guide/source doc/ha-guide/build/html - # Copy RST ha-guide - mkdir -p publish-docs/draft/ha-guide/ - rsync -a doc/ha-guide/build/html/ publish-docs/draft/ha-guide/ + {toxinidir}/tools/build-all-rst.sh # Build DocBook Guide openstack-doc-test --check-build --publish @@ -86,7 +80,7 @@ commands = doc-tools-check-languages doc-tools-check-languages.conf publish all [testenv:docs] commands = - sphinx-build -W doc/ha-guide/source doc/ha-guide/build/html + sphinx-build -E -W doc/ha-guide/source doc/ha-guide/build/html [doc8] # Settings for doc8: