Author: boisvert
Date: Thu Oct 21 16:43:16 2010
New Revision: 1026062

URL: http://svn.apache.org/viewvc?rev=1026062&view=rev
Log:
Move clojure shell to buildr/clojure/shell.rb, refactor dependencies

Added:
    buildr/trunk/lib/buildr/clojure/
    buildr/trunk/lib/buildr/clojure/shell.rb
Modified:
    buildr/trunk/lib/buildr/core/shell.rb
    buildr/trunk/spec/sandbox.rb

Added: buildr/trunk/lib/buildr/clojure/shell.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/clojure/shell.rb?rev=1026062&view=auto
==============================================================================
--- buildr/trunk/lib/buildr/clojure/shell.rb (added)
+++ buildr/trunk/lib/buildr/clojure/shell.rb Thu Oct 21 16:43:16 2010
@@ -0,0 +1,52 @@
+# 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.
+
+module Buildr::Shell
+
+  class Clojure < Base
+    include JRebel
+
+    specify :name => :clj, :lang => :clojure
+
+    # don't build if it's *only* Clojure sources
+    def build?
+      !has_source?(:clojure) or has_source?(:java) or has_source?(:scala) or 
has_source?(:groovy)
+    end
+
+    def launch(task)
+      cp = project.compile.dependencies +
+           ::Buildr::Clojure.dependencies +
+           [ build? ? project.path_to(:target, :classes) : 
project.path_to(:src, :main, :clojure) ]
+
+      Java::Commands.java 'jline.ConsoleRunner', 'clojure.lang.Repl', {
+        :properties => jrebel_props(project).merge(task.properties),
+        :classpath => cp,
+        :java_args => jrebel_args + task.java_args
+      }
+    end
+
+  private
+    def clojure_home
+      @home ||= ENV['CLOJURE_HOME']
+    end
+
+    def has_source?(lang)
+      File.exists? project.path_to(:src, :main, lang)
+    end
+  end
+end
+
+Buildr::Shell.providers << Buildr::Shell::Clojure
+

Modified: buildr/trunk/lib/buildr/core/shell.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/shell.rb?rev=1026062&r1=1026061&r2=1026062&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/shell.rb (original)
+++ buildr/trunk/lib/buildr/core/shell.rb Thu Oct 21 16:43:16 2010
@@ -19,6 +19,7 @@ require 'buildr/java/commands'
 require 'buildr/core/util'
 
 module Buildr
+
   module Shell
 
     class BeanShell < Base
@@ -128,55 +129,9 @@ module Buildr
       end
 
     end
-
-    class Clojure < Base
-      include JRebel
-
-      JLINE_VERSION = '0.9.94'
-
-      class << self
-        def lang
-          :none
-        end
-
-        def to_sym
-          :clj      # more common than `clojure`
-        end
-      end
-
-      # don't build if it's *only* Clojure sources
-      def build?
-        !has_source?(:clojure) or has_source?(:java) or has_source?(:scala) or 
has_source?(:groovy)
-      end
-
-      def launch(task)
-        clojure_jar = clojure_home ? File.expand_path('clojure.jar', 
clojure_home) : "org.clojure:clojure:jar:1.2.0"
-
-        cp = project.compile.dependencies +
-          [ build? ? project.path_to(:target, :classes) : 
project.path_to(:src, :main, :clojure),
-            clojure_jar,
-            'jline:jline:jar:0.9.94'
-          ] + task.classpath
-
-        Java::Commands.java 'jline.ConsoleRunner', 'clojure.lang.Repl', {
-          :properties => jrebel_props(project).merge(task.properties),
-          :classpath => cp,
-          :java_args => jrebel_args + task.java_args
-        }
-      end
-
-    private
-      def clojure_home
-        @home ||= ENV['CLOJURE_HOME']
-      end
-
-      def has_source?(lang)
-        File.exists? project.path_to(:src, :main, lang)
-      end
-    end
   end
 end
 
 Buildr::Shell.providers << Buildr::Shell::BeanShell
 Buildr::Shell.providers << Buildr::Shell::JIRB
-Buildr::Shell.providers << Buildr::Shell::Clojure
+

Modified: buildr/trunk/spec/sandbox.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/spec/sandbox.rb?rev=1026062&r1=1026061&r2=1026062&view=diff
==============================================================================
--- buildr/trunk/spec/sandbox.rb (original)
+++ buildr/trunk/spec/sandbox.rb Thu Oct 21 16:43:16 2010
@@ -25,6 +25,7 @@ repositories.remote << 'http://scala-too
 Buildr.settings.build['scala.version'] = "2.8.0"
 
 # Add a 'require' here only for optional extensions, not for extensions that 
should be loaded by default.
+require 'buildr/clojure'
 require 'buildr/groovy'
 require 'buildr/scala'
 


Reply via email to