ridgepole 0.6.5.beta4 → 0.6.5.beta5

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: 6eb5cd9b6da53e0af2afd188637a9196f5a59b6c
4
- data.tar.gz: c0c798186e1cd37c7e1881278270d82f200020bd
3
+ metadata.gz: 21fa98bc837610d82369574a6b91ba5a15d166f9
4
+ data.tar.gz: 09fda9b7559d215577b5d3bb4f88752430ca6f06
5
5
  SHA512:
6
- metadata.gz: 34b3eca50c3aadbf464e4a23f3c5a16c1f8022709fd02df91992212b083eb3080ed50e06556d216405d462f2288948c617c21e1dfc15a2cea567d5d062692712
7
- data.tar.gz: da081d87c9e157c515bfd81acd1363b3586bf532861f480ac627ba1e936e2b65d606b8751220ca2b1917282fc2ccd44f2507a5f1aa4581107f7481674f948abd
6
+ metadata.gz: 3d36ce28a343c134734b381ad56872c6e98c193cf46f5588a608902f302da995a14c260e7853acffdd635ba9b1aa4a132625d87b0ae88735055e7c28baf87bb8
7
+ data.tar.gz: 6eb7adbec627ea39c793e588e8dc2703e21d1879f147ce7cc881b7bb134dd1307b5b8635f8b1c5547907d6262bd227566f4c3de48b579eda563e9fdb56ca2d1b
@@ -7,16 +7,36 @@ class Ridgepole::ExternalSqlExecuter
7
7
  def execute(sql)
8
8
  cmd = Shellwords.join([@script, sql, JSON.dump(ActiveRecord::Base.connection_config)])
9
9
  @logger.info("Execute #{@script}")
10
+ script_basename = File.basename(@script)
10
11
 
11
- out, err, status = Open3.capture3(cmd)
12
- out.strip!
13
- err.strip!
12
+ Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
13
+ stdin.close_write
14
14
 
15
- @logger.info("#{@script}: #{out}") unless out.empty?
16
- @logger.warn("[WARNING] #{@script}: #{err}") unless err.empty?
15
+ begin
16
+ loop do
17
+ IO.select([stdout, stderr]).flatten.compact.each do |io|
18
+ io.each do |line|
19
+ next if line.nil?
20
+ line.strip!
17
21
 
18
- unless status.success?
19
- raise "`#{@script}` execution failed"
22
+ if io == stderr
23
+ @logger.warn("[WARNING] #{script_basename}: #{line}")
24
+ else
25
+ @logger.info("#{script_basename}: #{line}")
26
+ end
27
+ end
28
+ end
29
+
30
+ if stdout.eof? and stderr.eof?
31
+ break
32
+ end
33
+ end
34
+ rescue EOFError
35
+ end
36
+
37
+ unless wait_thr.value.success?
38
+ raise "`#{@script}` execution failed"
39
+ end
20
40
  end
21
41
  end
22
42
  end
@@ -1,3 +1,3 @@
1
1
  module Ridgepole
2
- VERSION = '0.6.5.beta4'
2
+ VERSION = '0.6.5.beta5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridgepole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5.beta4
4
+ version: 0.6.5.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-04 00:00:00.000000000 Z
11
+ date: 2016-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord