Repository: hbase
Updated Branches:
  refs/heads/master c38bf1244 -> b67f6fecc


HBASE-15199 (addendum) - When JRUBY_HOME is specified, update CLASSPATH and 
HBASE_OPTS when jruby is needed

Signed-off-by: Sean Busbey <[email protected]>
Signed-off-by: tedyu <[email protected]>
Signed-off-by: Jerry He <[email protected]>


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

Branch: refs/heads/master
Commit: b67f6fecc173ff1272284f3e47f95d493fab331d
Parents: c38bf12
Author: Xiang Li <[email protected]>
Authored: Sat May 6 11:37:13 2017 +0800
Committer: Sean Busbey <[email protected]>
Committed: Tue May 9 16:12:45 2017 -0500

----------------------------------------------------------------------
 bin/hbase     | 52 +++++++++++++++++++++++++++-------------------------
 bin/hbase.cmd | 44 ++++++++++++++++++++++++--------------------
 2 files changed, 51 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/b67f6fec/bin/hbase
----------------------------------------------------------------------
diff --git a/bin/hbase b/bin/hbase
index 579c413..fa70f6e 100755
--- a/bin/hbase
+++ b/bin/hbase
@@ -294,32 +294,34 @@ if [ "$AUTH_AS_SERVER" == "true" ] || [ "$COMMAND" = 
"hbck" ]; then
 fi
 
 # for jruby
-# (1) when JRUBY_HOME is specified explicitly, eg. export 
JRUBY_HOME=/usr/local/share/jruby
-#     for all commands, CLASSPATH and HBASE_OPTS are updated according to 
JRUBY_HOME specified
-# (2) when JRUBY_HOME is not specified explicitly
-#     A. for jruby_cmds defined below, add JRUBY_PACKAGED_WITH_HBASE into 
CLASSPATH
-#     B. for other commands, do nothing
-
-if [ "$JRUBY_HOME" != "" ]; then  # JRUBY_HOME is specified explicitly, eg. 
export JRUBY_HOME=/usr/local/share/jruby
-  # add jruby.jar into CLASSPATH
-  CLASSPATH="$JRUBY_HOME/lib/jruby.jar:$CLASSPATH"
-
-  # add jruby to HBASE_OPTS
-  HBASE_OPTS="$HBASE_OPTS -Djruby.home=$JRUBY_HOME -Djruby.lib=$JRUBY_HOME/lib"
-
-else  # JRUBY_HOME is not specified explicitly
-  # check if the commmand needs jruby
-  declare -a jruby_cmds=("shell" "org.jruby.Main")
-  for cmd in "${jruby_cmds[@]}"; do
-    if [[ $cmd == "$COMMAND" ]]; then
-      jruby_needed=true
-      break
-    fi
-  done
+# (1) for the commands which need jruby (see jruby_cmds defined below)
+#     A. when JRUBY_HOME is specified explicitly, eg. export 
JRUBY_HOME=/usr/local/share/jruby
+#        CLASSPATH and HBASE_OPTS are updated according to JRUBY_HOME specified
+#     B. when JRUBY_HOME is not specified explicitly
+#        add jruby packaged with HBase to CLASSPATH
+# (2) for other commands, do nothing
+
+# check if the commmand needs jruby
+declare -a jruby_cmds=("shell" "org.jruby.Main")
+for cmd in "${jruby_cmds[@]}"; do
+  if [[ $cmd == "$COMMAND" ]]; then
+    jruby_needed=true
+    break
+  fi
+done
+
+# the command needs jruby
+if [[ $jruby_needed ]]; then
+  if [ "$JRUBY_HOME" != "" ]; then  # JRUBY_HOME is specified explicitly, eg. 
export JRUBY_HOME=/usr/local/share/jruby
+    # add jruby.jar into CLASSPATH
+    CLASSPATH="$JRUBY_HOME/lib/jruby.jar:$CLASSPATH"
+
+    # add jruby to HBASE_OPTS
+    HBASE_OPTS="$HBASE_OPTS -Djruby.home=$JRUBY_HOME 
-Djruby.lib=$JRUBY_HOME/lib"
 
