capistrano_multiconfig_parallel 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/capistrano_multiconfig_parallel.gemspec +1 -1
- data/lib/capistrano_multiconfig_parallel/all.rb +1 -1
- data/lib/capistrano_multiconfig_parallel/celluloid/celluloid_manager.rb +1 -0
- data/lib/capistrano_multiconfig_parallel/celluloid/celluloid_worker.rb +24 -14
- data/lib/capistrano_multiconfig_parallel/celluloid/terminal_table.rb +18 -10
- data/lib/capistrano_multiconfig_parallel/extensions/extension_helper.rb +2 -0
- data/lib/capistrano_multiconfig_parallel/extensions/rake.rb +2 -4
- data/lib/capistrano_multiconfig_parallel/version.rb +2 -2
- metadata +7 -8
- data/lib/capistrano_multiconfig_parallel/initializers/helper.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 867ce8da69cdf6500d2ee56333c109bc8d0dcf8a
|
4
|
+
data.tar.gz: 14485e413c78e550ca6ce3d68172d247360249be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db431edc0e89fff08132da6b0cf85b39b75260e71a39e5180bcb3d8d190ab2b63913a2c7ac5beb359f9f9bc5926b4cd371ba0a1153e698a37c305b5e295a12bd
|
7
|
+
data.tar.gz: 61657bacfd339847406ffc24dfc0064805567be1f447db96541e138239aba3d26cc06e62a1ae4e3222f27422cadcecfa12feddad4c25f2e00d9d84d56251ed39
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_runtime_dependency 'celluloid_pubsub', '~> 0.0', '>= 0.0.15'
|
22
22
|
s.add_runtime_dependency 'composable_state_machine', '~> 1.0', '>= 1.0.2'
|
23
23
|
s.add_runtime_dependency 'terminal-table', '~> 1.4', '>= 1.4.5'
|
24
|
-
s.add_runtime_dependency '
|
24
|
+
s.add_runtime_dependency 'ruby-progressbar', '~> 1.7', '>= 1.7.5'
|
25
25
|
s.add_runtime_dependency 'colorize', '~> 0.7', '>= 0.7'
|
26
26
|
s.add_runtime_dependency 'eventmachine', '~> 1.0', '>= 1.0.3'
|
27
27
|
s.add_runtime_dependency 'right_popen', '~> 1.1', '>= 1.1.3'
|
@@ -25,7 +25,7 @@ module CapistranoMulticonfigParallel
|
|
25
25
|
attr_accessor :job, :manager, :job_id, :app_name, :env_name, :action_name, :env_options, :machine, :client, :task_argv, :execute_deploy, :executed_dry_run,
|
26
26
|
:rake_tasks, :current_task_number, # tracking tasks
|
27
27
|
:successfull_subscription, :subscription_channel, :publisher_channel, # for subscriptions and publishing events
|
28
|
-
:job_termination_condition, :worker_state
|
28
|
+
:job_termination_condition, :worker_state, :executing_dry_run
|
29
29
|
|
30
30
|
def work(job, manager)
|
31
31
|
@job = job
|
@@ -71,12 +71,11 @@ module CapistranoMulticonfigParallel
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def execute_after_succesfull_subscription
|
74
|
-
|
75
|
-
if (@action_name == 'deploy' || @action_name == 'deploy:rollback') && CapistranoMulticonfigParallel.show_task_progress
|
74
|
+
if @action_name != 'deploy:rollback' && CapistranoMulticonfigParallel.show_task_progress
|
76
75
|
@executed_dry_run = true
|
77
76
|
@rake_tasks = []
|
78
|
-
@
|
79
|
-
|
77
|
+
@executing_dry_run = true
|
78
|
+
setup_task_arguments( '--dry-run','count_rake=true' )
|
80
79
|
@child_process = CapistranoMulticonfigParallel::ChildProcess.new
|
81
80
|
Actor.current.link @child_process
|
82
81
|
debug("worker #{@job_id} executes: #{generate_command}") if debug_enabled?
|
@@ -107,6 +106,7 @@ module CapistranoMulticonfigParallel
|
|
107
106
|
setup_task_arguments
|
108
107
|
debug("worker #{@job_id} executes: #{generate_command}") if debug_enabled?
|
109
108
|
@child_process.async.work(generate_command, actor: Actor.current, silent: true)
|
109
|
+
@executing_dry_run = false
|
110
110
|
@manager.wait_task_confirmations_worker(Actor.current)
|
111
111
|
end
|
112
112
|
|
@@ -168,9 +168,8 @@ module CapistranoMulticonfigParallel
|
|
168
168
|
|
169
169
|
def save_tasks_to_be_executed(message)
|
170
170
|
return unless message['action'] == 'count'
|
171
|
-
debug("worler #{@job_id} current invocation chain : #{
|
172
|
-
|
173
|
-
@rake_tasks << message['task'] if @rake_tasks.last != message['task']
|
171
|
+
debug("worler #{@job_id} current invocation chain : #{rake_tasks.inspect}") if debug_enabled?
|
172
|
+
rake_tasks << message['task'] if rake_tasks.last != message['task']
|
174
173
|
end
|
175
174
|
|
176
175
|
def update_machine_state(name)
|
@@ -187,17 +186,28 @@ module CapistranoMulticonfigParallel
|
|
187
186
|
end
|
188
187
|
@task_argv
|
189
188
|
end
|
189
|
+
|
190
|
+
def worker_stage
|
191
|
+
@app_name.present? ? "#{@app_name}:#{@env_name}" : "#{@env_name}"
|
192
|
+
end
|
193
|
+
|
194
|
+
def worker_action
|
195
|
+
"#{@action_name}[#{@task_arguments.join(',')}]"
|
196
|
+
end
|
190
197
|
|
191
|
-
def setup_task_arguments
|
198
|
+
def setup_task_arguments(*args)
|
192
199
|
# stage = "#{@app_name}:#{@env_name} #{@action_name}"
|
193
|
-
|
194
|
-
array_options = ["#{stage}"]
|
195
|
-
array_options << "#{@action_name}[#{@task_arguments.join(',')}]"
|
200
|
+
array_options = []
|
196
201
|
@env_options.each do |key, value|
|
197
202
|
array_options << "#{key}=#{value}" if value.present?
|
198
|
-
|
203
|
+
end
|
199
204
|
array_options << '--trace' if debug_enabled?
|
200
|
-
|
205
|
+
args.each do |arg|
|
206
|
+
array_options << arg
|
207
|
+
end
|
208
|
+
@manager.jobs[@job_id]['job_argv'] = array_options.clone
|
209
|
+
array_options.unshift("#{worker_action}")
|
210
|
+
array_options.unshift("#{worker_stage}")
|
201
211
|
setup_command_line(*array_options)
|
202
212
|
end
|
203
213
|
|
@@ -71,12 +71,12 @@ module CapistranoMulticonfigParallel
|
|
71
71
|
|
72
72
|
def worker_env_options(processed_job)
|
73
73
|
worker_optons = ''
|
74
|
-
processed_job['
|
75
|
-
worker_optons << "#{
|
74
|
+
processed_job['job_argv'].each do |elem|
|
75
|
+
worker_optons << "#{elem}\n"
|
76
76
|
end
|
77
77
|
worker_optons
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
def worker_action(processed_job)
|
81
81
|
processed_job['task_arguments'].present? ? "#{processed_job['action_name']}[#{processed_job['task_arguments'].join(',')}]" : processed_job['action_name']
|
82
82
|
end
|
@@ -85,10 +85,9 @@ module CapistranoMulticonfigParallel
|
|
85
85
|
processed_job['app_name'].present? ? "#{processed_job['app_name']}\n#{processed_job['env_name']}" : "#{processed_job['env_name']}"
|
86
86
|
end
|
87
87
|
|
88
|
-
def get_worker_details(job_id)
|
88
|
+
def get_worker_details(job_id, worker)
|
89
89
|
job = @manager.jobs[job_id]
|
90
90
|
processed_job = @manager.process_job(job)
|
91
|
-
worker = @manager.get_worker_for_job(job_id)
|
92
91
|
|
93
92
|
{
|
94
93
|
'job_id' => job_id,
|
@@ -103,15 +102,16 @@ module CapistranoMulticonfigParallel
|
|
103
102
|
end
|
104
103
|
|
105
104
|
def add_job_to_table(table, job_id)
|
106
|
-
|
105
|
+
worker = @manager.get_worker_for_job(job_id)
|
106
|
+
details = get_worker_details(job_id, worker)
|
107
|
+
|
107
108
|
row = [{ value: job_id.to_s },
|
108
109
|
{ value: details['full_stage'] },
|
109
110
|
{ value: details['action_name'] },
|
110
111
|
{ value: details['env_options'] },
|
111
112
|
{ value: "#{details['state']}" }
|
112
113
|
]
|
113
|
-
if CapistranoMulticonfigParallel.show_task_progress
|
114
|
-
worker = @manager.get_worker_for_job(job_id)
|
114
|
+
if CapistranoMulticonfigParallel.show_task_progress
|
115
115
|
row << { value: worker.rake_tasks.size }
|
116
116
|
row << { value: worker_progress(worker) }
|
117
117
|
end
|
@@ -129,10 +129,18 @@ module CapistranoMulticonfigParallel
|
|
129
129
|
current_task = worker.machine.state
|
130
130
|
total_tasks = tasks.size
|
131
131
|
task_index = tasks.index(current_task)
|
132
|
-
|
133
|
-
|
132
|
+
stringio = StringIO.new
|
133
|
+
if worker.executing_dry_run == false
|
134
|
+
#progress = ProgressBar::Base.new(:title => "Tasks", :output => stringio, :format => '%a %B %p%% %t', :starting_at => task_index.to_i, :total => total_tasks, :length => 40)
|
135
|
+
progress = ProgressBar.create(:format => '%a |%b %i| %p%% Completed', :output => stringio, :starting_at => task_index, :total => total_tasks, :length => 40 )
|
136
|
+
progress.refresh
|
137
|
+
else
|
138
|
+
progress = ProgressBar.create(:format => '%a |%b %i| %p%% Completed', :output => stringio, :length => 40, :total => nil, :unknown_progress_animation_steps => ['==>', '>==', '=>='])
|
134
139
|
progress.increment
|
140
|
+
progress.refresh
|
135
141
|
end
|
142
|
+
stringio.rewind
|
143
|
+
result = stringio.read
|
136
144
|
result = result.gsub("\r\n", '')
|
137
145
|
result = result.gsub("\n", '')
|
138
146
|
result = result.gsub('|', '#')
|
@@ -1,14 +1,12 @@
|
|
1
1
|
require_relative './extension_helper'
|
2
|
-
require_relative './input_stream'
|
3
|
-
require_relative './output_stream'
|
4
2
|
Rake::Task.class_eval do
|
5
3
|
alias_method :original_execute, :execute
|
6
4
|
|
7
|
-
def execute(args
|
5
|
+
def execute(*args)
|
8
6
|
if CapistranoMulticonfigParallel::ExtensionHelper.inside_job?
|
9
7
|
CapistranoMulticonfigParallel::ExtensionHelper.run_the_actor(self) do
|
10
8
|
original_execute(*args)
|
11
|
-
|
9
|
+
end
|
12
10
|
else
|
13
11
|
original_execute(*args)
|
14
12
|
end
|
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.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid-pmap
|
@@ -91,25 +91,25 @@ dependencies:
|
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: 1.4.5
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
|
-
name:
|
94
|
+
name: ruby-progressbar
|
95
95
|
requirement: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: '
|
99
|
+
version: '1.7'
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 1.7.5
|
103
103
|
type: :runtime
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '1.7'
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
112
|
+
version: 1.7.5
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: colorize
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
@@ -656,7 +656,6 @@ files:
|
|
656
656
|
- lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb
|
657
657
|
- lib/capistrano_multiconfig_parallel/initializers/conf.rb
|
658
658
|
- lib/capistrano_multiconfig_parallel/initializers/default.yml
|
659
|
-
- lib/capistrano_multiconfig_parallel/initializers/helper.rb
|
660
659
|
- lib/capistrano_multiconfig_parallel/multi_app_helpers/dependency_tracker.rb
|
661
660
|
- lib/capistrano_multiconfig_parallel/multi_app_helpers/interactive_menu.rb
|
662
661
|
- lib/capistrano_multiconfig_parallel/version.rb
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module CapistranoMulticonfigParallel
|
2
|
-
# class used to find application dependencies
|
3
|
-
class Helper
|
4
|
-
# rubocop:disable Lint/Eval
|
5
|
-
def self.capture(stream)
|
6
|
-
stream = stream.to_s
|
7
|
-
captured_stream = Tempfile.new(stream)
|
8
|
-
stream_io = eval("$#{stream}")
|
9
|
-
origin_stream = stream_io.dup
|
10
|
-
stream_io.reopen(captured_stream)
|
11
|
-
|
12
|
-
yield
|
13
|
-
|
14
|
-
stream_io.rewind
|
15
|
-
return captured_stream.read
|
16
|
-
ensure
|
17
|
-
captured_stream.close
|
18
|
-
captured_stream.unlink
|
19
|
-
stream_io.reopen(origin_stream)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|