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:
83 84 85 86 87 88 |
# File 'lib/buildr/run.rb', line 83 def initialize(*args) # :nodoc: super @options = {} @classpath = [] @files = FileList[] end |
Instance Attribute Details
#classpath ⇒ Object
Classpath dependencies.
73 74 75 |
# File 'lib/buildr/run.rb', line 73 def classpath @classpath end |
#files ⇒ Object (readonly)
Returns file dependencies
79 80 81 |
# File 'lib/buildr/run.rb', line 79 def files @files end |
#options ⇒ Object (readonly)
Returns the run options.
76 77 78 |
# File 'lib/buildr/run.rb', line 76 def @options end |
Instance Method Details
#prerequisites ⇒ Object
:nodoc:
143 144 145 |
# File 'lib/buildr/run.rb', line 143 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.
122 123 124 125 |
# File 'lib/buildr/run.rb', line 122 def requires(*files) @files.include *files.flatten.compact self end |
#run ⇒ Object
139 140 141 |
# File 'lib/buildr/run.rb', line 139 def run runner.run(self) if runner? end |
#runner ⇒ Object
127 128 129 |
# File 'lib/buildr/run.rb', line 127 def runner @runner ||= guess_runner end |
#runner? ⇒ Boolean
131 132 133 134 135 136 137 |
# File 'lib/buildr/run.rb', line 131 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'
106 107 108 109 110 111 112 113 114 115 |
# File 'lib/buildr/run.rb', line 106 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 |