tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkupp...@apache.org
Subject incubator-tinkerpop git commit: Improved dryRun functionality for the docs processor. It's now possible to dry run (or full run) only specific files.
Date Thu, 31 Mar 2016 20:14:56 GMT
Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1020 [created] 83fab568e


Improved dryRun functionality for the docs processor. It's now possible to dry run (or full
run) only specific files.


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

Branch: refs/heads/TINKERPOP-1020
Commit: 83fab568eaa74fcaefe5f1085918bdf3a7d7ba85
Parents: 3dfe3dd
Author: Daniel Kuppitz <daniel_kuppitz@hotmail.com>
Authored: Thu Mar 31 22:14:07 2016 +0200
Committer: Daniel Kuppitz <daniel_kuppitz@hotmail.com>
Committed: Thu Mar 31 22:14:07 2016 +0200

----------------------------------------------------------------------
 CHANGELOG.asciidoc                           |  1 +
 bin/process-docs.sh                          | 28 ++++++--
 docs/preprocessor/preprocess-file.sh         | 38 ++++++++++-
 docs/preprocessor/preprocess.sh              | 81 +++++++++++++----------
 docs/src/dev/developer/contributing.asciidoc |  2 +
 5 files changed, 108 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/83fab568/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index f90e71f..ffab087 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/incubator-tinkerpop/master/docs/
 TinkerPop 3.1.2 (NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Improved dryRun functionality for the docs processor. It's now possible to dry run (or
full run) only specific files.
 * Provided Docker script that allows the execution of several build tasks within a Docker
container.
 * Added a per-request `scriptEvaluationTimeout` option to the Gremlin Server protocol.
 * Changed `DriverRemoteAcceptor` to send scripts as multi-line.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/83fab568/bin/process-docs.sh
----------------------------------------------------------------------
diff --git a/bin/process-docs.sh b/bin/process-docs.sh
index c2d8289..0b0e1eb 100755
--- a/bin/process-docs.sh
+++ b/bin/process-docs.sh
@@ -20,21 +20,42 @@
 
 pushd "$(dirname $0)/.." > /dev/null
 
+NOCLEAN=
+
+DRYRUN=
+DRYRUN_DOCS=
+FULLRUN_DOCS=
+
 while [[ $# -gt 0 ]]
 do
   key="$1"
   case $key in
     -n|--noClean)
       NOCLEAN=1
+      shift
       ;;
     -d|--dryRun)
       DRYRUN=1
+      shift
+      if [[ $# -gt 0 ]] && [[ $1 != -* ]]; then
+        DRYRUN_DOCS="$1"
+        shift
+      else
+        DRYRUN_DOCS="*"
+      fi
+      ;;
+    -f|--fullRun)
+      DRYRUN=1
+      DRYRUN_DOCS=${DRYRUN_DOCS:-"*"}
+      shift
+      FULLRUN_DOCS="$1"
+      shift
       ;;
     *)
       # unknown option
+      shift
       ;;
   esac
-  shift
 done
 
 if [ -z ${NOCLEAN} ]; then
@@ -44,7 +65,7 @@ if [ -z ${NOCLEAN} ]; then
   fi
 fi
 
-if [ ! -z ${DRYRUN} ]; then
+if [ ${DRYRUN} ] && [ "${DRYRUN_DOCS}" == "*" ] && [ -z "${FULLRUN_DOCS}"
]; then
 
   mkdir -p target/postprocess-asciidoc/tmp
   cp -R docs/{static,stylesheets} target/postprocess-asciidoc/
@@ -61,13 +82,12 @@ else
     [ ${GEPHI_MOCK} ] && kill ${GEPHI_MOCK}
   }
 
-
   nc -z localhost 8080 || (
     bin/gephi-mock.py > /dev/null 2>&1 &
     GEPHI_MOCK=$!
   )
 
-  docs/preprocessor/preprocess.sh
+  docs/preprocessor/preprocess.sh "${DRYRUN_DOCS}" "${FULLRUN_DOCS}"
   ec=$?
 fi
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/83fab568/docs/preprocessor/preprocess-file.sh
----------------------------------------------------------------------
diff --git a/docs/preprocessor/preprocess-file.sh b/docs/preprocessor/preprocess-file.sh
index fdc4799..4159b4e 100755
--- a/docs/preprocessor/preprocess-file.sh
+++ b/docs/preprocessor/preprocess-file.sh
@@ -23,9 +23,43 @@ TP_HOME=`pwd`
 CONSOLE_HOME=$1
 AWK_SCRIPTS="${TP_HOME}/docs/preprocessor/awk"
 
