capistrano_multiconfig_parallel 0.12.3 → 0.12.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/capistrano_multiconfig_parallel/all.rb +2 -2
- data/lib/capistrano_multiconfig_parallel/base.rb +1 -1
- data/lib/capistrano_multiconfig_parallel/celluloid/celluloid_manager.rb +17 -10
- data/lib/capistrano_multiconfig_parallel/celluloid/terminal_table.rb +7 -4
- data/lib/capistrano_multiconfig_parallel/celluloid/web_server.rb +11 -0
- data/lib/capistrano_multiconfig_parallel/helpers/base_manager.rb +25 -1
- data/lib/capistrano_multiconfig_parallel/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da73ed1bc09e08ea7e93648b4606bdcbbbdce792
|
4
|
+
data.tar.gz: 79980b245e0ca22f6c59694d1bd1c8a6f8f400f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f85f820e562cc1947897a4a90abe1c8843109e7f4d9148ad84009ff55f82bf4e7c7527858280bcb8d644c732d2a7e56b4486f81a84ed4ef548799fdc88dfe397
|
7
|
+
data.tar.gz: 66dcc2e8e2ecc62ef85a663ca880e92129579c7189a8b88f6ca97d17b1979457cfc84d082a87d213eea633c673554dc6ced515c01b1f3eb710377532fba367e7
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@ capistrano_multiconfig_parallel
|
|
2
2
|
==================
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/capistrano_multiconfig_parallel.svg)](http://badge.fury.io/rb/capistrano_multiconfig_parallel)
|
5
|
-
[![Repo Size](https://
|
5
|
+
[![Repo Size](https://ruby-gem-downloads-badge.herokuapp.com/repo_size/bogdanRada/capistrano_multiconfig_parallel)](https://github.com/bogdanRada/capistrano_multiconfig_parallel)
|
6
6
|
[![Gem Downloads](https://ruby-gem-downloads-badge.herokuapp.com/capistrano_multiconfig_parallel?type=total&style=dynamic)](https://github.com/bogdanRada/capistrano_multiconfig_parallel)
|
7
7
|
[![Maintenance Status](http://stillmaintained.com/bogdanRada/capistrano_multiconfig_parallel.png)](https://github.com/bogdanRada/capistrano_multiconfig_parallel)
|
8
8
|
|
@@ -13,11 +13,11 @@ require 'right_popen'
|
|
13
13
|
require 'colorize'
|
14
14
|
require 'logger'
|
15
15
|
require 'terminal-table'
|
16
|
-
|
16
|
+
|
17
17
|
require 'celluloid_pubsub'
|
18
18
|
require 'capistrano/all'
|
19
19
|
require 'fileutils'
|
20
|
-
|
20
|
+
|
21
21
|
require 'pp'
|
22
22
|
require 'devnull'
|
23
23
|
require 'inquirer'
|
@@ -99,7 +99,7 @@ module CapistranoMulticonfigParallel
|
|
99
99
|
root = Pathname.new(FileUtils.pwd)
|
100
100
|
root = root.parent unless root.directory?
|
101
101
|
root = root.parent until root.children.find { |f| f.file? && f.basename.to_s.downcase == 'capfile' }.present? || root.root?
|
102
|
-
raise "Can't detect
|
102
|
+
raise "Can't detect Capfile in the application root" if root.root?
|
103
103
|
root
|
104
104
|
end
|
105
105
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative './celluloid_worker'
|
2
2
|
require_relative './terminal_table'
|
3
|
+
require_relative './web_server'
|
3
4
|
module CapistranoMulticonfigParallel
|
4
5
|
# rubocop:disable ClassLength
|
5
6
|
class CelluloidManager
|
@@ -33,11 +34,11 @@ module CapistranoMulticonfigParallel
|
|
33
34
|
@job_to_worker = {}
|
34
35
|
@worker_to_job = {}
|
35
36
|
@job_to_condition = {}
|
36
|
-
|
37
37
|
@worker_supervisor.supervise_as(:terminal_server, CapistranoMulticonfigParallel::TerminalTable, Actor.current, @job_manager)
|
38
|
-
@worker_supervisor.supervise_as(:web_server,
|
38
|
+
@worker_supervisor.supervise_as(:web_server, CapistranoMulticonfigParallel::WebServer, self.class.websocket_config)
|
39
39
|
end
|
40
40
|
|
41
|
+
|
41
42
|
def self.debug_enabled?
|
42
43
|
debug_enabled
|
43
44
|
end
|
@@ -49,16 +50,22 @@ module CapistranoMulticonfigParallel
|
|
49
50
|
def self.websocket_config
|
50
51
|
config = CapistranoMulticonfigParallel.configuration[:websocket_server]
|
51
52
|
config.present? && config.is_a?(Hash) ? config.stringify_keys : {}
|
53
|
+
config['enable_debug'] = config.fetch('enable_debug', '').to_s == 'true'
|
54
|
+
config
|
52
55
|
end
|
53
56
|
|
57
|
+
|
58
|
+
|
59
|
+
|
54
60
|
def generate_job_id(job)
|
55
|
-
primary_key =
|
61
|
+
primary_key = SecureRandom.random_number(500)
|
56
62
|
job['id'] = primary_key
|
57
63
|
@jobs[primary_key] = job
|
58
64
|
@jobs[primary_key]
|
59
65
|
job['id']
|
60
66
|
end
|
61
67
|
|
68
|
+
|
62
69
|
# call to send an actor
|
63
70
|
# a job
|
64
71
|
def delegate(job)
|
@@ -108,7 +115,7 @@ module CapistranoMulticonfigParallel
|
|
108
115
|
condition = @workers_terminated.wait
|
109
116
|
until condition.present?
|
110
117
|
sleep(0.1) # keep current thread alive
|
111
|
-
|
118
|
+
end
|
112
119
|
debug("all jobs have completed #{condition}") if self.class.debug_enabled?
|
113
120
|
Celluloid::Actor[:terminal_server].async.notify_time_change(CapistranoMulticonfigParallel::TerminalTable::TOPIC, type: 'output') if Celluloid::Actor[:terminal_server].alive?
|
114
121
|
end
|
@@ -123,7 +130,7 @@ module CapistranoMulticonfigParallel
|
|
123
130
|
|
124
131
|
def syncronized_confirmation?
|
125
132
|
(syncronization_required? && !@job_manager.executes_deploy_stages?) ||
|
126
|
-
|
133
|
+
(syncronization_required? && @job_manager.executes_deploy_stages? && !@job_manager.can_tag_staging? && @job_manager.confirmation_applies_to_all_workers?)
|
127
134
|
end
|
128
135
|
|
129
136
|
def apply_confirmation_for_worker(worker)
|
@@ -196,10 +203,10 @@ module CapistranoMulticonfigParallel
|
|
196
203
|
@jobs.pmap do |job_id, job|
|
197
204
|
worker = get_worker_for_job(job_id)
|
198
205
|
worker.publish_rake_event('approved' => 'yes',
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
206
|
+
'action' => 'invoke',
|
207
|
+
'job_id' => job['id'],
|
208
|
+
'task' => task
|
209
|
+
)
|
203
210
|
end
|
204
211
|
end
|
205
212
|
|
@@ -218,7 +225,7 @@ module CapistranoMulticonfigParallel
|
|
218
225
|
|
219
226
|
def can_tag_staging?
|
220
227
|
@job_manager.can_tag_staging? &&
|
221
|
-
|
228
|
+
@jobs.find { |_job_id, job| job['env'] == 'production' }.blank?
|
222
229
|
end
|
223
230
|
|
224
231
|
def dispatch_new_job(job)
|
@@ -20,15 +20,17 @@ module CapistranoMulticonfigParallel
|
|
20
20
|
|
21
21
|
def notify_time_change(topic, message)
|
22
22
|
return unless topic == CapistranoMulticonfigParallel::TerminalTable::TOPIC
|
23
|
-
default_headings = ['Job ID', 'App/Stage', 'Action', 'ENV Variables', 'Current Task']
|
23
|
+
default_headings = ['Job ID', 'Job UUID' 'App/Stage', 'Action', 'ENV Variables', 'Current Task']
|
24
24
|
# if CapistranoMulticonfigParallel.show_task_progress
|
25
25
|
# default_headings << 'Total'
|
26
26
|
# default_headings << 'Progress'
|
27
27
|
# end
|
28
28
|
table = Terminal::Table.new(title: 'Deployment Status Table', headings: default_headings)
|
29
29
|
if @manager.jobs.present? && message_valid?(message)
|
30
|
+
count = 0
|
30
31
|
@manager.jobs.each do |job_id, _job|
|
31
|
-
|
32
|
+
count += 1
|
33
|
+
add_job_to_table(table, job_id, count)
|
32
34
|
end
|
33
35
|
end
|
34
36
|
show_terminal_screen(table)
|
@@ -100,11 +102,12 @@ module CapistranoMulticonfigParallel
|
|
100
102
|
}
|
101
103
|
end
|
102
104
|
|
103
|
-
def add_job_to_table(table, job_id)
|
105
|
+
def add_job_to_table(table, job_id, count)
|
104
106
|
worker = @manager.get_worker_for_job(job_id)
|
105
107
|
details = get_worker_details(job_id, worker)
|
106
108
|
|
107
|
-
row = [{ value:
|
109
|
+
row = [{ value: count.to_s },
|
110
|
+
{ value: job_id.to_s },
|
108
111
|
{ value: details['full_stage'] },
|
109
112
|
{ value: details['action_name'] },
|
110
113
|
{ value: details['env_options'] },
|
@@ -49,16 +49,40 @@ module CapistranoMulticonfigParallel
|
|
49
49
|
run
|
50
50
|
end
|
51
51
|
|
52
|
+
|
53
|
+
|
52
54
|
def initialize_data
|
53
55
|
@application = custom_command? ? nil : @top_level_tasks.first.split(':').reverse[1]
|
54
56
|
@stage = custom_command? ? nil : @top_level_tasks.first.split(':').reverse[0]
|
55
57
|
@stage = @stage.present? ? @stage : @default_stage
|
56
|
-
@name, @args =
|
58
|
+
@name, @args = parse_task_string(@top_level_tasks.second)
|
57
59
|
@argv = @cap_app.handle_options.delete_if { |arg| arg == @stage || arg == @name || arg == @top_level_tasks.first }
|
58
60
|
@argv = multi_fetch_argv(@argv)
|
59
61
|
@original_argv = @argv.clone
|
60
62
|
end
|
61
63
|
|
64
|
+
|
65
|
+
def parse_task_string(string) # :nodoc:
|
66
|
+
/^([^\[]+)(?:\[(.*)\])$/ =~ string.to_s
|
67
|
+
|
68
|
+
name = $1
|
69
|
+
remaining_args = $2
|
70
|
+
|
71
|
+
return string, [] unless name
|
72
|
+
return name, [] if remaining_args.empty?
|
73
|
+
|
74
|
+
args = []
|
75
|
+
|
76
|
+
begin
|
77
|
+
/((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args
|
78
|
+
|
79
|
+
remaining_args = $2
|
80
|
+
args << $1.gsub(/\\(.)/, '\1')
|
81
|
+
end while remaining_args
|
82
|
+
|
83
|
+
return name, args
|
84
|
+
end
|
85
|
+
|
62
86
|
def verify_options_custom_command(options)
|
63
87
|
options[:action] = @argv['ACTION'].present? ? @argv['ACTION'] : 'deploy'
|
64
88
|
options
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano_multiconfig_parallel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid-pmap
|
@@ -624,6 +624,7 @@ files:
|
|
624
624
|
- lib/capistrano_multiconfig_parallel/celluloid/rake_worker.rb
|
625
625
|
- lib/capistrano_multiconfig_parallel/celluloid/state_machine.rb
|
626
626
|
- lib/capistrano_multiconfig_parallel/celluloid/terminal_table.rb
|
627
|
+
- lib/capistrano_multiconfig_parallel/celluloid/web_server.rb
|
627
628
|
- lib/capistrano_multiconfig_parallel/cli.rb
|
628
629
|
- lib/capistrano_multiconfig_parallel/configuration.rb
|
629
630
|
- lib/capistrano_multiconfig_parallel/extensions/extension_helper.rb
|