Class: Buildr::Groovy::GroovySH

Inherits:
Shell::Base show all
Includes:
JRebel
Defined in:
lib/buildr/groovy/shell.rb

Constant Summary collapse

SUFFIX =
if Util.win_os? then '.bat' else '' end

Instance Attribute Summary

Attributes inherited from Shell::Base

#project

Instance Method Summary collapse

Methods included from JRebel

#jrebel_args, #jrebel_home, #jrebel_props, #rebel_jar

Methods inherited from Shell::Base

#initialize, specify, to_sym

Constructor Details

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

Instance Method Details

#launch(task) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/buildr/groovy/shell.rb', line 27

def launch(task)
  cp = Groovy.dependencies +
       project.compile.dependencies +
       [ project.path_to(:target, :classes) ] +
       task.classpath
  props = jrebel_props(project).merge(task.properties)
  java_args = jrebel_args + task.java_args

  groovy_home = nil
  if groovy_home
    cmd_args = " -classpath '#{cp.join(File::SEPARATOR)}'"
    trace "groovysh #{cmd_args}"
    system(File.expand_path("bin#{File::SEPARATOR}groovysh#{SUFFIX}", groovy_home) + cmd_args)
  else
    Java::Commands.java 'org.codehaus.groovy.tools.shell.Main', {
      :properties => props,
      :classpath => cp,
      :java_args => java_args
    }
  end
end