capistrano_multiconfig_parallel 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5dc5369df42690fa5ef870983a214797511279f1
4
- data.tar.gz: f88009806ea57b3592a5764fd11d9a462eed320f
3
+ metadata.gz: 5e6f19bd4a7bf784e65f3bc34d3e49bb9e09cbe0
4
+ data.tar.gz: 69ce6bff1ffa9bb244ee9c12e6a035850c458be5
5
5
  SHA512:
6
- metadata.gz: 92e18862adee46ad87c6b367a4667d5b5042f4470d449aeed06e39f7064f363b803f47aff6eeeae50a5d700fa1288a846f8e2809910471a9dc4367fceebd2e90
7
- data.tar.gz: e85230d220e7f440e38c3164113b70050432b09267120b0ae15e35c0caa759accd38806c1094b8f7ae821d7079c60e1bcde6863f1af515c9d076f580a0e8ceab
6
+ metadata.gz: 500a0d5722c22bc3d00abfedd395050a7ce693fd9eec858cb4fc5d4f6ef82c62ce782b5cfb15aa6426fabf284f54dc4f0d3f1baee62b3ee00909ce74cfe41fbf
7
+ data.tar.gz: 7be10e250b4ed0e1c3990e4071816203022b0b7b20d34a8f60a1a1d475ec469b8ffd6a782b976e2e47fa193a80944c6276ea1f4e668c54a17225555875e202a5
@@ -105,12 +105,18 @@ module CapistranoMulticonfigParallel
105
105
  @job_manager.condition.signal(results2) if results2.size == @jobs.size
106
106
  end
107
107
 
108
+ def need_confirmations?
109
+ CapistranoMulticonfigParallel.configuration.task_confirmation_active.to_s.downcase == 'true'
110
+ end
111
+
108
112
  def wait_task_confirmations
109
- return unless CapistranoMulticonfigParallel.configuration.task_confirmation_active
113
+ return unless need_confirmations?
110
114
  CapistranoMulticonfigParallel.configuration.task_confirmations.each_with_index do |task, index|
111
115
  results = []
112
116
  @jobs.pmap do |job_id, _job|
113
- results << @job_to_condition[job_id][:first_condition][index].wait
117
+ current_job = @job_to_condition[job_id][:first_condition][index]
118
+ result = current_job.respond_to?(:wait) ? current_job.wait : current_job
119
+ results << result
114
120
  end
115
121
  if results.size == @jobs.size
116
122
  confirm_task_approval(results, task)
@@ -120,17 +126,19 @@ module CapistranoMulticonfigParallel
120
126
 
121
127
  def confirm_task_approval(results, task)
122
128
  return unless results.present?
123
- set :apps_symlink_confirmation, CapistranoMulticonfigParallel.ask_confirm("Do you want to continue the deployment and execute #{task}?", 'Y/N')
124
- until fetch(:apps_symlink_confirmation).present?
125
- sleep(0.1) # keep current thread alive
129
+ if results.detect {|x| !x.is_a?(Proc)}
130
+ set :apps_symlink_confirmation, CapistranoMulticonfigParallel.ask_confirm("Do you want to continue the deployment and execute #{task}?", 'Y/N')
131
+ until fetch(:apps_symlink_confirmation).present?
132
+ sleep(0.1) # keep current thread alive
133
+ end
126
134
  end
127
135
  return if fetch(:apps_symlink_confirmation).blank? || fetch(:apps_symlink_confirmation).downcase != 'y'
128
136
  @jobs.pmap do |job_id, job|
129
137
  worker = get_worker_for_job(job_id)
130
138
  worker.publish_rake_event('approved' => 'yes',
131
- 'action' => 'invoke',
132
- 'job_id' => job['id'],
133
- 'task' => task
139
+ 'action' => 'invoke',
140
+ 'job_id' => job['id'],
141
+ 'task' => task
134
142
  )
135
143
  end
136
144
  end
@@ -182,7 +182,7 @@ module CapistranoMulticonfigParallel
182
182
  end
183
183
 
184
184
  def need_confirmation_for_tasks?
185
- executes_deploy? && CapistranoMulticonfigParallel.configuration.task_confirmation_active
185
+ executes_deploy? == true && @manager.need_confirmations?
186
186
  end
187
187
 
188
188
  def executes_deploy?
@@ -8,7 +8,7 @@ module CapistranoMulticonfigParallel
8
8
  module VERSION
9
9
  MAJOR = 0
10
10
  MINOR = 1
11
- TINY = 3
11
+ TINY = 4
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.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada