dohmysql 0.2.34 → 0.2.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dohmysql/load_sql.rb +9 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 781550d6ef60c6d499005d5b89634c70a760a250
4
- data.tar.gz: a59db4a488222896c14c6b1b27bd0363b947a285
3
+ metadata.gz: 67233ea9d63a00d86fef0a03eae15851a19bdad5
4
+ data.tar.gz: 58d2659c41deede9a881d74ffd8c2d3f587f0808
5
5
  SHA512:
6
- metadata.gz: d4ff31f3263f689a4be21cf9c032e906280500ffc3814d459d02646665c062ed3958d82cd9dd82cac0c24f0b14ebab8ee6b8bcfd063da746db55cc5b6c23c91f
7
- data.tar.gz: 0d5716c9067c15684993be13a4f5e4949300f9e0ceb72073f3a74e0ff572d5971525a318ea38c1edf528151a142656cdb37351320f79c44e0fb53df1178e04ce
6
+ metadata.gz: 2b59b5b8efa61a7aa8a3e07173a5f6ef98478e3472726831c6b54b499870e88b82443e31f5574683c1551ba673802a7be28f6c7a33f9f0132e116369863aa429
7
+ data.tar.gz: 2cacdfa41e2e855c7943eb2035d7d7a0bcc61664a4f70c36a9dc0ff3b90923b4a0bf7e21242b7b542056f7b2897bbc0e99fff0dc9eb15f25a06a1175f27bb404
@@ -37,18 +37,21 @@ def self.load_sql(dbconfig, filenames)
37
37
  end
38
38
  end
39
39
 
40
- # trying Open3 now for better error handling; unknown as of yet if this works under JRuby
41
40
  def self.load_sql_using_each_open3(dbconfig, filenames)
42
41
  dohlog.debug("loading sql file: " + filenames.first) if filenames.size == 1
43
42
 
44
43
  basecmd = 'mysql' + mysql_arg(dbconfig[:host], 'h') + mysql_arg(dbconfig[:username], 'u') + mysql_arg(dbconfig[:password], 'p') + ' ' + dbconfig[:database] + ' < '
45
44
  filenames.each do |elem|
46
45
  mysqlcmd = "#{basecmd} #{elem}"
47
- stdin, stdout, stderr = Open3.popen3(mysqlcmd)
48
- stdoutstr = stdout.read
49
- stdout.close
50
- stderrstr = stderr.read
51
- raise "#{stderrstr} occured while loading file: #{elem}" if !stderrstr.empty?
46
+ Open3.popen3(mysqlcmd) do |stdin, stdout, stderr, wait_thr|
47
+ # don't care about any stdout
48
+ stdout.read
49
+ errstr = stderr.read.strip
50
+ errstr = '' if errstr == 'Warning: Using a password on the command line interface can be insecure.'
51
+ status = wait_thr.value.exitstatus
52
+ raise "mysql had stderr #{errstr}" unless errstr.empty?
53
+ raise "mysql command failed with exit code #{status}" unless status == 0
54
+ end
52
55
  end
53
56
  end
54
57
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dohmysql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.34
4
+ version: 0.2.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Makani Mason
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-01 00:00:00.000000000 Z
12
+ date: 2013-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dohroot