mediawiki-extensions-Visual.../.docs/generate.sh
Timo Tijhof 60a0f97e35 makeStaticLoader: Implement --fixdir option
Currently when running this maintenance script it outputs
the full path to the i18n file. This was done that way because
of .docs/generate.sh (which pipes it to php through stdin).

This however means that currently the output is not suitable
for pasting into demo and test index files (as the path should
be relative for those).

The --fixdir option will function as toggle between a fixed
path to the directory on disk, or a dynamic resolution at
run-time. The default is the latter. generate.sh passes --fixdir.

Change-Id: Idebca553587aaff9b31255d884461f4a51e70afd
2013-04-29 18:44:15 +02:00

42 lines
1.1 KiB
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 --fixdir --section=head --ve-path=../modules/ $*
elif [[ "$l" == "{{VE-LOAD-BODY}}" ]]
then
php ../maintenance/makeStaticLoader.php --fixdir --section=body --ve-path=../modules/ $*
else
echo "$l"
fi
done
) < eg-iframe.tpl | php > eg-iframe.html
# Disable parallel processing which seems to be causing
# problems under Ruby 1.8
warnings=`jsduck --config=config.json --processes=0 2>&1`
ec=$?
rm eg-iframe.html
cd - > /dev/null
# Re-colorize
NORMAL=$(tput sgr0); YELLOW=$(tput setaf 3); MEGANTA=$(tput setaf 5)
echo "$warnings" | perl -pe "s|^([^ ]+) ([^ ]+) (.*)$|${YELLOW}\1 ${MEGANTA}\2${NORMAL} \3|"
# 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