Class: CapistranoMulticonfigParallel::Application

Inherits:
Capistrano::Application
  • Object
show all
Defined in:
lib/capistrano_multiconfig_parallel/application.rb

Overview

class used as a wrapper around capistrano

Instance Method Summary collapse

Instance Method Details

#multi_apps?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/capistrano_multiconfig_parallel/application.rb', line 49

def multi_apps?
  stages.find { |stage| stage.include?(':') }.present?
end

#multi_debugObject



12
13
14
15
16
17
18
19
20
# File 'lib/capistrano_multiconfig_parallel/application.rb', line 12

def multi_debug
  ['--multi-debug', '-D',
   'Sets the debug enabled for celluloid actors',
   lambda do |_value|
     CapistranoMulticonfigParallel::CelluloidManager.debug_enabled = true
     Celluloid.task_class = Celluloid::TaskThread
   end
  ]
end

#multi_manager_classObject



53
54
55
# File 'lib/capistrano_multiconfig_parallel/application.rb', line 53

def multi_manager_class
  multi_apps? ? CapistranoMulticonfigParallel::MultiAppManager : CapistranoMulticonfigParallel::SingleAppManager
end

#multi_progressObject



22
23
24
25
26
27
28
29
# File 'lib/capistrano_multiconfig_parallel/application.rb', line 22

def multi_progress
  ['--multi-progress', '--multi-progress',
   'Sets the debug enabled for celluloid actors',
   lambda do |_value|
     CapistranoMulticonfigParallel.show_task_progress = true
   end
  ]
end

#multi_secventialObject



31
32
33
34
35
36
37
38
# File 'lib/capistrano_multiconfig_parallel/application.rb', line 31

def multi_secvential
  ['--multi-secvential', '--multi-secvential',
   'Sets the debug enabled for celluloid actors',
   lambda do |_value|
     CapistranoMulticonfigParallel.execute_in_sequence = true
   end
  ]
end

#nameObject



4
5
6
# File 'lib/capistrano_multiconfig_parallel/application.rb', line 4

def name
  'multi_cap'
end

#sort_options(options) ⇒ Object



8
9
10
# File 'lib/capistrano_multiconfig_parallel/application.rb', line 8

def sort_options(options)
  super.push(multi_debug, multi_progress, multi_secvential)
end

#top_levelObject



40
41
42
43
44
45
46
47
# File 'lib/capistrano_multiconfig_parallel/application.rb', line 40

def top_level
  job_manager = multi_manager_class.new(self, top_level_tasks, stages)
  if job_manager.can_start? && !options.show_prereqs && !options.show_tasks
    job_manager.start
  else
    super
  end
end