You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2015/06/06 02:53:19 UTC

incubator-tinkerpop git commit: changed sort of preprocessed AsciiDoc files and skip processing if the output file already exists and it's newer than the input file

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 725035a06 -> f600b71c8


changed sort of preprocessed AsciiDoc files and skip processing if the output file already exists and it's newer than the input file


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/f600b71c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/f600b71c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/f600b71c

Branch: refs/heads/master
Commit: f600b71c8661e8c171bcb5e6ad3f8f3fd89e62c2
Parents: 725035a
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Sat Jun 6 02:52:54 2015 +0200
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Sat Jun 6 02:52:54 2015 +0200

----------------------------------------------------------------------
 docs/preprocessor/preprocess-file.sh | 23 +++++++++++++++++++----
 docs/preprocessor/preprocess.sh      | 12 +++++++-----
 2 files changed, 26 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f600b71c/docs/preprocessor/preprocess-file.sh
----------------------------------------------------------------------
diff --git a/docs/preprocessor/preprocess-file.sh b/docs/preprocessor/preprocess-file.sh
index 42e33c0..a87d618 100755
--- a/docs/preprocessor/preprocess-file.sh
+++ b/docs/preprocessor/preprocess-file.sh
@@ -26,27 +26,42 @@ input=$2
 name=`basename ${input}`
 output="${TP_HOME}/target/postprocess-asciidoc/${name}"
 
+trap cleanup INT
+
+function cleanup() {
+  rm -rf ${output}
+  exit 255
+}
+
+function processed {
+  echo -ne "\r   progress: [====================================================================================================] 100%\n"
+}
+
 echo
 echo " * source:   ${input}"
 echo "   target:   ${output}"
 echo -ne "   progress: initializing"
 
 if [ $(grep -c '^\[gremlin' ${input}) -gt 0 ]; then
+  if [ ${output} -nt ${input} ]; then
+    processed
+    exit 0
+  fi
   pushd "${CONSOLE_HOME}" > /dev/null
   bin/gremlin.sh -e ${TP_HOME}/docs/preprocessor/processor.groovy ${input} > ${input}.part2.groovy
-  cat ${input}.part2.groovy | grep -o '^pb([0-9][0-9]*' | tail -n1 | cut -d '(' -f2 | xargs echo "TOTAL_LINES =" > ${input}.part1.groovy
-  cat ${input}.part?.groovy > ${input}.groovy && rm -f ${input}.part?.groovy
   ec=${PIPESTATUS[0]}
   if [ ${ec} -eq 0 ]; then
+    cat ${input}.part2.groovy | grep -o '^pb([0-9][0-9]*' | tail -n1 | cut -d '(' -f2 | xargs echo "TOTAL_LINES =" > ${input}.part1.groovy
+    cat ${input}.part?.groovy > ${input}.groovy && rm -f ${input}.part?.groovy
     cat ${input}.groovy | HADOOP_GREMLIN_LIBS="${CONSOLE_HOME}/ext/hadoop-gremlin/lib" bin/gremlin.sh | grep -v '^gremlin> ' | awk 'BEGIN {i=0} /^==>¶IGNORE$/ {i=!i} /^==>¶END$/ {p=0} !/^==>¶IGNORE$/ {if(!i&&p)print} /^==>¶START$/ {p=1}' | grep -v '^WARN ' | sed 's/^==>¶//' > ${output}
     ec=${PIPESTATUS[1]}
   fi
   rm -f ${input}.groovy
   popd > /dev/null
   if [ ${ec} -ne 0 ]; then
-    exit 255
+    cleanup
   fi
 else
   cp ${input} ${output}
-  echo -ne "\r   progress: [====================================================================================================] 100%\n"
+  processed
 fi

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f600b71c/docs/preprocessor/preprocess.sh
----------------------------------------------------------------------
diff --git a/docs/preprocessor/preprocess.sh b/docs/preprocessor/preprocess.sh
index 4587b0e..881fa52 100755
--- a/docs/preprocessor/preprocess.sh
+++ b/docs/preprocessor/preprocess.sh
@@ -35,9 +35,7 @@ function directory {
   echo "$d2"
 }
 
-mkdir -p target/postprocess-asciidoc
-rm -rf target/postprocess-asciidoc/*
-mkdir target/postprocess-asciidoc/tmp
+mkdir -p target/postprocess-asciidoc/tmp
 cp -R docs/{static,stylesheets} target/postprocess-asciidoc/
 
 TP_HOME=`pwd`
@@ -77,9 +75,13 @@ echo
 echo "============================"
 echo "+   Processing AsciiDocs   +"
 echo "============================"
-find "${TP_HOME}/docs/src/" -name "*.asciidoc" | xargs -n1 ${TP_HOME}/docs/preprocessor/preprocess-file.sh "${CONSOLE_HOME}"
+find "${TP_HOME}/docs/src/" -name "*.asciidoc" |
+     xargs -n1 basename |
+     xargs -n1 -I {} echo "echo -ne {}' '; (grep -n {} ${TP_HOME}/docs/src/index.asciidoc || echo 0) | cut -d ':' -f1" | /bin/bash | sort -nk2 | cut -d ' ' -f1 |
+     xargs -n1 -I {} echo "${TP_HOME}/docs/src/{}" |
+     xargs -n1 ${TP_HOME}/docs/preprocessor/preprocess-file.sh "${CONSOLE_HOME}"
 
-if [ ${PIPESTATUS[1]} -ne 0 ]; then
+if [ ${PIPESTATUS[4]} -ne 0 ]; then
   cleanup
   exit 1
 else