class Buildr::Run::RunTask

Attributes

classpath[RW]

Classpath dependencies.

files[R]

Returns file dependencies

options[R]

Returns the run options.

Public Instance Methods

requires(*files) → self click to toggle source

Adds additional files and directories as dependencies to the task and returns self. When specifying a directory, includes all files in that directory.

# File lib/buildr/run.rb, line 121
def requires(*files)
  @files.include *files.flatten.compact
  self
end
run() click to toggle source
# File lib/buildr/run.rb, line 138
def run
  runner.run(self) if runner?
end
runner() click to toggle source
# File lib/buildr/run.rb, line 126
def runner
  @runner ||= guess_runner
end
runner?() click to toggle source
# File lib/buildr/run.rb, line 130
def runner?
  @runner ||= begin
    guess_runner if project.compile.language
  rescue
    nil
  end
end
using(options) → self click to toggle source

Sets the run options from a hash and returns self.

For example:

run.using :main=>'org.example.Main'
# File lib/buildr/run.rb, line 105
def using(*args)
  args.pop.each { |key, value| @options[key.to_sym] = value } if Hash === args.last

  until args.empty?
    new_runner = Run.select_by_name(args.pop)
    @runner = new_runner.new(project) unless new_runner.nil?
  end

  self
end
with(*artifacts) → self click to toggle source

Adds files and artifacts as classpath dependencies, and returns self.

# File lib/buildr/run.rb, line 93
def with(*specs)
  @classpath |= Buildr.artifacts(specs.flatten).uniq
  self
end