Author: vborja
Date: Sun Jul 26 03:33:04 2009
New Revision: 797861

URL: http://svn.apache.org/viewvc?rev=797861&view=rev
Log:
Added BeanShell console as default shell for Java-only projects.

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/doc/more_stuff.textile
    buildr/trunk/lib/buildr/core/shell.rb

Modified: buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=797861&r1=797860&r2=797861&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Sun Jul 26 03:33:04 2009
@@ -1,4 +1,7 @@
 1.3.5 (Pending)
+* Added:  BeanShell as default shell for java projects, bsh is small and it's
+          syntax provides the closest to an interpreted java. The BeanShell
+          console includes a graphical class browser. Shell is named :bsh
 * Added:  Interactive shell (REPL) support
 * Added:  BUILDR-56 Download Scala artifacts if not available locally
 * Added:  Mandriva (urpmi) installation support (with help from Franck 
Villaume).

Modified: buildr/trunk/doc/more_stuff.textile
URL: 
http://svn.apache.org/viewvc/buildr/trunk/doc/more_stuff.textile?rev=797861&r1=797860&r2=797861&view=diff
==============================================================================
--- buildr/trunk/doc/more_stuff.textile (original)
+++ buildr/trunk/doc/more_stuff.textile Sun Jul 26 03:33:04 2009
@@ -21,7 +21,7 @@
 
 Unfortunately, for such a tool to be useful in Java, Scala or Groovy 
development, it must have access to the @CLASSPATH@, not only the compiled 
project binaries, but also its full list of dependencies.  While it is usually 
possible with such tools to specify the classpath upon startup (e.g. the @-cp@ 
switch for the Scala shell), this can get extremely tedious for project's with 
more dependencies, especially when some of these dependencies are defined using 
@transitive@ artifacts.
 
-Buildr is capable of easing this workflow by providing full support for the 
configuration and launch of interactive shells.  In fact, if your project uses 
either Scala or Groovy, the relevant shell may be launched simply by invoking 
the @shell@ task:
+Buildr is capable of easing this workflow by providing full support for the 
configuration and launch of interactive shells, the relevant shell may be 
launched simply by invoking the @shell@ task:
 
 {% highlight sh %}
 $ buildr shell
@@ -37,7 +37,7 @@
 
 h3. Supported Shells
 
-By default, Buildr will open the interactive shell which corresponds to your 
project's language.  Thus, if your project is using Groovy, it will invoke the 
@groovysh@ command, configured with the appropriate classpath.  If your project 
is using Scala, then the @shell@ task will invoke the @scala@ command.  
Unfortunately, the Java language does not define an interactive shell of any 
kind, meaning that there is no sane default if your project exclusively uses 
Java.
+By default, Buildr will open the interactive shell which corresponds to your 
project's language.  Thus, if your project is using Groovy, it will invoke the 
@groovysh@ command, configured with the appropriate classpath.  If your project 
is using Scala, then the @shell@ task will invoke the @scala@ command.  
Unfortunately, the Java language does not define an interactive shell of any 
kind, however for those projects using exclusively the Java language, Buildr 
will use the 
"BeanShell":http://www.beanshell.org/manual/quickstart.html#The_BeanShell_GUI 
console.
 
 However, you may still wish to exploit the advantages of an interactive shell 
from some other JVM language even while working in Java.  Alternatively, you 
may want to use some shell other than the default even when working in a 
language which has its own.  There are two ways to acheive this aim.  The 
quickest way is to explicitly specify the relevant shell at the call-site:
 
@@ -70,6 +70,7 @@
 Buildr supports several different shell providers, and the framework is 
flexible enough that additional support can be added almost trivially.  The 
following table gives the complete list of supported shells, their 
corresponding @shell.using@ descriptor and the language for which they are the 
default (if applicable):
 
 |_. Shell Name        |_. Descriptor       |_. Language       |
+| BeanShell Console   | @:bsh@             | Java             |
 | Clojure REPL        | @:clj@             | *N/A*            |
 | GroovySH            | @:groovysh@        | Groovy           |
 | JRuby IRB           | @:jirb@            | *N/A*            |

Modified: buildr/trunk/lib/buildr/core/shell.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/shell.rb?rev=797861&r1=797860&r2=797861&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/shell.rb (original)
+++ buildr/trunk/lib/buildr/core/shell.rb Sun Jul 26 03:33:04 2009
@@ -4,6 +4,43 @@
 
 module Buildr
   module Shell
+
+    class BeanShell < Base
+      
+      include JavaRebel
+      
+      VERSION = '2.0b4'
+
+      class << self
+        def version
+          Buildr.settings.build['bsh'] || VERSION
+        end
+        
+        def artifact
+          "org.beanshell:bsh:jar:#{version}"
+        end
+        
+        def lang
+          :java
+        end
+        
+        def to_sym
+          :bsh
+        end
+      end
+      
+      def launch        
+        cp = project.compile.dependencies + 
[Buildr.artifact(BeanShell.artifact)]
+        Java::Commands.java 'bsh.Console', {
+          :properties => rebel_props(project),
+          :classpath => cp,
+          :java_args => rebel_args
+        }
+      end
+      
+    end # BeanShell
+
+        
     class JIRB < Base
       include JavaRebel
       
@@ -134,5 +171,6 @@
   end
 end
 
+Buildr::ShellProviders << Buildr::Shell::BeanShell
 Buildr::ShellProviders << Buildr::Shell::JIRB
 Buildr::ShellProviders << Buildr::Shell::Clojure


Reply via email to