mediawiki-extensions-Visual.../.docs/generate.sh
Timo Tijhof 0c33d05e48 Docgen: Exit with error status code if there are warnings.
This way the Jenkins job will be marked failure if we introduce
regressions in the validity of the syntax.

Change-Id: I80ea147b96632412913193600960d1cf4127ed25
2013-03-20 17:45:57 +01:00

38 lines
855 B
Bash
Executable file

#!/usr/bin/env bash
cd $(cd $(dirname $0); pwd)
(
while IFS='' read -r l
do
if [[ "$l" == "{{VE-LOAD-HEAD}}" ]]
then
php ../maintenance/makeStaticLoader.php --section=head --ve-path=../modules/
elif [[ "$l" == "{{VE-LOAD-BODY}}" ]]
then
php ../maintenance/makeStaticLoader.php --section=body --ve-path=../modules/
else
echo "$l"
fi
done
) < eg-iframe.tpl | php > eg-iframe.html
warnings=`jsduck --config=config.json 2>&1`
ec=$?
rm eg-iframe.html
cd - > /dev/null
echo -e "$warnings"
# JSDuck doesn't exit with an error code if there are warnings
# (only when there are fatal errors). We fixed all warnings
# in master so lets consider all warnings errors to ensure
# we don't introduce any new invalid jsduck syntax.
if [[ "$ec" == "0" && "$warnings" != "" ]]
then
exit 1
fi
# Exit with exit code of jsduck command
exit $ec