Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
[travis] added strings check
Browse files Browse the repository at this point in the history
  • Loading branch information
Bertrand Dunogier committed Dec 5, 2016
1 parent 87b89f6 commit b0b4c03
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ matrix:
# Run behat first as it takes the most time (don't need to specify php version here as we don't really care about version on host)
- php: 5.6
env: BEFORE="./bin/travis/prepare_behat.sh" TEST_CMD="./bin/travis/runbehat.sh" AFTER_SUCCESS='echo "After success"' RUN_INSTALL=1 COMPOSE_FILE="doc/docker-compose/base-prod.yml:doc/docker-compose/selenium.yml" SYMFONY_ENV=behat SYMFONY_DEBUG=0
- php: 5.6
env: BEFORE="./bin/travis/prepare_behat.sh" TEST_CMD="./bin/travis/runcheckstrings.sh" AFTER_SUCCESS='echo "After success"' RUN_INSTALL=1 COMPOSE_FILE="$HOME/build/ezplatform/doc/docker-compose/base-dev.yml" SYMFONY_ENV=dev SYMFONY_DEBUG=1
- env: BEFORE="./bin/travis/setupnode.sh" TEST_CMD="./bin/travis/runnode.sh" AFTER_SUCCESS="./bin/travis/generate_apidoc.sh"
- php: 7.0
env: BEFORE="./bin/travis/setupphpunit.sh" TEST_CMD="./vendor/bin/phpunit -c phpunit.xml" AFTER_SUCCESS='echo "After success"'
Expand Down
29 changes: 29 additions & 0 deletions bin/travis/checkstrings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env sh

OUTPUT=$(./bin/updatestrings.sh --dry-run)

echo "> Output from updatestrings.sh"
echo $OUTPUT

echo "> Strings check result"

ADDED_MESSAGES=$(echo "$OUTPUT" | awk '/Added Messages/ { print $3 }')
DELETED_MESSAGES=$(echo "$OUTPUT" | awk '/Deleted Messages/ { print $3 }')

RETURN=0

if test "$ADDED_MESSAGES" != "0"; then
echo "$ADDED_MESSAGES strings are added";
RETURN=1
fi

if test "$DELETED_MESSAGES" != "0"; then
echo "$DELETED_MESSAGES strings are deleted";
RETURN=1
fi

if test "$RETURN" != 0; then
echo "Failure: strings need to be regenerated"
fi

exit $RETURN;
9 changes: 9 additions & 0 deletions bin/travis/runcheckstrings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env sh

set -x

cd "$HOME/build/ezplatform"
ls -l
$(docker-compose exec --user www-data app sh -c "cd vendor/ezsystems/platform-ui-bundle; ./bin/travis/checkstrings.sh")

exit $?
6 changes: 6 additions & 0 deletions bin/updatestrings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
../../../app/console translation:extract en -v \
--dir=. \
--exclude-dir=vendor --exclude-dir=Tests --exclude-dir=Features --exclude-dir=node_modules --exclude-dir=Resources/public/vendors \
--output-dir=./Resources/translations \
"$@"

0 comments on commit b0b4c03

Please sign in to comment.