Module: Statistrano::Deployment::Strategy::InvokeTasks

Included in:
Releaser::Revisions, Base
Defined in:
lib/statistrano/deployment/strategy/invoke_tasks.rb

Instance Method Summary collapse

Instance Method Details

#call_or_invoke_task(task, arg = nil) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/statistrano/deployment/strategy/invoke_tasks.rb', line 36

def call_or_invoke_task task, arg=nil
  if task.respond_to? :call
    if arg && task.arity == 2
      task.call self, arg
    elsif task.arity == 1
      task.call self
    else
      task.call
    end
  else
    Rake::Task[task].invoke
  end
rescue Exception => e
  Log.error "exiting due to error in task",
            "#{e.class}: #{e}"
  abort()
end

#invoke_build_taskObject

Run the build_task supplied return [Void]



18
19
20
21
# File 'lib/statistrano/deployment/strategy/invoke_tasks.rb', line 18

def invoke_build_task
  Log.info :build, "Running the build task"
  call_or_invoke_task config.build_task
end

#invoke_post_deploy_taskObject

Run the post_deploy_task return [Void]



9
10
11
12
13
14
# File 'lib/statistrano/deployment/strategy/invoke_tasks.rb', line 9

def invoke_post_deploy_task
  if config.post_deploy_task
    Log.info :post_deploy, "Running the post deploy task"
    call_or_invoke_task config.post_deploy_task
  end
end

Run the pre_symlink_task if supplied return [Void]



25
26
27
28
29
30
31
32
33
34
# File 'lib/statistrano/deployment/strategy/invoke_tasks.rb', line 25

def invoke_pre_symlink_task remote
  if !remote.config.pre_symlink_task.nil?
    Log.info :pre_symlink, "Running the pre_symlink task"
    resp = call_or_invoke_task remote.config.pre_symlink_task, remote
    if resp == false
      Log.error :pre_symlink, "exiting due to falsy return"
      abort()
    end
  end
end