Class: CapistranoMulticonfigParallel::SingleAppManager

Inherits:
BaseManager
  • Object
show all
Includes:
Celluloid, Celluloid::Logger
Defined in:
lib/capistrano_multiconfig_parallel/helpers/single_app_manager.rb

Overview

class used to find application dependencies

Instance Attribute Summary

Attributes inherited from BaseManager

#application, #args, #argv, #condition, #default_stage, #deps, #job_registered_condition, #jobs, #manager, #name, #stage

Instance Method Summary collapse

Methods inherited from BaseManager

#can_start?, #collect_jobs, #custom_command?, #custom_commands, #deploy_app, #fetch_multi_stages, #initialize, #multi_apps?, #process_jobs, #start

Constructor Details

This class inherits a constructor from CapistranoMulticonfigParallel::BaseManager

Instance Method Details

#deploy_single_app(options) ⇒ Object



39
40
41
42
43
44
# File 'lib/capistrano_multiconfig_parallel/helpers/single_app_manager.rb', line 39

def deploy_single_app(options)
  return if custom_command?
  collect_jobs(options) do |new_options|
    deploy_app(new_options)
  end
end

#runObject



8
9
10
11
12
13
14
15
16
# File 'lib/capistrano_multiconfig_parallel/helpers/single_app_manager.rb', line 8

def run
  options = {}
  if custom_command?
    run_custom_command(options)
  else
    deploy_single_app(options)
  end
  process_jobs
end

#run_custom_command(options) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/capistrano_multiconfig_parallel/helpers/single_app_manager.rb', line 18

def run_custom_command(options)
  return unless custom_command?
  action_name = @name
  if action_name == custom_commands[:stages]
    stage_deploy(options)
  else
    raise "Custom command #{@name} not available for single apps"
  end
end

#stage_deploy(options) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/capistrano_multiconfig_parallel/helpers/single_app_manager.rb', line 28

def stage_deploy(options)
  return unless custom_command?
  stages = fetch_multi_stages
  return if stages.blank?
  collect_jobs(options) do |new_options|
    stages.each do |stage|
      deploy_app(new_options.merge('stage' => stage, 'action' => 'deploy'))
    end
  end
end