capistrano_multiconfig_parallel 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -6
- data/lib/capistrano_multiconfig_parallel/base.rb +0 -1
- data/lib/capistrano_multiconfig_parallel/celluloid/celluloid_manager.rb +1 -2
- data/lib/capistrano_multiconfig_parallel/configuration.rb +12 -3
- data/lib/capistrano_multiconfig_parallel/initializers/default.yml +0 -8
- data/lib/capistrano_multiconfig_parallel/managers/base_manager.rb +15 -2
- data/lib/capistrano_multiconfig_parallel/managers/multi_app_manager.rb +4 -43
- data/lib/capistrano_multiconfig_parallel/managers/single_app_manager.rb +3 -26
- data/lib/capistrano_multiconfig_parallel/multi_app_helpers/dependency_tracker.rb +2 -2
- data/lib/capistrano_multiconfig_parallel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0d7fbfdddb1813c37500eed17d8d200fa162d35
|
4
|
+
data.tar.gz: f28477691b9551c1e59040c561869a4246e2ef0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38032af4671c6b73fe789c0014d7d6d410a4fe72e1dc5563f2645ec1df061aaef191cfa2e5b183c2396f4d6697ef804f4e1e1236168d030cb81286d46c915423
|
7
|
+
data.tar.gz: 8e4c41d88e958835fa3682180809c9fd11f8dfa02425d9b020ee204c283dcd894e9514f6db4227fe8fce7931faddf5d9a28c13469b1fefbc614193b56abf1686
|
data/README.md
CHANGED
@@ -79,7 +79,6 @@ apply_stage_confirmation:
|
|
79
79
|
task_confirmations:
|
80
80
|
- deploy:symlink:release
|
81
81
|
|
82
|
-
track_dependencies: false
|
83
82
|
application_dependencies: []
|
84
83
|
---
|
85
84
|
```
|
@@ -111,9 +110,9 @@ Available command line options when executing a command
|
|
111
110
|
|
112
111
|
- if option is present and has value an ARRAY of Strings, and --task_confirmation_active is TRUE , then will require a confirmation from user before executing the task. This will syncronize all workers to wait before executing that task, then a confirmation will be displayed, and when user will confirm , all workers will resume their operation.
|
113
112
|
|
114
|
-
- --
|
113
|
+
- --application_dependencies
|
115
114
|
|
116
|
-
- This should be
|
115
|
+
- This should be used only for Caphub-like applications , in order to deploy dependencies of an application in parallel and is described at section **[2.) Multiple applications](#multiple_apps)**
|
117
116
|
|
118
117
|
Usage Instructions
|
119
118
|
==================
|
@@ -171,7 +170,6 @@ Configuration for this types of application is more complicated
|
|
171
170
|
|
172
171
|
```yaml
|
173
172
|
---
|
174
|
-
track_dependencies: true
|
175
173
|
application_dependencies:
|
176
174
|
- app: foo'
|
177
175
|
priority: 1
|
@@ -190,8 +188,6 @@ application_dependencies:
|
|
190
188
|
|
191
189
|
The "development_stages" options is used so that the gem can know if sandboxes are allowed for those environments.
|
192
190
|
|
193
|
-
If you want to deploy an application with dependencies you can use the option "track_dependencies". If that options has value "true" , it will ask the user before deploying a application if he needs the dependencies deployed too
|
194
|
-
|
195
191
|
The dependencies are being kept in the option "application_dependencies" This is an array of hashes. Each hash has only the keys "app" ( app name), "priority" and "dependencies" ( an array of app names that this app is dependent to)
|
196
192
|
|
197
193
|
In this example, if we execute this command:
|
@@ -54,7 +54,6 @@ module CapistranoMulticonfigParallel
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def enable_logging
|
57
|
-
CapistranoMulticonfigParallel.configuration_valid?
|
58
57
|
FileUtils.mkdir_p(log_directory) unless File.directory?(log_directory)
|
59
58
|
if CapistranoMulticonfigParallel::CelluloidManager.debug_enabled.to_s.downcase == 'true'
|
60
59
|
FileUtils.touch(main_log_file) unless File.file?(main_log_file)
|
@@ -116,11 +116,10 @@ module CapistranoMulticonfigParallel
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def apply_confirmations?
|
119
|
-
|
119
|
+
confirmations = CapistranoMulticonfigParallel.configuration.task_confirmations
|
120
120
|
confirmations.is_a?(Array) && confirmations.present?
|
121
121
|
end
|
122
122
|
|
123
|
-
|
124
123
|
def syncronized_confirmation?
|
125
124
|
(!@job_manager.executes_deploy_stages?) ||
|
126
125
|
(@job_manager.executes_deploy_stages? && !@job_manager.can_tag_staging? && @job_manager.confirmation_applies_to_all_workers?)
|
@@ -78,23 +78,32 @@ module CapistranoMulticonfigParallel
|
|
78
78
|
raise ArgumentError, "invalid configuration for #{wrong.inspect}" if wrong.present?
|
79
79
|
end
|
80
80
|
|
81
|
+
def verify_app_dependencies(stages)
|
82
|
+
applications = stages.map { |stage| stage.split(':').reverse[1] }
|
83
|
+
wrong = configuration.application_dependencies.find do |hash|
|
84
|
+
!applications.include?(hash[:app]) || (hash[:dependencies].present? && hash[:dependencies].find { |val| !applications.include?(val) })
|
85
|
+
end
|
86
|
+
raise ArgumentError, "invalid configuration for #{wrong.inspect}" if wrong.present?
|
87
|
+
end
|
88
|
+
|
81
89
|
def check_boolean(c, prop)
|
82
90
|
# return unless c[prop].present?
|
83
91
|
raise ArgumentError, "the property `#{prop}` must be boolean" unless [true, false, 'true', 'false'].include?(c[prop].to_s.downcase)
|
84
92
|
end
|
85
93
|
|
86
|
-
def configuration_valid?
|
94
|
+
def configuration_valid?(stages)
|
87
95
|
configuration
|
96
|
+
verify_app_dependencies(stages) if configuration.application_dependencies.present?
|
88
97
|
end
|
89
98
|
|
90
99
|
def check_configuration(c)
|
91
|
-
%w(multi_debug multi_secvential
|
100
|
+
%w(multi_debug multi_secvential websocket_server.enable_debug).each do |prop|
|
92
101
|
c.send("#{prop}=", c[prop.to_sym]) if check_boolean(c, prop.to_sym)
|
93
102
|
end
|
94
103
|
%w(task_confirmations development_stages apply_stage_confirmation).each do |prop|
|
95
104
|
c.send("#{prop}=", c[prop.to_sym]) if verify_array_of_strings(c, prop.to_sym)
|
96
105
|
end
|
97
|
-
c.application_dependencies = c[:application_dependencies] if
|
106
|
+
c.application_dependencies = c[:application_dependencies] if verify_application_dependencies(c[:application_dependencies])
|
98
107
|
check_additional_config(c)
|
99
108
|
end
|
100
109
|
|
@@ -45,14 +45,6 @@ default_config:
|
|
45
45
|
default:
|
46
46
|
- production
|
47
47
|
|
48
|
-
- name: 'track_dependencies'
|
49
|
-
type: ':boolean'
|
50
|
-
description: >-
|
51
|
-
This should be useed only for Caphub-like applications ,
|
52
|
-
in order to deploy dependencies of an application in parallel.
|
53
|
-
This is used only in combination with option **--application_dependencies**
|
54
|
-
CAP_VALUE can be true or false
|
55
|
-
default: false
|
56
48
|
|
57
49
|
- name: 'application_dependencies'
|
58
50
|
type: 'Array'
|
@@ -14,7 +14,17 @@ module CapistranoMulticonfigParallel
|
|
14
14
|
@top_level_tasks = top_level_tasks
|
15
15
|
@stages = stages
|
16
16
|
@jobs = []
|
17
|
-
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
options = {}
|
21
|
+
if custom_command?
|
22
|
+
run_custom_command(options)
|
23
|
+
else
|
24
|
+
options = verify_options_custom_command(options)
|
25
|
+
run_normal_command(options)
|
26
|
+
end
|
27
|
+
process_jobs
|
18
28
|
end
|
19
29
|
|
20
30
|
def can_start?
|
@@ -87,7 +97,9 @@ module CapistranoMulticonfigParallel
|
|
87
97
|
end
|
88
98
|
|
89
99
|
def check_before_starting
|
90
|
-
CapistranoMulticonfigParallel.configuration_valid?
|
100
|
+
CapistranoMulticonfigParallel.configuration_valid?(@stages)
|
101
|
+
CapistranoMulticonfigParallel.enable_logging
|
102
|
+
@dependency_tracker = CapistranoMulticonfigParallel::DependencyTracker.new(Actor.current)
|
91
103
|
@default_stage = CapistranoMulticonfigParallel.configuration.development_stages.present? ? CapistranoMulticonfigParallel.configuration.development_stages.first : 'development'
|
92
104
|
@condition = Celluloid::Condition.new
|
93
105
|
@manager = CapistranoMulticonfigParallel::CelluloidManager.new(Actor.current)
|
@@ -95,6 +107,7 @@ module CapistranoMulticonfigParallel
|
|
95
107
|
|
96
108
|
def collect_jobs(options = {}, &block)
|
97
109
|
options = prepare_options(options)
|
110
|
+
options = options.stringify_keys
|
98
111
|
block.call(options) if block_given?
|
99
112
|
rescue => e
|
100
113
|
raise [e, e.backtrace].inspect
|
@@ -6,47 +6,15 @@ module CapistranoMulticonfigParallel
|
|
6
6
|
include Celluloid
|
7
7
|
include Celluloid::Logger
|
8
8
|
|
9
|
-
def
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def check_before_starting
|
15
|
-
verify_app_dependencies(@stages) if configuration.present? && configuration.track_dependencies.to_s.downcase == 'true'
|
16
|
-
super
|
17
|
-
end
|
18
|
-
|
19
|
-
def verify_app_dependencies(stages)
|
20
|
-
applications = stages.map { |stage| stage.split(':').reverse[1] }
|
21
|
-
wrong = configuration.application_dependencies.find do |hash|
|
22
|
-
!applications.include?(hash[:app]) || (hash[:dependencies].present? && hash[:dependencies].find { |val| !applications.include?(val) })
|
23
|
-
end
|
24
|
-
raise ArgumentError, "invalid configuration for #{wrong.inspect}" if wrong.present?
|
25
|
-
end
|
26
|
-
|
27
|
-
def run
|
28
|
-
options = {}
|
29
|
-
if custom_command?
|
30
|
-
run_custom_command(options)
|
31
|
-
else
|
32
|
-
menu_deploy_interactive(options)
|
9
|
+
def run_normal_command(options)
|
10
|
+
multi_collect_and_run_jobs(options) do |apps, new_options|
|
11
|
+
deploy_multiple_apps(apps, new_options)
|
12
|
+
deploy_app(new_options) if !custom_command? && new_options['app'].present?
|
33
13
|
end
|
34
|
-
process_jobs
|
35
14
|
end
|
36
15
|
|
37
16
|
def run_custom_command(options)
|
38
|
-
return unless custom_command?
|
39
17
|
CapistranoMulticonfigParallel.interactive_menu = true
|
40
|
-
options = verify_options_custom_command(options)
|
41
|
-
action_name = @name
|
42
|
-
if action_name == custom_commands[:stages]
|
43
|
-
multi_stage_deploy(options)
|
44
|
-
else
|
45
|
-
raise "Custom command #{@name} not available for multi apps"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def multi_stage_deploy(options)
|
50
18
|
stages = fetch_multi_stages
|
51
19
|
return if stages.blank?
|
52
20
|
stages = check_multi_stages(stages)
|
@@ -59,13 +27,6 @@ module CapistranoMulticonfigParallel
|
|
59
27
|
end
|
60
28
|
end
|
61
29
|
|
62
|
-
def menu_deploy_interactive(options)
|
63
|
-
multi_collect_and_run_jobs(options) do |apps, new_options|
|
64
|
-
deploy_multiple_apps(apps, new_options)
|
65
|
-
deploy_app(new_options) if !custom_command? && new_options['app'].present?
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
30
|
private
|
70
31
|
|
71
32
|
def multi_collect_and_run_jobs(options = {}, &block)
|
@@ -5,29 +5,13 @@ module CapistranoMulticonfigParallel
|
|
5
5
|
include Celluloid
|
6
6
|
include Celluloid::Logger
|
7
7
|
|
8
|
-
def
|
9
|
-
options
|
10
|
-
|
11
|
-
run_custom_command(options)
|
12
|
-
else
|
13
|
-
deploy_single_app(options)
|
8
|
+
def run_normal_command(options)
|
9
|
+
collect_jobs(options) do |new_options|
|
10
|
+
deploy_app(new_options)
|
14
11
|
end
|
15
|
-
process_jobs
|
16
12
|
end
|
17
13
|
|
18
14
|
def run_custom_command(options)
|
19
|
-
return unless custom_command?
|
20
|
-
options = verify_options_custom_command(options)
|
21
|
-
action_name = @name
|
22
|
-
if action_name == custom_commands[:stages]
|
23
|
-
stage_deploy(options)
|
24
|
-
else
|
25
|
-
raise "Custom command #{@name} not available for single apps"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def stage_deploy(options)
|
30
|
-
return unless custom_command?
|
31
15
|
stages = fetch_multi_stages
|
32
16
|
return if stages.blank?
|
33
17
|
stages = check_multi_stages(stages)
|
@@ -37,12 +21,5 @@ module CapistranoMulticonfigParallel
|
|
37
21
|
end
|
38
22
|
end
|
39
23
|
end
|
40
|
-
|
41
|
-
def deploy_single_app(options)
|
42
|
-
return if custom_command?
|
43
|
-
collect_jobs(options) do |new_options|
|
44
|
-
deploy_app(new_options)
|
45
|
-
end
|
46
|
-
end
|
47
24
|
end
|
48
25
|
end
|
@@ -14,7 +14,7 @@ module CapistranoMulticonfigParallel
|
|
14
14
|
if @job_manager.custom_command? && @job_manager.multi_apps?
|
15
15
|
apps_selected = all_websites_return_applications_selected
|
16
16
|
applications = get_applications_to_deploy(action, apps_selected)
|
17
|
-
elsif CapistranoMulticonfigParallel.configuration.
|
17
|
+
elsif CapistranoMulticonfigParallel.configuration.application_dependencies.present?
|
18
18
|
if application.present?
|
19
19
|
applications = get_applications_to_deploy(action, [application.camelcase])
|
20
20
|
applications = applications.delete_if { |hash| hash['app'] == application }
|
@@ -30,7 +30,7 @@ module CapistranoMulticonfigParallel
|
|
30
30
|
private
|
31
31
|
|
32
32
|
def application_dependencies
|
33
|
-
deps = CapistranoMulticonfigParallel.configuration.
|
33
|
+
deps = CapistranoMulticonfigParallel.configuration.application_dependencies
|
34
34
|
deps.present? && deps.is_a?(Array) ? deps.map(&:stringify_keys) : []
|
35
35
|
end
|
36
36
|
|