-input=$2
+IFS=',' read -r -a DRYRUN_DOCS <<< "$2"
+IFS=',' read -r -a FULLRUN_DOCS <<< "$3"
+
+dryRun () {
+  local doc
+  yes=0
+  no=1
+  doDryRun=${no}
+  if [ "${DRYRUN_DOCS}" == "*" ]; then
+    doDryRun=${yes}
+  else
+    for doc in "${DRYRUN_DOCS[@]}"; do
+      if [ "${doc}" == "$1" ]; then
+        doDryRun=${yes}
+        break
+      fi
+    done
+  fi
+  if [ ${doDryRun} ]; then
+    for doc in "${FULLRUN_DOCS[@]}"; do
+      if [ "${doc}" == "$1" ]; then
+        doDryRun=${no}
+        break
+      fi
+    done
+  fi
+  return ${doDryRun}
+}
+
+input=$4
 output=`sed 's@/docs/src/@/target/postprocess-asciidoc/@' <<< "${input}"`
 
+SKIP=
+if dryRun `basename ${input} .asciidoc`; then
+  SKIP=1
+fi
+
 mkdir -p `dirname ${output}`
 
 if hash stdbuf 2> /dev/null; then
@@ -50,7 +84,7 @@ echo " * source:   ${input}"
 echo "   target:   ${output}"
 echo -ne "   progress: initializing"
 
-if [ $(grep -c '^\[gremlin' ${input}) -gt 0 ]; then
+if [ ! ${SKIP} ] && [ $(grep -c '^\[gremlin' ${input}) -gt 0 ]; then
   if [ ${output} -nt ${input} ]; then
     processed
     exit 0

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/83fab568/docs/preprocessor/preprocess.sh
----------------------------------------------------------------------
diff --git a/docs/preprocessor/preprocess.sh b/docs/preprocessor/preprocess.sh
index cb7ab22..a3b6172 100755
--- a/docs/preprocessor/preprocess.sh
+++ b/docs/preprocessor/preprocess.sh
@@ -19,36 +19,42 @@
 # under the License.
 #
 
+DRYRUN_DOCS="$1"
+FULLRUN_DOCS="$2"
+
 pushd "$(dirname $0)/../.." > /dev/null
 
-if [ ! -f bin/gremlin.sh ]; then
-  echo "Gremlin REPL is not available. Cannot preprocess AsciiDoc files."
-  popd > /dev/null
-  exit 1
-fi
+if [ "${DRYRUN_DOCS}" != "" ]; then
 
-for daemon in "NameNode" "DataNode" "ResourceManager" "NodeManager"
-do
-  running=`jps | cut -d ' ' -f2 | grep -c ${daemon}`
-  if [ ${running} -eq 0 ]; then
-    echo "Hadoop is not running, be sure to start it before processing the docs."
+  if [ ! -f bin/gremlin.sh ]; then
+    echo "Gremlin REPL is not available. Cannot preprocess AsciiDoc files."
+    popd > /dev/null
     exit 1
   fi
-done
 
-netstat -an | awk '{print $4}' | grep -o '[0-9]*$' | grep 8182 > /dev/null &&
{
-  echo "The port 8182 is required for Gremlin Server, but already in use. Be sure to close
the application that currently uses the port before processing the docs."
-  exit 1
-}
+  for daemon in "NameNode" "DataNode" "ResourceManager" "NodeManager"
+  do
+    running=`jps | cut -d ' ' -f2 | grep -c ${daemon}`
+    if [ ${running} -eq 0 ]; then
+      echo "Hadoop is not running, be sure to start it before processing the docs."
+      exit 1
+    fi
+  done
 
-if [ -e /tmp/neo4j ]; then
-  echo "The directory '/tmp/neo4j' is required by the pre-processor, be sure to delete it
before processing the docs."
-  exit 1
-fi
+  netstat -an | awk '{print $4}' | grep -o '[0-9]*$' | grep 8182 > /dev/null &&
{
+    echo "The port 8182 is required for Gremlin Server, but already in use. Be sure to close
the application that currently uses the port before processing the docs."
+    exit 1
+  }
 
