capistrano_multiconfig_parallel 2.0.4 → 2.0.5

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: ad4f5118640bf0eb0d4432550eabda6d3ab473c4
4
- data.tar.gz: ba7d6e68442b703b128b5e5d39817b39e8e63aca
3
+ metadata.gz: f6825ac5589167ee4a3ddd9656816c6ca07ba078
4
+ data.tar.gz: 581c3abbc3e591f7805204182e6143bc51eabb51
5
5
  SHA512:
6
- metadata.gz: abf7da6aed349a2ac5ee9b1b0f9839d6678344fb46a1050fd9b49261cc469832c391dcde9b972e74b95e2bb117b68a4c938403e6a8aa656cf4d8dff27ce9dfa6
7
- data.tar.gz: 7fe10ebea517268960b73b09623c348b8457350bcf2c07bcc60d66361ad5343cb5282ec0910eb20b063c3353c63d6a2509cd490c0afc160b10fda35e0f6859d3
6
+ metadata.gz: ba070cc586ddbc2f1aaa1c4c39bd97950c5e0d5732b7457f0bea9ba922ca69a025c3eb7d18c91cc7ccf12dfd2c1e0462cbc0b4eec2c6e70ef4293a313981613e
7
+ data.tar.gz: 2169b6d170664cf324e46a61f392170d793a51faefe1873e784e3eb97e24224687a653672814344020e786f91510f3657d27129e90bff685802d22e139b2d25f
data/README.md CHANGED
@@ -55,7 +55,7 @@ Requirements
55
55
  11. [inquirer >= 0.2](https://github.com/arlimus/inquirer.rb)
56
56
  12. [devnull >= 0.1](https://github.com/arlimus/inquirer.rb)
57
57
  13. [capistrano_sentinel >= 0.0.16](http://github.com/bogdanRada/capistrano_sentinel)
58
- 14. [ruby-progressbar >= 1.8.1](https://github.com/jfelchner/ruby-progressbar)
58
+ 14. [powerbar >= 1.0.17](https://github.com/busyloop/powerbar)
59
59
 
60
60
  Compatibility
61
61
  -------------
@@ -2,7 +2,7 @@ require_relative './helpers/base_actor_helper'
2
2
  module CapistranoMulticonfigParallel
3
3
  # finds app dependencies, shows menu and delegates jobs to celluloid manager
4
4
  class Application
5
- include CapistranoMulticonfigParallel::BaseActorHelper
5
+ include CapistranoMulticonfigParallel::ApplicationHelper
6
6
 
7
7
  attr_reader :stage_apps,
8
8
  :top_level_tasks,
@@ -19,7 +19,7 @@ module CapistranoMulticonfigParallel
19
19
  :patched_job_paths,
20
20
  :bundler_workers_store,
21
21
  :checked_job_paths
22
-
22
+
23
23
  attr_writer :patched_job_paths
24
24
 
25
25
  def initialize
@@ -108,20 +108,11 @@ module CapistranoMulticonfigParallel
108
108
  end
109
109
 
110
110
  def check_before_starting
111
- @dependency_tracker = CapistranoMulticonfigParallel::DependencyTracker.new(Actor.current)
111
+ @dependency_tracker = CapistranoMulticonfigParallel::DependencyTracker.new(self)
112
112
  @default_stage = configuration.development_stages.present? ? configuration.development_stages.first : 'development'
113
113
  @condition = Celluloid::Condition.new
114
- @manager = CapistranoMulticonfigParallel::CelluloidManager.new(Actor.current)
115
- start_bundler_supervision_if_needed
116
- end
117
-
118
- def start_bundler_supervision_if_needed
119
- return if configuration.check_app_bundler_dependencies.to_s.downcase != 'true'
120
- @bundler_worker_supervisor = setup_supervision_group
121
- @mutex = Mutex.new
122
- @bundler_workers = setup_pool_of_actor(@bundler_worker_supervisor, actor_name: :bundler_workers, type: CapistranoMulticonfigParallel::BundlerWorker, size: 10)
123
- Actor.current.link @bundler_workers
124
- setup_actor_supervision(@bundler_worker_supervisor, actor_name: :bundler_terminal_server, type: CapistranoMulticonfigParallel::BundlerTerminalTable, args: [@manager, Actor.current, configuration.fetch(:terminal, {})])
114
+ @manager = CapistranoMulticonfigParallel::CelluloidManager.new(self)
115
+ @manager.start_bundler_supervision_if_needed
125
116
  end
126
117
 
127
118
  def collect_jobs(options = {}, &_block)
@@ -191,7 +182,11 @@ module CapistranoMulticonfigParallel
191
182
  collect_jobs(options)
192
183
  end
193
184
  if configuration.check_app_bundler_dependencies.to_s.downcase == 'true'
194
- sleep(0.1) until @jobs.size == @bundler_workers_store.size
185
+ loop do
186
+ log_to_file("Trying to sleep until all budler workes are done (#{@jobs.size} and #{@bundler_workers_store.size})")
187
+ break if @jobs.size == @bundler_workers_store.size
188
+ sleep(0.1)
189
+ end
195
190
  end
196
191
  process_jobs
197
192
  end
@@ -235,6 +230,10 @@ module CapistranoMulticonfigParallel
235
230
  #terminate
236
231
  end
237
232
 
233
+ def add_job_to_list_of_jobs(job)
234
+ @jobs << job unless job_can_tag_staging?(job)
235
+ end
236
+
238
237
  def prepare_job(options)
239
238
  options = options.stringify_keys
240
239
  return raise_invalid_job_config if !job_stage_valid?(options)
@@ -248,31 +247,24 @@ module CapistranoMulticonfigParallel
248
247
  env_options = options['env_options']
249
248
  job_env_options = custom_command? ? env_options.except(action_key) : env_options
250
249
 
251
- job = CapistranoMulticonfigParallel::Job.new(Actor.current, options.merge(
250
+ job = CapistranoMulticonfigParallel::Job.new(self, options.merge(
252
251
  action: custom_command? && env_options[action_key].present? ? env_options[action_key] : options['action'],
253
252
  env_options: job_env_options,
254
253
  path: job_path(options)
255
254
 
256
255
  ))
256
+ raise "Please make sure you have a Gemfile in the project root directory #{job.job_path}" unless job.job_gemfile.present?
257
+ if job.find_capfile.blank?
258
+ raise "Please make sure you have a Capfile in the project root directory #{job.job_path}"
259
+ end
257
260
 
258
- bundler_callback = lambda { |job|
259
- raise "Please make sure you have a Gemfile in the project root directory #{job.job_path}" unless job.job_gemfile.present?
260
- if job.find_capfile.blank?
261
- raise "Please make sure you have a Capfile in the project root directory #{job.job_path}"
262
- end
263
- unless job.capistrano_sentinel_needs_updating?
264
- raise "Please consider upgrading the gem #{job.capistrano_sentinel_name} to version #{job.loaded_capistrano_sentinel_version} from #{job.job_capistrano_sentinel_version} in #{job.job_path} "
265
- end
266
- log_to_file("bundler callback called with #{job.inspect}")
267
- job.application.jobs << job unless job.application.job_can_tag_staging?(job)
268
- }
269
261
  if configuration.check_app_bundler_dependencies.to_s.downcase == 'true' && job.job_gemfile.present?
270
262
  if !@checked_job_paths.include?(job.job_path)
271
263
  @checked_job_paths << job.job_path
272
- @bundler_workers.work(job, &bundler_callback) # make sure we have installed the dependencies first for this application
264
+ @manager.bundler_workers.work(job) # make sure we have installed the dependencies first for this application
273
265
  end
274
266
  else
275
- bundler_callback.call(job)
267
+ add_job_to_list_of_jobs(job)
276
268
  end
277
269
 
278
270
  end
@@ -15,9 +15,8 @@ module CapistranoMulticonfigParallel
15
15
  :show_bundler
16
16
  ]
17
17
 
18
- def work(job, &callback)
18
+ def work(job)
19
19
  @job = job
20
- @callback = callback
21
20
  @job.application.bundler_workers_store[job] = Actor.current
22
21
  @job_id = job.id
23
22
  @runner_status = nil
@@ -90,8 +89,9 @@ module CapistranoMulticonfigParallel
90
89
  @runner_status = runner_status
91
90
  @exit_status = exit_status
92
91
  progress_bar.close if defined?(@progress_bar)
93
- if exit_status == 0
94
- @callback.call(@job)
92
+ log_to_file("bundler worker #{@job_id} notifuy finished with #{exit_status.inspect}")
93
+ if exit_status.to_i == 0
94
+ @job.application.add_job_to_list_of_jobs(@job)
95
95
  else
96
96
  error_message = "Bundler worker #{@job_id} task failed with exit status #{exit_status.inspect}"
97
97
  raise(CapistranoMulticonfigParallel::TaskFailed.new(error_message), error_message)
@@ -8,7 +8,7 @@ module CapistranoMulticonfigParallel
8
8
  include CapistranoMulticonfigParallel::BaseActorHelper
9
9
  attr_accessor :jobs, :job_to_worker, :worker_to_job, :job_to_condition, :mutex, :registration_complete, :workers_terminated, :stderr_buffer
10
10
 
11
- attr_reader :worker_supervisor, :workers
11
+ attr_reader :worker_supervisor, :workers, :bundler_workers
12
12
  trap_exit :worker_died
13
13
 
14
14
  def initialize(job_manager)
@@ -38,6 +38,13 @@ module CapistranoMulticonfigParallel
38
38
  @job_to_condition = {}
39
39
  end
40
40
 
41
+ def start_bundler_supervision_if_needed
42
+ return if configuration.check_app_bundler_dependencies.to_s.downcase != 'true'
43
+ @bundler_workers = setup_pool_of_actor(@worker_supervisor, actor_name: :bundler_workers, type: CapistranoMulticonfigParallel::BundlerWorker, size: 10)
44
+ Actor.current.link @bundler_workers
45
+ setup_actor_supervision(@worker_supervisor, actor_name: :bundler_terminal_server, type: CapistranoMulticonfigParallel::BundlerTerminalTable, args: [Actor.current, @job_manager, configuration.fetch(:terminal, {})])
46
+ end
47
+
41
48
  # call to send an actor
42
49
  # a job
43
50
  def delegate_job(job, old_job = "")
@@ -60,8 +60,8 @@ module CapistranoMulticonfigParallel
60
60
  exit_status = @runner_status.exit_status
61
61
  return if exit_status.blank?
62
62
  @timer.cancel
63
- log_to_file("worker #{@job_id} startsnotify finished with exit status #{exit_status.inspect}")
64
63
  if @actor.present? && @actor.respond_to?(:notify_finished)
64
+ log_to_file("#{@actor.class} #{@job_id} startsnotify finished with exit status #{exit_status.inspect}")
65
65
  if @actor.respond_to?(:async) && @synchronicity == :async
66
66
  @actor.async.notify_finished(exit_status, @runner_status)
67
67
  else
@@ -94,7 +94,7 @@ module CapistranoMulticonfigParallel
94
94
  end
95
95
 
96
96
  def managers_alive?
97
- @job_manager.alive? && @manager.alive?
97
+ @manager.alive?
98
98
  end
99
99
 
100
100
  def signal_complete
@@ -11,7 +11,7 @@ module CapistranoMulticonfigParallel
11
11
  end
12
12
 
13
13
  def fetch_apps_needed_for_deployment(application, action)
14
- return [[], {}] unless @job_manager.multi_apps?
14
+ return [[], {}] unless @job_manager.send(:multi_apps?)
15
15
  if @job_manager.custom_command?
16
16
  show_interactive_menu(action)
17
17
  else
@@ -261,6 +261,9 @@ module CapistranoMulticonfigParallel
261
261
  end
262
262
 
263
263
  def prepare_application_for_deployment
264
+ unless capistrano_sentinel_needs_updating?
265
+ raise "Please consider upgrading the gem #{capistrano_sentinel_name} to version #{loaded_capistrano_sentinel_version} from #{job_capistrano_sentinel_version} in #{job_path} "
266
+ end
264
267
  config = @job.application.patched_job_paths.find{|hash| hash[:path] == job_path}
265
268
  if config.present?
266
269
  @job_final_gemfile = config[:gemfile]
@@ -9,7 +9,7 @@ module CapistranoMulticonfigParallel
9
9
 
10
10
  MAJOR = 2
11
11
  MINOR = 0
12
- TINY = 4
12
+ TINY = 5
13
13
  PRE = nil
14
14
 
15
15
  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: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada