struggle 2.3.7 → 2.3.8

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/struggle/sql.rb +9 -12
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a452bc1852b7b410115dfdcd030abca2188f4695
4
- data.tar.gz: c61ce12a7b2de6d6d10c4caa38c30dfd52d052f1
3
+ metadata.gz: a89438c6c72b1a4d8bbe6ddc7cc3b1f08f0ee20f
4
+ data.tar.gz: 1d2d6c93ef994ad1181336fee20b2787fce06385
5
5
  SHA512:
6
- metadata.gz: dc0eac6bae646c04d5f3557caab40bbc42a7d6f7cb2cc559aedaee81013b73bcd2dfbee99e0917e785d04f31a59a6c35b99f9a729819ce157bf340bbd8cdc0f1
7
- data.tar.gz: 237a20d3a4ecbfe8c9ceaa1a9bbdea9a0cf6d4011619de9681c6f1d2036d9291c72b1f95014beaafe1119dd7e9a348b005d71e97a3e6450c3f9b59cff6931b6c
6
+ metadata.gz: 426860d803e6bd015244adddb63d7ea3815598b8abccc12da3cc777d56bf7b3ade409b02b503a8d188b2737c46f52ca10337104daa508c307b17436d655ea664
7
+ data.tar.gz: 057131b1545971cdd33a81d2b9c734cfefec72c9439725ecfdbb93ebe8b54059f36296b061f90df8ce19bfd13ef812e18e190096c48b68a5ea21d20717836835
data/lib/struggle/sql.rb CHANGED
@@ -15,7 +15,7 @@ module Struggle
15
15
  # config => {"class_name": ["Member"], "file": "1.sql","adapter": "oracle"}
16
16
  # class_name is ActiveRecord; file is backup sql file
17
17
  def dump(config)
18
- sqlinsert = ""
18
+ config["file"] = config["file"].blank? ? "db.sql" : config["file"]
19
19
  config["class_name"].each do |class_name|
20
20
  obj = eval(class_name)
21
21
  obj.all.each do |o|
@@ -36,17 +36,14 @@ module Struggle
36
36
  end
37
37
  values << value
38
38
  end
39
- sqlinsert += "INSERT INTO #{obj.table_name} (#{names.join(',')}) VALUES (#{values.join(',')});\r\n"
40
- end
41
- end
42
- unless sqlinsert.blank?
43
- config["file"] = config["file"].blank? ? "db.sql" : config["file"]
44
- begin
45
- f = File.new(config["file"], "w+")
46
- f.write(sqlinsert)
47
- f.close
48
- rescue
49
- return "#{$!}:#{config["file"]}"
39
+ begin
40
+ f = File.new(config["file"], "w+")
41
+ f.write("INSERT INTO #{obj.table_name} (#{names.join(',')}) VALUES (#{values.join(',')});\r\n")
42
+ f.close
43
+ f = nil
44
+ rescue
45
+ return "#{$!}:#{config["file"]}"
46
+ end
50
47
  end
51
48
  end
52
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: struggle
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.7
4
+ version: 2.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - lean
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-19 00:00:00.000000000 Z
11
+ date: 2018-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iconv