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: handle user defined plugin directories
Date Wed, 23 Mar 2016 12:13:50 GMT
Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1109 af827fb18 -> 7d3731b25


handle user defined plugin directories


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

Branch: refs/heads/TINKERPOP-1109
Commit: 7d3731b258ee2b185242ca3e6d04993310c98d05
Parents: af827fb
Author: Daniel Kuppitz <daniel_kuppitz@hotmail.com>
Authored: Wed Mar 23 13:13:12 2016 +0100
Committer: Daniel Kuppitz <daniel_kuppitz@hotmail.com>
Committed: Wed Mar 23 13:13:12 2016 +0100

----------------------------------------------------------------------
 gremlin-console/src/main/bin/gremlin.sh | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7d3731b2/gremlin-console/src/main/bin/gremlin.sh
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/bin/gremlin.sh b/gremlin-console/src/main/bin/gremlin.sh
index c592117..215e69f 100755
--- a/gremlin-console/src/main/bin/gremlin.sh
+++ b/gremlin-console/src/main/bin/gremlin.sh
@@ -22,6 +22,17 @@
 set -e
 set -u
 
+DIR="$( cd -P "$( dirname "$0" )" && pwd )"
+SYSTEM_EXT_DIR="${DIR}/../ext"
+
+if [ ! -z "${JAVA_OPTIONS}" ]; then
+  USER_EXT_DIR=$(grep -o '\-Dtinkerpop.ext=\(\([^"][^ ]*\)\|\("[^"]*"\)\)' <<< "${JAVA_OPTIONS}"
| cut -f2 -d '=' | xargs -0 echo)
+  if [ ! -z "${USER_EXT_DIR}" -a ! -d "${USER_EXT_DIR}" ]; then
+    mkdir -p "${USER_EXT_DIR}"
+    cp -R ${SYSTEM_EXT_DIR}/* ${USER_EXT_DIR}/
+  fi
+fi
+
 case `uname` in
   CYGWIN*)
     CP="`dirname $0`"/../config
@@ -38,9 +49,9 @@ while [ -h "$SOURCE" ]; do
   SOURCE="$(readlink "$SOURCE")"
   [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
 done
-DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-CP=$CP:$( find -L "$DIR"/../ext -mindepth 1 -maxdepth 1 -type d | \
-          sort | sed 's/$/\/plugin\/*/' | tr '\n' ':' )
+
+CP=$CP:$( find -L "${SYSTEM_EXT_DIR}" "${USER_EXT_DIR:-${SYSTEM_EXT_DIR}}" -mindepth 1 -maxdepth
1 -type d | \
+          sort -u | sed 's/$/\/plugin\/*/' | tr '\n' ':' )
 
 export CLASSPATH="${CLASSPATH:-}:$CP"
 
@@ -87,9 +98,8 @@ done
 # Remove processed options from $@. Anything after -e is preserved by the break;; in the
case
 shift $(( $OPTIND - 1 ))
 
-if [ -z "${JAVA_OPTIONS:-}" ]; then
-    JAVA_OPTIONS="-Dtinkerpop.ext=$DIR/../ext -Dlog4j.configuration=conf/log4j-console.properties
-Dgremlin.log4j.level=$GREMLIN_LOG_LEVEL"
-fi
+JAVA_OPTIONS="${JAVA_OPTIONS} -Dtinkerpop.ext=${USER_EXT_DIR:-${SYSTEM_EXT_DIR}} -Dlog4j.configuration=conf/log4j-console.properties
-Dgremlin.log4j.level=$GREMLIN_LOG_LEVEL"
+JAVA_OPTIONS=$(awk -vRS=' ' '!/^$/ {if (!x[$0]++) print}' <<< "${JAVA_OPTIONS}"
| grep -v '^$' | paste -sd ' ' -)
 
 if [ -n "$SCRIPT_DEBUG" ]; then
     echo "CLASSPATH: $CLASSPATH"


Mime
View raw message