You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2008/05/30 07:13:59 UTC

svn commit: r661567 - in /hadoop/hbase/trunk/bin: hbase hirb.rb

Author: stack
Date: Thu May 29 22:13:58 2008
New Revision: 661567

URL: http://svn.apache.org/viewvc?rev=661567&view=rev
Log:
HBASE-487 Replace hql w/ a hbase-friendly jirb or jython shell: Part 2 Add in help and version

Added:
    hadoop/hbase/trunk/bin/hirb.rb
Modified:
    hadoop/hbase/trunk/bin/hbase

Modified: hadoop/hbase/trunk/bin/hbase
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/bin/hbase?rev=661567&r1=661566&r2=661567&view=diff
==============================================================================
--- hadoop/hbase/trunk/bin/hbase (original)
+++ hadoop/hbase/trunk/bin/hbase Thu May 29 22:13:58 2008
@@ -183,7 +183,7 @@
 
 # figure out which class to run
 if [ "$COMMAND" = "shell" ] ; then
-  CLASS='org.jruby.Main --command irb'
+  CLASS="org.jruby.Main --command irb -r${HBASE_HOME}/bin/hirb.rb"
 elif [ "$COMMAND" = "master" ] ; then
   CLASS='org.apache.hadoop.hbase.master.HMaster'
 elif [ "$COMMAND" = "regionserver" ] ; then

Added: hadoop/hbase/trunk/bin/hirb.rb
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/bin/hirb.rb?rev=661567&view=auto
==============================================================================
--- hadoop/hbase/trunk/bin/hirb.rb (added)
+++ hadoop/hbase/trunk/bin/hirb.rb Thu May 29 22:13:58 2008
@@ -0,0 +1,30 @@
+# Some goodies for hirb
+require 'irb/completion'
+
+# Run the java magic include and import basic HBase types.
+include Java
+import org.apache.hadoop.hbase.HBaseConfiguration
+import org.apache.hadoop.hbase.client.HTable
+import org.apache.hadoop.hbase.client.HBaseAdmin
+import org.apache.hadoop.hbase.HColumnDescriptor
+import org.apache.hadoop.hbase.HConstants
+import org.apache.hadoop.hbase.HTableDescriptor
+import org.apache.hadoop.hbase.io.BatchUpdate
+
+# Set the irb shell name to be hbase.
+IRB.conf[:IRB_NAME] = "hbase"
+
+# TODO: Read from environment which outputter to use (outputter should
+# be able to output to a passed Stream as well as STDIN and STDOUT)
+
+
+def help
+    puts 'HBase Commands:'
+    puts ' version   Output the hbase version'
+end
+
+def version
+    puts "HBase Version: #{org.apache.hadoop.hbase.util.VersionInfo.getVersion()}"
+    puts "SVN Revision: #{org.apache.hadoop.hbase.util.VersionInfo.getRevision()}"
+    puts "HBase Compiled: #{org.apache.hadoop.hbase.util.VersionInfo.getDate()}"
+end