openstack-manuals/tools/test-languages.sh
Andreas Jaeger 7c2830a4f7 Improve test-languages.sh
Add setup of user-guide and user-guide-admin for publishing target, this
was missing before and thus these guides were not build..

Be more verbose in setting up directories and invocation of
openstack-doc-test.

Change-Id: I3d41dd813376624238903b38c779b53e7b93547c
2014-05-30 21:46:27 +02:00

107 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
function setup_directory {
SET_LANG=$1
shift
for BOOK_DIR in "$@" ; do
echo " $BOOK_DIR"
openstack-generate-docbook -l $SET_LANG -b $BOOK_DIR
done
}
function setup_lang {
SET_LANG=$1
shift
echo "Setting up files for $SET_LANG"
echo "======================="
echo " Directories:"
setup_directory $SET_LANG 'common' 'glossary' "$@"
cp doc/pom.xml generated/$SET_LANG/pom.xml
}
function test_ja {
setup_lang 'ja'
case "$PURPOSE" in
test)
setup_directory 'ja' 'high-availability-guide' \
'install-guide' 'security-guide' 'user-guide' \
'user-guide-admin'
openstack-doc-test -v --check-build -l ja \
--only-book high-availability-guide \
--only-book install-guide \
--only-book user-guide \
--only-book user-guide-admin \
--only-book security-guide
RET=$?
;;
publish-install)
setup_directory 'ja' 'install-guide'
openstack-doc-test -v --publish --check-build -l ja \
--only-book install-guide
RET=$?
;;
publish)
setup_directory 'ja' 'high-availability-guide' \
'security-guide' 'user-guide' 'user-guide-admin'
openstack-doc-test -v --publish --check-build -l ja \
--only-book high-availability-guide \
--only-book user-guide \
--only-book user-guide-admin \
--only-book security-guide
RET=$?
;;
esac
if [ "$RET" -eq "0" ] ; then
echo "... succeeded"
else
echo "... failed"
BUILD_FAIL=1
fi
}
function test_language () {
case "$language" in
ja)
test_ja
;;
*)
BUILD_FAIL=1
echo "Language $language not handled"
;;
esac
}
function usage () {
echo "Call the script as: "
echo "$0 PURPOSE LANGUAGE1 LANGUAGE2..."
echo "PURPOSE is either 'test', 'publish' or 'publish-install'"
}
if [ "$#" -lt 2 ] ; then
usage
exit 1
fi
if [ "$1" = "test" ] ; then
PURPOSE="test"
elif [ "$1" = "publish" ] ; then
PURPOSE="publish"
elif [ "$1" = "publish-install" ] ; then
PURPOSE="publish-install"
else
usage
exit 1
fi
shift
BUILD_FAIL=0
for language in "$@" ; do
echo
echo "Building for language $language"
echo
test_language "$language"
done
exit $BUILD_FAIL