Class: LocalCI::Task
- Inherits:
-
Object
- Object
- LocalCI::Task
- Extended by:
- Forwardable
- Defined in:
- lib/local_ci/task.rb
Instance Attribute Summary collapse
-
#task ⇒ Object
Returns the value of attribute task.
Class Method Summary collapse
Instance Method Summary collapse
- #add_prerequisite(prerequisite) ⇒ Object
- #define(&block) ⇒ Object
-
#initialize(task, comment: nil, parallel_prerequisites: false) ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(task, comment: nil, parallel_prerequisites: false) ⇒ Task
Returns a new instance of Task.
15 16 17 18 19 20 |
# File 'lib/local_ci/task.rb', line 15 def initialize(task, comment: nil, parallel_prerequisites: false) @parallel_prerequisites = parallel_prerequisites klass.define_task(task) unless klass.task_defined?(task) @task = klass[task] @task.comment = comment if comment end |
Instance Attribute Details
#task ⇒ Object
Returns the value of attribute task.
11 12 13 |
# File 'lib/local_ci/task.rb', line 11 def task @task end |
Class Method Details
.[](task, comment = nil, &block) ⇒ Object
5 6 7 8 9 |
# File 'lib/local_ci/task.rb', line 5 def self.[](task, comment = nil, &block) new_task = new(task, comment: comment) new_task.define(&block) if block_given? new_task end |
Instance Method Details
#add_prerequisite(prerequisite) ⇒ Object
22 23 24 25 |
# File 'lib/local_ci/task.rb', line 22 def add_prerequisite(prerequisite) return if prerequisites.include?(prerequisite) prerequisites << prerequisite end |
#define(&block) ⇒ Object
27 28 29 30 31 |
# File 'lib/local_ci/task.rb', line 27 def define(&block) ::Rake::Task.define_task(@task.to_s) do block.call end end |