1
0
mirror of https://github.com/ru-de/faq.git synced 2024-11-09 20:21:01 +00:00
faq-de/files/.travis.sh

29 lines
719 B
Bash
Raw Normal View History

2016-01-18 23:38:49 +00:00
#!/bin/bash
2016-01-19 08:15:30 +00:00
DIR=`dirname $0`
2016-01-18 23:38:49 +00:00
EXIT_CODE=0
2016-01-19 08:15:30 +00:00
go build -o $DIR/spell-checker $DIR/spell-checker.go
git diff HEAD^ --name-status | grep "^D" -v | awk '{print $2}' > changed_files
2016-01-18 23:38:49 +00:00
while read FILE; do
echo -n "Проверка файла $FILE на опечатки... ";
2016-01-19 08:15:30 +00:00
OUTPUT_RU=$(cat "$FILE" | hunspell -d ru_RU | $DIR/spell-checker);
2016-01-18 23:38:49 +00:00
RU_EXIT_CODE=$?
2016-01-19 08:15:30 +00:00
OUTPUT_EN=$(cat "$FILE" | hunspell -d en_US | $DIR/spell-checker);
2016-01-18 23:38:49 +00:00
EN_EXIT_CODE=$?
if [ $RU_EXIT_CODE -ne 0 ] || [ $EN_EXIT_CODE -ne 0 ]; then
EXIT_CODE=1;
echo "ошибка";
2016-01-19 08:47:30 +00:00
echo "$OUTPUT_RU\n$OUTPUT_EN" | sort -n -k2;
2016-01-18 23:38:49 +00:00
else
echo "пройдена";
fi
echo
2016-01-18 23:38:49 +00:00
done < changed_files
exit $EXIT_CODE