Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
103 lines (83 sloc) 2.76 KB
[buildout]
package-min-coverage = 80
parts +=
code-analysis
i18ndude
[code-analysis]
recipe = plone.recipe.codeanalysis
directory = src
pre-commit-hook = True
flake8 = True
flake8-ignore = E501
return-status-codes = True
[createcoverage]
recipe = zc.recipe.egg
eggs = createcoverage
[i18ndude]
recipe = zc.recipe.egg
eggs = i18ndude
[node]
recipe = gp.recipe.node
npms = csslint jshint
scripts = csslint jshint
[coverage-sh]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/coverage.sh
mode = 755
input = inline:
#! /bin/sh
# checks for report created with createcoverage and evaluate the result
DEFAULT=${buildout:package-min-coverage}
REPORT="htmlcov/index.html"
if [ "$#" -eq 1 ] && [ $1 -ge 0 ] && [ $1 -le 100 ]; then
MINIMUM=$1
else
echo "Invalid value for minimum coverage; using default: $DEFAULT%"
MINIMUM=$DEFAULT
fi
if [ ! -f "$REPORT" ]; then
if [ "$CI" ]; then
# Use output dir to prevent opening a browser.
bin/createcoverage --output-dir=htmlcov
else
bin/createcoverage
fi
fi
if [ ! -f "$REPORT" ]; then
echo "createcoverage went wrong: $REPORT does not exist"
exit 1
fi
# find first percentage value in file (module test coverage) and return it
COVERAGE=`grep "[0-9]\{1,3\}[%]" $REPORT -m 1 -o | grep "[0-9]\{1,3\}" -o`
if [ $COVERAGE -lt $MINIMUM ]; then
echo "Insufficient test coverage: $COVERAGE% (minimum acceptable is $MINIMUM%)"
exit 1
else
echo "Current test coverage: $COVERAGE%"
exit 0
fi
[rebuild_i18n-sh]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/rebuild_i18n.sh
mode = 755
input = inline:
#! /bin/sh
# see http://maurits.vanrees.org/weblog/archive/2010/10/i18n-plone-4 for more information
I18NDOMAIN="${buildout:package-name}"
# find the locales dir
LOCALES=`find . -type d | grep ${buildout:package-name} | grep -m 1 "locales"`
SOURCE=`dirname $LOCALES`;
# rebuild pot file for package's domain and merge it with any manual translations needed
bin/i18ndude rebuild-pot --pot $LOCALES/$I18NDOMAIN.pot --merge $LOCALES/manual.pot --create $I18NDOMAIN $SOURCE
# synchronise translations for package's domain
for po in $LOCALES/*/LC_MESSAGES/$I18NDOMAIN.po; do
bin/i18ndude sync --pot $LOCALES/$I18NDOMAIN.pot $po
done
# rebuild pot file for Plone's domain
bin/i18ndude rebuild-pot --pot $LOCALES/plone.pot --create plone $SOURCE/configure.zcml $SOURCE/profiles/default
# synchronise translations for Plone's domain
for po in $LOCALES/*/LC_MESSAGES/plone.po; do
bin/i18ndude sync --pot $LOCALES/plone.pot $po
done
[versions]
pycodestyle = 2.0.0