Class: Buildr::Shell::Clojure

Inherits:
Base show all
Includes:
JavaRebel
Defined in:
lib/buildr/core/shell.rb

Constant Summary collapse

JLINE_VERSION =
'0.9.94'

Instance Attribute Summary

Attributes inherited from Base

#project

Class Method Summary collapse

Instance Method Summary collapse

Methods included from JavaRebel

#rebel_args, #rebel_home, #rebel_props

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Buildr::Shell::Base

Class Method Details

.langObject



145
146
147
# File 'lib/buildr/core/shell.rb', line 145

def lang
  :none
end

.to_symObject



149
150
151
# File 'lib/buildr/core/shell.rb', line 149

def to_sym
  :clj      # more common than `clojure`
end

Instance Method Details

#build?Boolean

don’t build if it’s only Clojure sources

Returns:

  • (Boolean)


155
156
157
# File 'lib/buildr/core/shell.rb', line 155

def build?
  !has_source?(:clojure) or has_source?(:java) or has_source?(:scala) or has_source?(:groovy)
end

#launchObject



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/buildr/core/shell.rb', line 159

def launch
  fail 'Are we forgetting something? CLOJURE_HOME not set.' unless clojure_home
  
  cp = project.compile.dependencies + 
    [
      if build?
        project.path_to(:target, :classes)
      else
        project.path_to(:src, :main, :clojure)
      end,
      File.expand_path('clojure.jar', clojure_home),
      'jline:jline:jar:0.9.94'
    ]
  
  if build?
    Java::Commands.java 'jline.ConsoleRunner', 'clojure.lang.Repl', {
      :properties => rebel_props(project),
      :classpath => cp,
      :java_args => rebel_args
    }
  else
    Java::Commands.java 'jline.ConsoleRunner', 'clojure.lang.Repl', :classpath => cp
  end
end