From 7b14135587de93dc1571648b43a0345ae17def93 Mon Sep 17 00:00:00 2001 From: Evgeniy Sokolov Date: Tue, 19 Jan 2016 09:15:30 +0100 Subject: [PATCH 1/5] reorganize files --- .travis.yml | 2 +- .travis.sh => files/.travis.sh | 9 +++++---- spell-checker.go => files/spell-checker.go | 0 test | 1 - 4 files changed, 6 insertions(+), 6 deletions(-) rename .travis.sh => files/.travis.sh (68%) rename spell-checker.go => files/spell-checker.go (100%) delete mode 100644 test diff --git a/.travis.yml b/.travis.yml index b072a64..29a944b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ before_install: - curl -s http://extensions.libreoffice.org/extension-center/russian-spellcheck-dictionary.-based-on-works-of-aot-group | grep -oP "http://extensions.libreoffice.org/extension-center/russian-spellcheck-dictionary.-based-on-works-of-aot-group/pscre[^\"]+" | sort -r | head -1 | wget -q -i - -O dictionary.otx - unzip dictionary.otx script: - - sh .travis.sh + - sh files/.travis.sh notifications: email: false diff --git a/.travis.sh b/files/.travis.sh similarity index 68% rename from .travis.sh rename to files/.travis.sh index 2c3d6b3..f4b71be 100644 --- a/.travis.sh +++ b/files/.travis.sh @@ -1,17 +1,18 @@ #!/bin/bash -go build spell-checker.go - +DIR=`dirname $0` EXIT_CODE=0 +go build -o $DIR/spell-checker $DIR/spell-checker.go +exit git diff HEAD^ --name-only > changed_files while read FILE; do echo -n "Проверка файла $FILE на опечатки... "; - OUTPUT_RU=$(cat "$FILE" | hunspell -d ru_RU | ./spell-checker); + OUTPUT_RU=$(cat "$FILE" | hunspell -d ru_RU | $DIR/spell-checker); RU_EXIT_CODE=$? - OUTPUT_EN=$(cat "$FILE" | hunspell -d en_US | ./spell-checker); + OUTPUT_EN=$(cat "$FILE" | hunspell -d en_US | $DIR/spell-checker); EN_EXIT_CODE=$? if [ $RU_EXIT_CODE -ne 0 ] || [ $EN_EXIT_CODE -ne 0 ]; then diff --git a/spell-checker.go b/files/spell-checker.go similarity index 100% rename from spell-checker.go rename to files/spell-checker.go diff --git a/test b/test deleted file mode 100644 index e0bf827..0000000 --- a/test +++ /dev/null @@ -1 +0,0 @@ -test #34 \ No newline at end of file From 735a0c55bcbcb464d7e3c62466c59bc469c9f04c Mon Sep 17 00:00:00 2001 From: Evgeniy Sokolov Date: Tue, 19 Jan 2016 09:19:40 +0100 Subject: [PATCH 2/5] test spell --- test_spell | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 test_spell diff --git a/test_spell b/test_spell new file mode 100644 index 0000000..b283688 --- /dev/null +++ b/test_spell @@ -0,0 +1,8 @@ + +баббаб + +нормальдно + +капуста + +fixg \ No newline at end of file From 0e4a02cc481151693760ccb3b493914c52ef6446 Mon Sep 17 00:00:00 2001 From: Evgeniy Sokolov Date: Tue, 19 Jan 2016 09:42:31 +0100 Subject: [PATCH 3/5] no checks of deleted files and drop debug exit --- files/.travis.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/files/.travis.sh b/files/.travis.sh index f4b71be..27f833b 100644 --- a/files/.travis.sh +++ b/files/.travis.sh @@ -4,8 +4,8 @@ DIR=`dirname $0` EXIT_CODE=0 go build -o $DIR/spell-checker $DIR/spell-checker.go -exit -git diff HEAD^ --name-only > changed_files + +git diff HEAD^ --name-status | grep "^D" -v | awk '{print $2}' > changed_files while read FILE; do echo -n "Проверка файла $FILE на опечатки... "; @@ -22,6 +22,8 @@ while read FILE; do else echo "пройдена"; fi + + echo done < changed_files exit $EXIT_CODE \ No newline at end of file From f31b45b2d59e1bc11b86c4412e3dd46e7fde9bb6 Mon Sep 17 00:00:00 2001 From: Evgeniy Sokolov Date: Tue, 19 Jan 2016 09:47:30 +0100 Subject: [PATCH 4/5] drop test stuff and fix sort --- files/.travis.sh | 2 +- test_spell | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 test_spell diff --git a/files/.travis.sh b/files/.travis.sh index 27f833b..e1aac7f 100644 --- a/files/.travis.sh +++ b/files/.travis.sh @@ -18,7 +18,7 @@ while read FILE; do if [ $RU_EXIT_CODE -ne 0 ] || [ $EN_EXIT_CODE -ne 0 ]; then EXIT_CODE=1; echo "ошибка"; - echo "$OUTPUT_RU\n$OUTPUT_EN" | sort -n -k1,4; + echo "$OUTPUT_RU\n$OUTPUT_EN" | sort -n -k2; else echo "пройдена"; fi diff --git a/test_spell b/test_spell deleted file mode 100644 index b283688..0000000 --- a/test_spell +++ /dev/null @@ -1,8 +0,0 @@ - -баббаб - -нормальдно - -капуста - -fixg \ No newline at end of file From 54cf64d80579201cbfdef4adcf22c75205f82aca Mon Sep 17 00:00:00 2001 From: Evgeniy Sokolov Date: Tue, 19 Jan 2016 09:52:01 +0100 Subject: [PATCH 5/5] cosmetics --- files/.travis.sh | 2 +- files/spell-checker.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/.travis.sh b/files/.travis.sh index e1aac7f..584efbe 100644 --- a/files/.travis.sh +++ b/files/.travis.sh @@ -26,4 +26,4 @@ while read FILE; do echo done < changed_files -exit $EXIT_CODE \ No newline at end of file +exit $EXIT_CODE diff --git a/files/spell-checker.go b/files/spell-checker.go index f946ba5..8a2642f 100644 --- a/files/spell-checker.go +++ b/files/spell-checker.go @@ -56,4 +56,4 @@ func parseHunspellOutput(scanner *bufio.Scanner) map[string]*TypeResult { } return types -} \ No newline at end of file +}