Class: CapistranoMulticonfigParallel::RakeTaskHooks

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano_multiconfig_parallel/classes/rake_task_hooks.rb

Overview

class used to handle the rake worker and sets all the hooks before and after running the worker

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env, task) ⇒ RakeTaskHooks

Returns a new instance of RakeTaskHooks.



8
9
10
11
# File 'lib/capistrano_multiconfig_parallel/classes/rake_task_hooks.rb', line 8

def initialize(env, task)
  @env = env
  @task = task
end

Instance Attribute Details

#envObject

Returns the value of attribute env.



7
8
9
# File 'lib/capistrano_multiconfig_parallel/classes/rake_task_hooks.rb', line 7

def env
  @env
end

#taskObject

Returns the value of attribute task.



7
8
9
# File 'lib/capistrano_multiconfig_parallel/classes/rake_task_hooks.rb', line 7

def task
  @task
end

Instance Method Details

#automatic_hooks(&block) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/capistrano_multiconfig_parallel/classes/rake_task_hooks.rb', line 13

def automatic_hooks(&block)
  if job_id.present?
    actor_start_working
    actor.wait_execution until actor.task_approved
    actor_execute_block(&block)
  else
    block.call
  end
end