capistrano_multiconfig_parallel 0.9.0 → 0.9.1

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: 3dface583820b0494ab0c4243c2daae6dc203a9b
4
- data.tar.gz: fba2ef6001a82b06fcc43c7ba4094b2151577bef
3
+ metadata.gz: 808fe6e708f7467e9217be29a02d3c35655687f2
4
+ data.tar.gz: f7f2a71f361c913b7002dad9ac8565d5ddf3c124
5
5
  SHA512:
6
- metadata.gz: 569dc97b2f9baff197a34c65514df8714e92c4ef6e908e7c2a545d9538f1453df9fb8d3c9459aac7bc67c70bbb500f2414dc81e89fd7650bba5cd281f461916d
7
- data.tar.gz: b312a7d1503ed68d5d2a66cc0ec7a1f33f1aefdfcc85469e89c05754b3591939f5e612d40d7ec59c3defbd1ba4ab7cd50126225d71bfc3d2dbfa408351996149
6
+ metadata.gz: e8407b78757adda260e96e7bb8aaeae373a0db670e8c564d9073463f88fe07498abc57cc33d2ec31edbd69b42d35864df2e7e152922f097111fd6eab254a72b8
7
+ data.tar.gz: efe0311672c329fa5fbf0e4d7dbea08e35a199079f03a0f95e850e24fa105d298be1107e8c971d7fa6f4283b0ee039004f5cafed8d6c7e611331774b91dc605f
@@ -23,6 +23,7 @@ require 'pp'
23
23
  require 'devnull'
24
24
  require 'inquirer'
25
25
  require 'yaml'
26
+ require 'stringio'
26
27
  # fix error with not files that can not be found
27
28
  Gem.find_files('composable_state_machine/**/*.rb').each { |path| require path }
28
29
 
@@ -130,7 +130,7 @@ module CapistranoMulticonfigParallel
130
130
  def get_question_details(data)
131
131
  question = ''
132
132
  default = nil
133
- if data =~ /(.*)\?+\s*\:*\s*(\([^)]*\))*/m
133
+ if data =~ /(.*)\?*\s*\:*\s*(\([^)]*\))*/m
134
134
  question = Regexp.last_match(1)
135
135
  default = Regexp.last_match(2)
136
136
  end
@@ -157,7 +157,7 @@ module CapistranoMulticonfigParallel
157
157
  job_id: @job_id
158
158
  })
159
159
  @questions_prompted << data
160
-
160
+ wait_for_stdin_input
161
161
 
162
162
  end
163
163
 
@@ -17,22 +17,23 @@ module CapistranoMulticonfigParallel
17
17
  end
18
18
 
19
19
  def actor
20
- CapistranoMulticonfigParallel::RakeWorker.supervise_as(rake_actor_id,
21
- actor_id: rake_actor_id,
22
- job_id: job_id) if Celluloid::Actor[rake_actor_id].blank?
23
- Celluloid::Actor[rake_actor_id]
24
- end
25
-
26
- def run_the_actor(task, &block)
27
- actor.work(ENV, task: task)
28
- actor.wait_execution until actor.task_approved
29
- return unless actor.task_approved
30
- CapistranoMulticonfigParallel::InputStream.hook(actor)
31
- CapistranoMulticonfigParallel::OutputStream.hook(actor)
32
- block.call
33
- CapistranoMulticonfigParallel::InputStream.unhook
34
- CapistranoMulticonfigParallel::OutputStream.unhook
35
- end
20
+ CapistranoMulticonfigParallel::RakeWorker.supervise_as(rake_actor_id,
21
+ actor_id: rake_actor_id,
22
+ job_id: job_id) if Celluloid::Actor[rake_actor_id].blank?
23
+ Celluloid::Actor[rake_actor_id]
24
+ end
25
+
26
+ def run_the_actor(task, &block)
27
+ actor.work(ENV, task: task)
28
+ actor.wait_execution until actor.task_approved
29
+ return unless actor.task_approved
30
+ stringio = StringIO.new
31
+ CapistranoMulticonfigParallel::OutputStream.hook(stringio)
32
+ CapistranoMulticonfigParallel::InputStream.hook(actor, stringio)
33
+ block.call
34
+ CapistranoMulticonfigParallel::InputStream.unhook
35
+ CapistranoMulticonfigParallel::OutputStream.unhook
36
+ end
36
37
 
37
38
 
38
39
 
@@ -1,7 +1,7 @@
1
1
  module CapistranoMulticonfigParallel
2
2
  class InputStream
3
- def self.hook(actor)
4
- $stdin = new($stdin, actor)
3
+ def self.hook(actor, stringio)
4
+ $stdin = new($stdin, actor, stringio)
5
5
  end
6
6
 
7
7
  def self.unhook
@@ -9,15 +9,18 @@ module CapistranoMulticonfigParallel
9
9
  $stdin = STDIN
10
10
  end
11
11
 
12
- attr_accessor :real, :actor
12
+ attr_accessor :real, :actor, :stringio
13
13
 
14
- def initialize(real_stdin, actor)
14
+ def initialize(real_stdin, actor, stringio)
15
15
  self.real = real_stdin
16
16
  self.actor = actor
17
+ self.stringio = stringio
17
18
  end
18
19
 
19
20
  def gets(*args)
20
- @actor.wait_for_stdin_input
21
+ @stringio.rewind
22
+ data = @stringio.read
23
+ @actor.user_prompt_needed?(data)
21
24
  end
22
25
 
23
26
  def finish
@@ -1,7 +1,7 @@
1
1
  module CapistranoMulticonfigParallel
2
2
  class OutputStream
3
- def self.hook(actor)
4
- $stdout = new($stdout, actor)
3
+ def self.hook(stringio)
4
+ $stdout = new($stdout, stringio)
5
5
  end
6
6
 
7
7
  def self.unhook
@@ -9,18 +9,17 @@ module CapistranoMulticonfigParallel
9
9
  $stdout = STDOUT
10
10
  end
11
11
 
12
- attr_accessor :real, :actor, :strings
12
+ attr_accessor :real, :stringio
13
13
 
14
- def initialize(real_stdout, actor)
14
+ def initialize(real_stdout, stringio)
15
15
  self.real= real_stdout
16
- self.actor = actor
17
- self.strings = []
16
+ self.stringio = stringio
18
17
  end
19
18
 
20
19
  def write(*args)
20
+ @stringio.print(*args)
21
21
  @real.write(*args)
22
22
  @real.flush
23
- @actor.user_prompt_needed?(args.join(' '))
24
23
  end
25
24
 
26
25
 
@@ -8,7 +8,7 @@ module CapistranoMulticonfigParallel
8
8
  module VERSION
9
9
  MAJOR = 0
10
10
  MINOR = 9
11
- TINY = 0
11
+ TINY = 1
12
12
  PRE = nil
13
13
 
14
14
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
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.9.0
4
+ version: 0.9.1
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-12 00:00:00.000000000 Z
11
+ date: 2015-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid-pmap