1
0
mirror of https://github.com/ru-de/faq.git synced 2024-09-19 19:41:28 +00:00
faq-de/files/.travis.sh
2016-01-19 14:53:23 +01:00

35 lines
1.3 KiB
Bash

#!/bin/bash
DIR=`dirname $0`
EXIT_CODE=0
go build -o $DIR/spell-checker $DIR/spell-checker.go
cat $DIR/dictionary.dic | wc -l > $DIR/dictionary_custom.dic
cat $DIR/dictionary.dic | sort >> $DIR/dictionary_custom.dic
git diff HEAD^ --name-status | grep "^D" -v | sed 's/^.\t//g' > changed_files
while read FILE; do
echo -n "Проверка файла $FILE на опечатки... ";
OUTPUT_RU=$(cat "$FILE" | sed 's/https\?:[^ ]*//g' | sed "s/[(][^)]*\.md[)]//g" | hunspell -d russian-aot,$DIR/dictionary_custom,ru_RU,$DIR/dictionary_custom,en_US,de_DE | $DIR/spell-checker);
RU_EXIT_CODE=$?
OUTPUT_EN=$(cat "$FILE" | sed 's/https\?:[^ ]*//g' | sed "s/[(][^)]*\.md[)]//g" | hunspell -d en_US,russian-aot,$DIR/dictionary_custom,ru_RU,$DIR/dictionary_custom,de_DE | $DIR/spell-checker);
EN_EXIT_CODE=$?
OUTPUT_DE=$(cat "$FILE" | sed 's/https\?:[^ ]*//g' | sed "s/[(][^)]*\.md[)]//g" | hunspell -d de_DE,en_US,russian-aot,$DIR/dictionary_custom,ru_RU$DIR/dictionary_custom, | $DIR/spell-checker);
DE_EXIT_CODE=$?
if [ $RU_EXIT_CODE -ne 0 ] || [ $EN_EXIT_CODE -ne 0 ] || [ $DE_EXIT_CODE -ne 0 ]; then
EXIT_CODE=1;
echo "ошибка";
echo "$OUTPUT_RU\n$OUTPUT_DE\n$OUTPUT_EN" | sort -n -k2 | uniq;
else
echo "пройдена";
fi
echo
done < changed_files
exit $EXIT_CODE