Class: RGitFlow::Tasks::Task
- Includes:
- Printing
- Defined in:
- lib/rgitflow/tasks/task.rb
Direct Known Subclasses
Feature::Finish, Feature::Start, Hotfix::Finish, Hotfix::Start, Release::Finish, Release::Start, SCM::Status
Constant Summary
Constants included from Printing
Printing::DEBUG_PREFIX, Printing::ERROR_PREFIX, Printing::INPUT_PREFIX, Printing::STATUS_PREFIX
Instance Attribute Summary collapse
-
#after ⇒ Proc
Runs a +Proc+ after the task.
-
#before ⇒ Proc
Runs a +Proc+ before the task.
-
#description ⇒ String
The description of the task.
-
#name ⇒ String
The name of the task.
-
#namespaces ⇒ Array<String>
The namespaces of the task.
Instance Method Summary collapse
- #define ⇒ Object protected
-
#initialize(git, name, description, namespaces = ['rgitflow']) {|_self| ... } ⇒ Task
constructor
A new instance of Task.
- #run ⇒ Object protected
Methods included from Printing
#debug, #error, #prompt, #status
Constructor Details
#initialize(git, name, description, namespaces = ['rgitflow']) {|_self| ... } ⇒ Task
Returns a new instance of Task.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rgitflow/tasks/task.rb', line 30 def initialize(git, name, description, namespaces = ['rgitflow']) @git = git @name = name @description = description @namespaces = namespaces yield self if block_given? define end |
Instance Attribute Details
#after ⇒ Proc
Runs a +Proc+ after the task
28 29 30 |
# File 'lib/rgitflow/tasks/task.rb', line 28 def after @after end |
#before ⇒ Proc
Runs a +Proc+ before the task
24 25 26 |
# File 'lib/rgitflow/tasks/task.rb', line 24 def before @before end |
#description ⇒ String
The description of the task
20 21 22 |
# File 'lib/rgitflow/tasks/task.rb', line 20 def description @description end |
#name ⇒ String
The name of the task
16 17 18 |
# File 'lib/rgitflow/tasks/task.rb', line 16 def name @name end |
#namespaces ⇒ Array<String>
The namespaces of the task
12 13 14 |
# File 'lib/rgitflow/tasks/task.rb', line 12 def namespaces @namespaces end |
Instance Method Details
#define ⇒ Object (protected)
43 44 45 46 47 48 49 50 |
# File 'lib/rgitflow/tasks/task.rb', line 43 def define desc @description unless ::Rake.application.last_comment task([*@namespaces, @name].join(":")) do before.call if before.is_a?(Proc) run after.call if after.is_a?(Proc) end end |
#run ⇒ Object (protected)
52 53 54 |
# File 'lib/rgitflow/tasks/task.rb', line 52 def run raise NotImplementedError end |