-if [ -e /tmp/tinkergraph.kryo ]; then
-  echo "The file '/tmp/tinkergraph.kryo' is required by the pre-processor, be sure to delete
it before processing the docs."
-  exit 1
+  if [ -e /tmp/neo4j ]; then
+    echo "The directory '/tmp/neo4j' is required by the pre-processor, be sure to delete
it before processing the docs."
+    exit 1
+  fi
+
+  if [ -e /tmp/tinkergraph.kryo ]; then
+    echo "The file '/tmp/tinkergraph.kryo' is required by the pre-processor, be sure to delete
it before processing the docs."
+    exit 1
+  fi
 fi
 
 function directory {
@@ -70,8 +76,7 @@ TMP_DIR="/tmp/tp-docs-preprocessor"
 
 mkdir -p "${TMP_DIR}"
 
-HISTORY_FILE=`find . -name Console.groovy | xargs grep HISTORY_FILE | head -n1 | cut -d '='
-f2 | xargs echo`
-[ ${HISTORY_FILE} ] || HISTORY_FILE=".gremlin_groovy_history"
+HISTORY_FILE=".gremlin_groovy_history"
 [ -f ~/${HISTORY_FILE} ] && cp ~/${HISTORY_FILE} ${TMP_DIR}
 
 pushd gremlin-server/target/apache-gremlin-server-*-standalone > /dev/null
@@ -92,19 +97,23 @@ function cleanup() {
 
 trap cleanup EXIT
 
-# install plugins
-echo
-echo "=========================="
-echo "+   Installing Plugins   +"
-echo "=========================="
-echo
-cp ${CONSOLE_HOME}/ext/plugins.txt ${TMP_DIR}/plugins.txt.orig
-docs/preprocessor/install-plugins.sh "${CONSOLE_HOME}" "${TP_VERSION}" "${TMP_DIR}"
+if [ "${DRYRUN_DOCS}" != "*" ]; then
 
-if [ $? -ne 0 ]; then
-  exit 1
-else
+  # install plugins
+  echo
+  echo "=========================="
+  echo "+   Installing Plugins   +"
+  echo "=========================="
   echo
+  cp ${CONSOLE_HOME}/ext/plugins.txt ${TMP_DIR}/plugins.txt.orig
+  docs/preprocessor/install-plugins.sh "${CONSOLE_HOME}" "${TP_VERSION}" "${TMP_DIR}"
+
+  if [ $? -ne 0 ]; then
+    exit 1
+  else
+    echo
+  fi
+
 fi
 
 # process *.asciidoc files
@@ -126,7 +135,7 @@ find "${TP_HOME}/docs/src/" -name index.asciidoc | xargs -n1 dirname |
while rea
          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}"
+         xargs -n1 ${TP_HOME}/docs/preprocessor/preprocess-file.sh "${CONSOLE_HOME}" "${DRYRUN_DOCS}"
"${FULLRUN_DOCS}"
 
     ps=(${PIPESTATUS[@]})
     for i in {0..7}; do

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/83fab568/docs/src/dev/developer/contributing.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/developer/contributing.asciidoc b/docs/src/dev/developer/contributing.asciidoc
index 6d87fc8..103a132 100644
--- a/docs/src/dev/developer/contributing.asciidoc
+++ b/docs/src/dev/developer/contributing.asciidoc
@@ -80,6 +80,8 @@ mvn -Dmaven.javadoc.skip=true --projects tinkergraph-gremlin test
 * Check license headers are present: `mvn apache-rat:check`
 * Build AsciiDocs (Hadoop must be running and link:http://www.grymoire.com/Unix/Awk.html[awk]
version `4.0.1` is required): `bin/process-docs.sh`
 ** Build AsciiDocs (but don't evaluate code blocks): `bin/process-docs.sh --dryRun`
+** Build AsciiDocs (but don't evaluate code blocks in specific files): `bin/process-docs.sh
--dryRun the-graph,the-traversal,...`
+** Build AsciiDocs (but evaluate code blocks only in specific files): `bin/process-docs.sh
--fullRun the-graph,the-traversal,...`
 ** Process a single AsciiDoc file: +pass:[docs/preprocessor/preprocess-file.sh `pwd`/gremlin-console/target/apache-gremlin-console-*-standalone
`pwd`/docs/src/xyz.asciidoc]+
 * Build JavaDocs: `mvn process-resources -Djavadoc`
 * Check for Apache License headers: `mvn apache-rat:check`


Mime
View raw message