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

32 lines
926 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
2016-01-19 15:25:59 +00:00
cat $DIR/dictionary.dic | tr '\n' '|' | sed 's/\x27/\\x27/g' > dictionary_processed
DICT_REGEXP=$(cat dictionary_processed | sed 's/|/[^[:alnum:]]\\|/g')
DICT_REGEXP_EOF=$(cat dictionary_processed | sed 's/|$//g' | sed 's/|/$\\|/g')
DICT_REGEXP="$DICT_REGEXP$DICT_REGEXP_EOF$"
2016-01-19 12:50:18 +00:00
2016-01-19 13:53:23 +00:00
git diff HEAD^ --name-status | grep "^D" -v | sed 's/^.\t//g' > changed_files
2016-01-18 23:38:49 +00:00
while read FILE; do
echo -n "Проверка файла $FILE на опечатки... ";
2016-01-19 15:25:59 +00:00
OUTPUT=$(cat "$FILE" | sed "s/$DICT_REGEXP//g" | sed 's/https\?:[^ ]*//g' | sed "s/[(][^)]*\.md[)]//g" | hunspell -d russian-aot,ru_RU,de_DE,en_US | $DIR/spell-checker);
EXIT_CODE=$?
2016-01-18 23:38:49 +00:00
2016-01-19 15:25:59 +00:00
if [ $EXIT_CODE -ne 0 ]; then
2016-01-18 23:38:49 +00:00
echo "ошибка";
2016-01-19 15:25:59 +00:00
echo "$OUTPUT";
2016-01-18 23:38:49 +00:00
else
echo "пройдена";
fi
echo
2016-01-18 23:38:49 +00:00
done < changed_files
2016-01-19 08:52:01 +00:00
exit $EXIT_CODE