capistrano_multiconfig_parallel 0.21.7 → 0.21.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f87a7482ae60ee3c54f450c9e20d6f489a7d2a4
4
- data.tar.gz: 7716965e21fe4d4faf52ad69aadbb9dfb0039597
3
+ metadata.gz: 1e0b5a6c4d757da56822db1d3841df24d849005f
4
+ data.tar.gz: 47e706d3ca497fcce259094b026baeda873fa173
5
5
  SHA512:
6
- metadata.gz: 3ac991a6da052876428b36d49dbe2e37007b01623b53427ac497bb1983c71e0dff89ef7bd8cc2ab7a07b477d5f126bf2953debe5094d12ff3ee12e1ff3357a03
7
- data.tar.gz: 7a244b45ad63e01d0224490fa24ed153d0fcbdfe9cce6b4761f10ce6914c15e94d2e182eb75c84c051afb9f2237b157a60ae8945f2fac2538da356570fa85101
6
+ metadata.gz: 156d0a858b5cac59ae2e393ec367f010b47efff8d212826eee6e5c45ea1446ab780f9200a1e7a728b36b0a2d8df71885e1d49f801c8996dd0939982407e85f16
7
+ data.tar.gz: e10b68c1ac518825a070dd221d77ab8c80a02c2e74ec5ca42e09431d87bda94ef32864e2a805a88bad2b626ded2cd44ab99e92c0b1cad657c957b579d990a907
@@ -219,7 +219,7 @@ module CapistranoMulticonfigParallel
219
219
  env_options = branch_name.present? ? { 'BRANCH' => branch_name }.merge(options['env_options']) : options['env_options']
220
220
  job_env_options = custom_command? && env_options['ACTION'].present? ? env_options.except('ACTION') : env_options
221
221
 
222
- job = CapistranoMulticonfigParallel::Job.new(options.merge(
222
+ job = CapistranoMulticonfigParallel::Job.new(Actor.current, options.merge(
223
223
  action: custom_command? && env_options['ACTION'].present? ? env_options['ACTION'] : options['action'],
224
224
  env_options: job_env_options
225
225
  ))
@@ -194,7 +194,7 @@ module CapistranoMulticonfigParallel
194
194
  options.stringify_keys! if options.present?
195
195
  env_opts = options['skip_env_options'].present? ? {} : @job_manager.get_app_additional_env_options(job.app, job.stage)
196
196
  new_job_options = job.options.merge('env_options' => job.env_options.merge(env_opts))
197
- new_job = CapistranoMulticonfigParallel::Job.new(new_job_options.merge(options.except(job.job_writer_attributes)))
197
+ new_job = CapistranoMulticonfigParallel::Job.new(@job_manager, new_job_options.merge(options.except(job.job_writer_attributes)))
198
198
  new_job.setup_writer_attributes(options)
199
199
  async.delegate(new_job) unless job.worker_died?
200
200
  end
@@ -44,7 +44,7 @@ module CapistranoMulticonfigParallel
44
44
 
45
45
  def setup_table_jobs(table, jobs)
46
46
  jobs.each_with_index do |(_job_id, job), count|
47
- add_job_to_table(table, job, count)
47
+ table.add_row(job.terminal_row(count))
48
48
  table.add_separator
49
49
  end
50
50
  end
@@ -60,19 +60,6 @@ module CapistranoMulticonfigParallel
60
60
  @job_manager.condition.signal('completed') if @manager.all_workers_finished?
61
61
  end
62
62
 
63
- def worker_state(job)
64
- default = job.status.to_s.upcase.red
65
- return default unless @manager.alive?
66
- worker = @manager.get_worker_for_job(job.id)
67
- worker.alive? ? worker.worker_state : default
68
- end
69
-
70
- def add_job_to_table(table, job, index)
71
- job_state = worker_state(job)
72
- job_row = job.terminal_row(index, job_state)
73
- table.add_row(job_row)
74
- end
75
-
76
63
  def terminal_clear
77
64
  system('cls') || system('clear') || puts("\e[H\e[2J")
78
65
  end
@@ -15,8 +15,10 @@ module CapistranoMulticonfigParallel
15
15
  :setup_command_line_standard,
16
16
  to: :command
17
17
 
18
- def initialize(options)
18
+ def initialize(application, options)
19
19
  @options = options
20
+ @application = application
21
+ @manager = @application.manager
20
22
  end
21
23
 
22
24
  def env_variable
@@ -27,17 +29,24 @@ module CapistranoMulticonfigParallel
27
29
  @command ||= CapistranoMulticonfigParallel::JobCommand.new(self)
28
30
  end
29
31
 
30
- def terminal_row(index, job_state)
32
+ def terminal_row(index)
31
33
  [
32
34
  { value: (index + 1).to_s },
33
35
  { value: id.to_s },
34
36
  { value: job_stage },
35
37
  { value: capistrano_action },
36
38
  { value: setup_command_line_standard(filtered_keys: [CapistranoMulticonfigParallel::ENV_KEY_JOB_ID]).join("\n") },
37
- { value: job_state }
39
+ { value: worker_state }
38
40
  ]
39
41
  end
40
42
 
43
+ def worker_state
44
+ default = status.to_s.upcase.red
45
+ return default unless @manager.alive?
46
+ worker = @manager.get_worker_for_job(id)
47
+ worker.alive? ? worker.worker_state : default
48
+ end
49
+
41
50
  def job_writer_attributes
42
51
  %w(status exit_status)
43
52
  end
@@ -8,7 +8,7 @@ module CapistranoMulticonfigParallel
8
8
  module VERSION
9
9
  MAJOR = 0
10
10
  MINOR = 21
11
- TINY = 7
11
+ TINY = 8
12
12
  PRE = nil
13
13
 
14
14
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano_multiconfig_parallel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.7
4
+ version: 0.21.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada