Class: CapistranoMulticonfigParallel::RakeHookActor

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano_multiconfig_parallel/classes/rake_hook_actor.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) ⇒ RakeHookActor

Returns a new instance of RakeHookActor.



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

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

Instance Attribute Details

#env ⇒ Object

Returns the value of attribute env.



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

def env
  @env
end

#task ⇒ Object

Returns the value of attribute task.



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

def task
  @task
end

Instance Method Details

#work(&block) ⇒ Object



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

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