Class: Buildr::Run::RunTask
- Inherits:
-
Rake::Task
- Object
- Rake::Task
- Buildr::Run::RunTask
- Defined in:
- lib/buildr/run.rb
Instance Attribute Summary collapse
-
#classpath ⇒ Object
Classpath dependencies.
-
#files ⇒ Object
readonly
Returns file dependencies.
-
#options ⇒ Object
readonly
Returns the run options.
-
#project ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
-
#initialize(*args) ⇒ RunTask
constructor
:nodoc:.
-
#prerequisites ⇒ Object
:nodoc:.
-
#requires(*files) ⇒ Object
:call-seq: requires(*files) => self.
- #run ⇒ Object
- #runner ⇒ Object
- #runner? ⇒ Boolean
-
#using(*args) ⇒ Object
:call-seq: using(options) => self.
-
#with(*specs) ⇒ Object
:call-seq: with(*artifacts) => self.
Methods inherited from Rake::Task
#invoke, #invoke_with_call_chain
Constructor Details
#initialize(*args) ⇒ RunTask
:nodoc:
82 83 84 85 86 87 |
# File 'lib/buildr/run.rb', line 82 def initialize(*args) # :nodoc: super @options = {} @classpath = [] @files = FileList[] end |
Instance Attribute Details
#classpath ⇒ Object
Classpath dependencies.
72 73 74 |
# File 'lib/buildr/run.rb', line 72 def classpath @classpath end |
#files ⇒ Object (readonly)
Returns file dependencies
78 79 80 |
# File 'lib/buildr/run.rb', line 78 def files @files end |
#options ⇒ Object (readonly)
Returns the run options.
75 76 77 |
# File 'lib/buildr/run.rb', line 75 def @options end |
Instance Method Details
#prerequisites ⇒ Object
:nodoc:
142 143 144 |
# File 'lib/buildr/run.rb', line 142 def prerequisites #:nodoc: super + @files + classpath end |
#requires(*files) ⇒ Object
:call-seq:
requires(*files) => self
Adds additional files and directories as dependencies to the task and returns self. When specifying a directory, includes all files in that directory.
121 122 123 124 |
# File 'lib/buildr/run.rb', line 121 def requires(*files) @files.include *files.flatten.compact self end |
#run ⇒ Object
138 139 140 |
# File 'lib/buildr/run.rb', line 138 def run runner.run(self) if runner? end |
#runner ⇒ Object
126 127 128 |
# File 'lib/buildr/run.rb', line 126 def runner @runner ||= guess_runner end |
#runner? ⇒ Boolean
130 131 132 133 134 135 136 |
# File 'lib/buildr/run.rb', line 130 def runner? @runner ||= begin guess_runner if project.compile.language rescue nil end end |
#using(*args) ⇒ Object
:call-seq:
using() => self
Sets the run options from a hash and returns self.
For example:
run.using :main=>'org.example.Main'
105 106 107 108 109 110 111 112 113 114 |
# 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 |