tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkupp...@apache.org
Subject [tinkerpop] 11/11: Better fix for the removal of control characters
Date Thu, 10 Jan 2019 15:02:47 GMT
This is an automated email from the ASF dual-hosted git repository.

dkuppitz pushed a commit to branch 3.4.0-doc-fix
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit eaac0ccdaa78429307bb6142f61610be1b9355f7
Author: Daniel Kuppitz <daniel_kuppitz@hotmail.com>
AuthorDate: Wed Jan 9 14:34:01 2019 -0700

    Better fix for the removal of control characters
---
 bin/validate-distribution.sh            |  3 ++-
 docs/preprocessor/control-characters.sh | 25 +++++++++++++++++++++++++
 docs/preprocessor/preprocess-file.sh    |  2 +-
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/bin/validate-distribution.sh b/bin/validate-distribution.sh
index 55cb164..49706b9 100755
--- a/bin/validate-distribution.sh
+++ b/bin/validate-distribution.sh
@@ -23,6 +23,7 @@
 # published KEYS file in order for that aspect of the validation
 # to pass.
 
+SCRIPT_DIR=$(cd `dirname $0` ; pwd)
 TMP_DIR="/tmp/tpdv"
 
 # Required. Only the latest version on each release stream is available on dist.
@@ -194,7 +195,7 @@ if [ "${TYPE}" = "CONSOLE" ]; then
   SCRIPT_FILENAME="test.groovy"
   SCRIPT_PATH="${TMP_DIR}/${SCRIPT_FILENAME}"
   echo ${SCRIPT} > ${SCRIPT_PATH}
-  [[ `bin/gremlin.sh <<< ${SCRIPT} | grep '^==>' | sed -e 's/^==>//'` -eq
6 ]] || { echo "failed to evaluate sample script"; exit 1; }
+  [[ `bin/gremlin.sh <<< ${SCRIPT} | ${SCRIPT_DIR}/../docs/preprocessor/control-characters.sh
| grep '^==>' | sed -e 's/^==>//'` -eq 6 ]] || { echo "failed to evaluate sample script";
exit 1; }
   [[ `bin/gremlin.sh -e ${SCRIPT_PATH}` -eq 6 ]] || { echo "failed to evaluate sample script
using -e option"; exit 1; }
   CONSOLE_DIR=`pwd`
   cd ${TMP_DIR}
diff --git a/docs/preprocessor/control-characters.sh b/docs/preprocessor/control-characters.sh
new file mode 100755
index 0000000..b8336d6
--- /dev/null
+++ b/docs/preprocessor/control-characters.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# The main purpose of this script is to remove control characters
+# that are occasionally hidden in the Groovy console's output
+
+sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g'
diff --git a/docs/preprocessor/preprocess-file.sh b/docs/preprocessor/preprocess-file.sh
index 2a8023d..dbef22f 100755
--- a/docs/preprocessor/preprocess-file.sh
+++ b/docs/preprocessor/preprocess-file.sh
@@ -135,7 +135,7 @@ if [ ! ${SKIP} ] && [ $(grep -c '^\[gremlin' ${input}) -gt 0 ];
then
   awk -f ${AWK_SCRIPTS}/prepare.awk |
   awk -f ${AWK_SCRIPTS}/init-code-blocks.awk -v TP_HOME="${TP_HOME}" -v PYTHONPATH="${TP_HOME}/gremlin-python/target/classes/Lib"
|
   awk -f ${AWK_SCRIPTS}/progressbar.awk -v tpl=${AWK_SCRIPTS}/progressbar.groovy.template
|
-  HADOOP_GREMLIN_LIBS="${CONSOLE_HOME}/ext/tinkergraph-gremlin/lib" bin/gremlin.sh | sed
's/\x1b\[m//g' |
+  HADOOP_GREMLIN_LIBS="${CONSOLE_HOME}/ext/tinkergraph-gremlin/lib" bin/gremlin.sh | ${TP_HOME}/docs/preprocessor/control-characters.sh
|
   ${lb} awk -f ${AWK_SCRIPTS}/ignore.awk   |
   ${lb} awk -f ${AWK_SCRIPTS}/prettify.awk |
   ${lb} awk -f ${AWK_SCRIPTS}/cleanup.awk  |


Mime
View raw message