Improved error detection in docs preprocessor. This closes #1314
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/96ee0ba7 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/96ee0ba7 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/96ee0ba7 Branch: refs/heads/TINKERPOP-1063 Commit: 96ee0ba780ed06ff54b29814c96b59fcbba575e8 Parents: 7a1fd4b Author: Daniel Kuppitz <daniel_kupp...@hotmail.com> Authored: Sun May 29 10:07:16 2016 +0200 Committer: Daniel Kuppitz <daniel_kupp...@hotmail.com> Committed: Sun May 29 10:07:16 2016 +0200 ---------------------------------------------------------------------- bin/process-docs.sh | 2 +- docs/preprocessor/awk/prepare.awk | 4 +++ docs/preprocessor/preprocess-file.sh | 3 ++- docs/preprocessor/preprocess.sh | 44 +++++++++++++------------------ 4 files changed, 26 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/96ee0ba7/bin/process-docs.sh ---------------------------------------------------------------------- diff --git a/bin/process-docs.sh b/bin/process-docs.sh index eb779a9..7236faa 100755 --- a/bin/process-docs.sh +++ b/bin/process-docs.sh @@ -103,7 +103,7 @@ else ec=$? fi -if [ $ec == 0 ]; then +if [ $ec -eq 0 ]; then mvn process-resources -Dasciidoc && docs/postprocessor/postprocess.sh ec=$? fi http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/96ee0ba7/docs/preprocessor/awk/prepare.awk ---------------------------------------------------------------------- diff --git a/docs/preprocessor/awk/prepare.awk b/docs/preprocessor/awk/prepare.awk index b9ee682..46960be 100644 --- a/docs/preprocessor/awk/prepare.awk +++ b/docs/preprocessor/awk/prepare.awk @@ -67,3 +67,7 @@ function remove_callouts(code) { /^\[gremlin-/ { inCodeSection = 1 } + +END { + print_string("// LAST LINE") +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/96ee0ba7/docs/preprocessor/preprocess-file.sh ---------------------------------------------------------------------- diff --git a/docs/preprocessor/preprocess-file.sh b/docs/preprocessor/preprocess-file.sh index 78622d6..35b1f15 100755 --- a/docs/preprocessor/preprocess-file.sh +++ b/docs/preprocessor/preprocess-file.sh @@ -132,7 +132,8 @@ if [ ! ${SKIP} ] && [ $(grep -c '^\[gremlin' ${input}) -gt 0 ]; then fi if [ ${ec} -eq 0 ]; then - ec=`grep -c '\bpb([0-9][0-9]*);' ${output}` + tail -n1 ${output} | grep -F '// LAST LINE' > /dev/null + ec=$? fi if [ ${ec} -eq 0 ]; then http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/96ee0ba7/docs/preprocessor/preprocess.sh ---------------------------------------------------------------------- diff --git a/docs/preprocessor/preprocess.sh b/docs/preprocessor/preprocess.sh index 740808c..d225c48 100755 --- a/docs/preprocessor/preprocess.sh +++ b/docs/preprocessor/preprocess.sh @@ -128,33 +128,27 @@ echo "+ Processing AsciiDocs +" echo "============================" ec=0 -process_subdirs=1 -find "${TP_HOME}/docs/src/" -name index.asciidoc | xargs -n1 dirname | while read subdir ; do - if [ ${process_subdirs} -eq 1 ]; then - find "${subdir}" -name "*.asciidoc" | - xargs -n1 basename | - xargs -n1 -I {} echo "echo -ne {}' '; (grep -n {} ${subdir}/index.asciidoc || echo 0) | head -n1 | cut -d ':' -f1" | /bin/bash | sort -nk2 | cut -d ' ' -f1 | - xargs -n1 -I {} echo "${subdir}/{}" | - xargs -n1 ${TP_HOME}/docs/preprocessor/preprocess-file.sh "${CONSOLE_HOME}" "${DRYRUN_DOCS}" "${FULLRUN_DOCS}" - - ps=(${PIPESTATUS[@]}) - for i in {0..7}; do - ec=${ps[i]} - [ ${ec} -eq 0 ] || break - done - - if [ ${ec} -ne 0 ]; then - process_subdirs=0 - fi - fi +for subdir in $(find "${TP_HOME}/docs/src/" -name index.asciidoc | xargs -n1 dirname) +do + find "${subdir}" -name "*.asciidoc" | + xargs -n1 basename | + xargs -n1 -I {} echo "echo -ne {}' '; (grep -n {} ${subdir}/index.asciidoc || echo 0) | head -n1 | cut -d ':' -f1" | /bin/bash | sort -nk2 | cut -d ' ' -f1 | + xargs -n1 -I {} echo "${subdir}/{}" | + xargs -n1 ${TP_HOME}/docs/preprocessor/preprocess-file.sh "${CONSOLE_HOME}" "${DRYRUN_DOCS}" "${FULLRUN_DOCS}" + + ps=(${PIPESTATUS[@]}) + for i in {0..7}; do + ec=${ps[i]} + [ ${ec} -eq 0 ] || break + done + [ ${ec} -eq 0 ] || break done tput smam [[ "${COLUMNS}" != "" ]] && stty cols ${COLS} -if [ ${ec} -ne 0 ]; then - exit 1 -else - rm -rf /tmp/neo4j /tmp/tinkergraph.kryo - echo -fi +rm -rf /tmp/neo4j /tmp/tinkergraph.kryo + +[ ${ec} -eq 0 ] || exit 1 + +echo