-  # add JRUBY_PACKAGED_WITH_HBASE to CLASSPATH when jruby is needed
-  JRUBY_PACKAGED_WITH_HBASE="$HBASE_HOME/lib/ruby/*.jar"
-  if [[ $jruby_needed ]]; then  # the command needs jruby
+  else  # JRUBY_HOME is not specified explicitly
+    # add jruby packaged with HBase to CLASSPATH
+    JRUBY_PACKAGED_WITH_HBASE="$HBASE_HOME/lib/ruby/*.jar"
     for jruby_jar in $JRUBY_PACKAGED_WITH_HBASE; do
       CLASSPATH=$jruby_jar:$CLASSPATH;
     done

http://git-wip-us.apache.org/repos/asf/hbase/blob/b67f6fec/bin/hbase.cmd
----------------------------------------------------------------------
diff --git a/bin/hbase.cmd b/bin/hbase.cmd
index 44cb9d3..67a3bc1 100644
--- a/bin/hbase.cmd
+++ b/bin/hbase.cmd
@@ -263,30 +263,34 @@ if defined service_entry (
 )
 
 @rem for jruby
-@rem (1) when JRUBY_HOME is defined
-@rem     for all commands, CLASSPATH and HBASE_OPTS are updated according to 
JRUBY_HOME specified
-@rem (2) when JRUBY_HOME is not defined
-@rem     A. for jruby-commands defined below, add JRUBY_PACKAGED_WITH_HBASE 
into CLASSPATH
-@rem     B. for other commands, do nothing
-
-@rem JRUBY_HOME is defined
-if defined JRUBY_HOME (
-  set CLASSPATH=%CLASSPATH%;%JRUBY_HOME%\lib\jruby.jar
-  set HBASE_OPTS=%HBASE_OPTS% -Djruby.home="%JRUBY_HOME%" 
-Djruby.lib="%JRUBY_HOME%\lib"
+@rem (1) for the commands which need jruby (see jruby-commands defined below)
+@rem     A. when JRUBY_HOME is defined
+@rem        CLASSPATH and HBASE_OPTS are updated according to JRUBY_HOME 
defined
+@rem     B. when JRUBY_HOME is not defined
+@rem        add jruby packaged with HBase to CLASSPATH
+@rem (2) for other commands, do nothing
+
+@rem check if the commmand needs jruby
+set jruby-commands=shell org.jruby.Main
+for %%i in ( %jruby-commands% ) do (
+  if "%hbase-command%"=="%%i" set jruby-needed=true
 )
 
-@rem JRUBY_HOME is not defined
-if not defined JRUBY_HOME (
-  @rem check if the commmand needs jruby
-  set jruby-commands=shell org.jruby.Main
-  for %%i in ( !jruby-commands! ) do (
-    if "%hbase-command%"=="%%i" set jruby-needed=true
+@rem the command needs jruby
+if defined jruby-needed (
+  @rem JRUBY_HOME is defined
+  if defined JRUBY_HOME (
+    set CLASSPATH=%JRUBY_HOME%\lib\jruby.jar;%CLASSPATH%
+    set HBASE_OPTS=%HBASE_OPTS% -Djruby.home="%JRUBY_HOME%" 
-Djruby.lib="%JRUBY_HOME%\lib"
   )
 
-  @rem add JRUBY_PACKAGED_WITH_HBASE to CLASSPATH if jruby is needed
-  set JRUBY_PACKAGED_WITH_HBASE=%HBASE_HOME%\lib\ruby\*
-  if defined jruby-needed (
-    set CLASSPATH=!JRUBY_PACKAGED_WITH_HBASE!;!CLASSPATH!
+  @rem JRUBY_HOME is not defined
+  if not defined JRUBY_HOME (
+    @rem add jruby packaged with HBase to CLASSPATH
+    set JRUBY_PACKAGED_WITH_HBASE=%HBASE_HOME%\lib\ruby\*
+    if defined jruby-needed (
+      set CLASSPATH=!JRUBY_PACKAGED_WITH_HBASE!;!CLASSPATH!
+    )
   )
 )
 

Reply via email to