capistrano_multiconfig_parallel 1.0.4 → 1.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: 7d2f26567119f10125fc2405dfbf2c43ac58abbd
4
- data.tar.gz: 3038d99e240a14ba32becc87d6f4d3f92a73c220
3
+ metadata.gz: 5d2597af7ef8c177ea61d7e535b7ac546d3cdc70
4
+ data.tar.gz: cfd8fc986a102d2fb9fe9a18975cbdadb3eb9f05
5
5
  SHA512:
6
- metadata.gz: 15f3503e0ba919497e95f1891d3a866ea5ccfbc0601861cb9ed9488a0c1850a2b1675122522fd81420c7eccd89c5bad580ba55f023dd7153a12fb6f6c252e827
7
- data.tar.gz: 0616700d0b686d3a74875a688989e87d7b7aa34097fd1f7c7806150ec14a6daa303eecd8b772cb66a94f32280fa31448fbec9a07bc87f2ec678d28721bd3bead
6
+ metadata.gz: d8c821103168c6b92df533a2eb30205125d8a86b11d220fd4f5b0770ad5a12d9255dec7fa41bf9d5d83ada1f678951cfa8342d2a85a915c96e25153e1ca50ee8
7
+ data.tar.gz: 5b9a84cc4facd9ac2226ef343b4f46fdf8db19492f14fa178cacb5dc53401ca2be552fee76d23948671e6cf27425df8501f2b476e652dd21519760f643d89a7b
@@ -123,10 +123,11 @@ module CapistranoMulticonfigParallel
123
123
 
124
124
  def user_prompt_needed?(data)
125
125
  question, default = get_question_details(data)
126
+ log_to_file("Rake worker #{@job_id} tries to determine question #{data.inspect} #{question.inspect} #{default.inspect}")
126
127
  return if question.blank? || @action != 'invoke'
127
128
  publish_to_worker(action: 'stdout',
128
129
  question: question,
129
- default: default.delete('()'),
130
+ default: default.present? ? default.delete('()') : '',
130
131
  job_id: @job_id)
131
132
  wait_for_stdin_input
132
133
  end
@@ -56,8 +56,9 @@ module CapistranoMulticonfigParallel
56
56
  end
57
57
 
58
58
  def worker_state
59
+ worker_obj = worker
59
60
  default = status.to_s.upcase.red
60
- worker.present? && worker.alive? ? worker.worker_state : default
61
+ worker_obj.present? && worker_obj.alive? ? worker_obj.worker_state : default
61
62
  end
62
63
 
63
64
  def id
@@ -23,6 +23,10 @@ module CapistranoMulticonfigParallel
23
23
  end
24
24
  end
25
25
 
26
+ def actor
27
+ Celluloid::Actor[rake_actor_id]
28
+ end
29
+
26
30
  private
27
31
 
28
32
  def output_stream
@@ -35,8 +39,9 @@ module CapistranoMulticonfigParallel
35
39
 
36
40
  def before_hooks
37
41
  stringio = StringIO.new
38
- output_stream.hook(stringio)
39
- input_stream.hook(actor, stringio)
42
+ output = output_stream.hook(stringio)
43
+ input = input_stream.hook(actor, stringio)
44
+ [input, output]
40
45
  end
41
46
 
42
47
  def after_hooks
@@ -64,10 +69,6 @@ module CapistranoMulticonfigParallel
64
69
  CapistranoMulticonfigParallel::RakeWorker.supervise_as(rake_actor_id)
65
70
  end
66
71
 
67
- def actor
68
- Celluloid::Actor[rake_actor_id]
69
- end
70
-
71
72
  def job_id
72
73
  capistrano_version_2? ? @config.fetch(CapistranoMulticonfigParallel::ENV_KEY_JOB_ID, nil) : @env[CapistranoMulticonfigParallel::ENV_KEY_JOB_ID]
73
74
  end
@@ -33,8 +33,8 @@ module CapistranoMulticonfigParallel
33
33
  end
34
34
 
35
35
  def get_question_details(data)
36
- /(.*)\?*\s*\:*\s*(\([^)]*\))*/m =~ data
37
- [regex_last_match(1), regex_last_match(2)]
36
+ matches = /(.*)\?*\s*\:*\s*(\([^)]*\))*/m.match(data).captures
37
+ [matches[0], matches[1]]
38
38
  end
39
39
 
40
40
  def setup_command_line_standard(*args)
@@ -1,5 +1,15 @@
1
1
  if CapistranoMulticonfigParallel.capistrano_version_2?
2
2
  require 'capistrano/cli'
3
+
4
+ HighLine.class_eval do
5
+ alias_method :original_ask, :ask
6
+
7
+ def ask(question, _answer_type = String, &_details)
8
+ rake = CapistranoMulticonfigParallel::RakeTaskHooks.new(ENV, nil, CapistranoMulticonfigParallel.original_args_hash)
9
+ rake.actor.user_prompt_needed?(question)
10
+ end
11
+ end
12
+
3
13
  Capistrano::Configuration::Execution.class_eval do
4
14
  alias_method :original_execute_task, :execute_task
5
15
 
@@ -21,4 +31,5 @@ if CapistranoMulticonfigParallel.capistrano_version_2?
21
31
  end
22
32
  end
23
33
  end
34
+
24
35
  end
@@ -8,7 +8,7 @@ module CapistranoMulticonfigParallel
8
8
  module VERSION
9
9
  MAJOR = 1
10
10
  MINOR = 0
11
- TINY = 4
11
+ TINY = 5
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: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada