Class: CapistranoMulticonfigParallel::MultiAppManager
- Inherits:
-
BaseManager
- Object
- BaseManager
- CapistranoMulticonfigParallel::MultiAppManager
- Includes:
- Celluloid, Celluloid::Logger
- Defined in:
- lib/capistrano_multiconfig_parallel/helpers/multi_app_manager.rb
Overview
class used to find application dependencies
Instance Method Summary collapse
- #check_before_starting ⇒ Object
-
#initialize(cap_app, top_level_tasks, stages) ⇒ MultiAppManager
constructor
A new instance of MultiAppManager.
- #menu_deploy_interactive(options) ⇒ Object
- #multi_stage_deploy(options) ⇒ Object
- #run ⇒ Object
- #run_custom_command(options) ⇒ Object
- #verify_app_dependencies(stages) ⇒ Object
Constructor Details
#initialize(cap_app, top_level_tasks, stages) ⇒ MultiAppManager
Returns a new instance of MultiAppManager.
9 10 11 12 |
# File 'lib/capistrano_multiconfig_parallel/helpers/multi_app_manager.rb', line 9 def initialize(cap_app, top_level_tasks, stages) super(cap_app, top_level_tasks, stages) @dependency_tracker = CapistranoMulticonfigParallel::DependencyTracker.new(Actor.current) end |
Instance Method Details
#check_before_starting ⇒ Object
14 15 16 17 |
# File 'lib/capistrano_multiconfig_parallel/helpers/multi_app_manager.rb', line 14 def check_before_starting verify_app_dependencies(@stages) if configuration.present? && configuration.track_dependencies.to_s.downcase == 'true' super end |
#menu_deploy_interactive(options) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/capistrano_multiconfig_parallel/helpers/multi_app_manager.rb', line 62 def () multi_collect_and_run_jobs() do |apps, | deploy_multiple_apps(apps, ) deploy_app() if !custom_command? && ['app'].present? end end |
#multi_stage_deploy(options) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/capistrano_multiconfig_parallel/helpers/multi_app_manager.rb', line 49 def multi_stage_deploy() stages = fetch_multi_stages return if stages.blank? stages = check_multi_stages(stages) multi_collect_and_run_jobs() do |apps, | apps.each do |app| stages.each do |stage| deploy_app(.merge('app' => app, 'stage' => stage)) end end if apps.present? end end |
#run ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/capistrano_multiconfig_parallel/helpers/multi_app_manager.rb', line 27 def run = {} if custom_command? run_custom_command() else () end process_jobs end |
#run_custom_command(options) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/capistrano_multiconfig_parallel/helpers/multi_app_manager.rb', line 37 def run_custom_command() return unless custom_command? CapistranoMulticonfigParallel. = true [:action] = @argv['ACTION'].present? ? @argv['ACTION'].present? : 'deploy' action_name = @name if action_name == custom_commands[:stages] multi_stage_deploy() else raise "Custom command #{@name} not available for multi apps" end end |
#verify_app_dependencies(stages) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/capistrano_multiconfig_parallel/helpers/multi_app_manager.rb', line 19 def verify_app_dependencies(stages) applications = stages.map { |stage| stage.split(':').reverse[1] } wrong = configuration.application_dependencies.find do |hash| !applications.include?(hash[:app]) || (hash[:dependencies].present? && hash[:dependencies].find { |val| !applications.include?(val) }) end raise ArgumentError, "invalid configuration for #{wrong.inspect}" if wrong.present? end |