Skip to content

Instantly share code, notes, and snippets.

@toabctl
Last active March 8, 2018 16:19
Show Gist options
  • Save toabctl/908eb645bdc2f91c548d1341cc979d4c to your computer and use it in GitHub Desktop.
Save toabctl/908eb645bdc2f91c548d1341cc979d4c to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
# Author: Thomas Bechtold <[email protected]>
# License: Apache-2.0
# List of project for running the doc generation
: ${PROJECTS:="nova horizon cinder glance neutron swift manila"}
# directory where the OpenStack git repositories are in
: ${OPENSTACK_REPO_DIR:=~/devel/openstack}
# branch to use when creating the doc
: ${OPENSTACK_REPO_BRANCH:=origin/stable/pike}
# extra tox options (eg. -r)
: ${TOX_OPTS:=""}
# the base output directory for the xml files
: ${OUTPUT_DIR:=~/openstack-docs-xml}
if [ ! -d "${OPENSTACK_REPO_DIR}" ]; then
mkdir -p ${OPENSTACK_REPO_DIR}
fi
if [ ! -d "${OUTPUT_DIR}" ]; then
mkdir -p ${OUTPUT_DIR}
fi
for project in $PROJECTS; do
echo "##### ${project}"
(
if [ ! -d "${OPENSTACK_REPO_DIR}/${project}" ]; then
cd ${OPENSTACK_REPO_DIR}
echo "### Cloning git repo"
git clone git://git.openstack.org/openstack/${project} > /dev/null
fi
cd ${OPENSTACK_REPO_DIR}/${project}
git checkout ${OPENSTACK_REPO_BRANCH}
echo "### Running tox"
tox ${TOX_OPTS} -e docs > /dev/null
source .tox/docs/bin/activate
echo "### Running sphinx-build"
sphinx-build -W -b xml -E -c doc/source doc/source/ ${OUTPUT_DIR}/${project}
)
done
echo "###################################################################"
echo "Your rst xml files for the different projects are in ${OUTPUT_DIR}"
echo "###################################################################"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment