postgres-copy 0.9.3 → 1.0.0

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: c064e83b064a962f749165e06ad83941d59a37fc
4
- data.tar.gz: 8806085448467f19b4b3f2b26261dc162fd6848b
3
+ metadata.gz: 6eeedb4ef6807baf6f855bfe8d82f56133c66be6
4
+ data.tar.gz: 464932914ca5a675064001c803d18ff1dc9fe53d
5
5
  SHA512:
6
- metadata.gz: 418a1a28e7fea22fd33e24622441687acffd8ae1b2136667a4599db27d11118a015c37e1afa85e59339a606ebc0ce332009be20acfe7170bcc710d3b3b74b95c
7
- data.tar.gz: 4a8a22207a55e1e55a277f8a5928aa3269fa27c2d458259c3e492e3722906b3bf7eab17b75c53f3bc5768f448e7894943a7523d43e4920e270fe28c87e75d5f8
6
+ metadata.gz: 014a139cab1e421966b374b7eeeff23da62bea3fd4353501b069b4152d55352e6bf851bb544f33ca250fa1de3ba8068356c6097450c56ed1c991712fee785bc1
7
+ data.tar.gz: 14e13dc7163ad4c32448d0590278b16b836771da3df6fcec4ee869ded14dcaa62de5667e1274ac6af3e316e3901058c1c432c2b7e5c6ccf2b25ff0e53ca54dfd
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- postgres-copy (0.9.3)
4
+ postgres-copy (1.0.0)
5
5
  activerecord (>= 4.0)
6
6
  pg (>= 0.17)
7
7
  rails (>= 4.0)
@@ -10,84 +10,84 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actionmailer (4.2.3)
14
- actionpack (= 4.2.3)
15
- actionview (= 4.2.3)
16
- activejob (= 4.2.3)
13
+ actionmailer (4.2.4)
14
+ actionpack (= 4.2.4)
15
+ actionview (= 4.2.4)
16
+ activejob (= 4.2.4)
17
17
  mail (~> 2.5, >= 2.5.4)
18
18
  rails-dom-testing (~> 1.0, >= 1.0.5)
19
- actionpack (4.2.3)
20
- actionview (= 4.2.3)
21
- activesupport (= 4.2.3)
19
+ actionpack (4.2.4)
20
+ actionview (= 4.2.4)
21
+ activesupport (= 4.2.4)
22
22
  rack (~> 1.6)
23
23
  rack-test (~> 0.6.2)
24
24
  rails-dom-testing (~> 1.0, >= 1.0.5)
25
25
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
26
- actionview (4.2.3)
27
- activesupport (= 4.2.3)
26
+ actionview (4.2.4)
27
+ activesupport (= 4.2.4)
28
28
  builder (~> 3.1)
29
29
  erubis (~> 2.7.0)
30
30
  rails-dom-testing (~> 1.0, >= 1.0.5)
31
31
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
32
- activejob (4.2.3)
33
- activesupport (= 4.2.3)
32
+ activejob (4.2.4)
33
+ activesupport (= 4.2.4)
34
34
  globalid (>= 0.3.0)
35
- activemodel (4.2.3)
36
- activesupport (= 4.2.3)
35
+ activemodel (4.2.4)
36
+ activesupport (= 4.2.4)
37
37
  builder (~> 3.1)
38
- activerecord (4.2.3)
39
- activemodel (= 4.2.3)
40
- activesupport (= 4.2.3)
38
+ activerecord (4.2.4)
39
+ activemodel (= 4.2.4)
40
+ activesupport (= 4.2.4)
41
41
  arel (~> 6.0)
42
- activesupport (4.2.3)
42
+ activesupport (4.2.4)
43
43
  i18n (~> 0.7)
44
44
  json (~> 1.7, >= 1.7.7)
45
45
  minitest (~> 5.1)
46
46
  thread_safe (~> 0.3, >= 0.3.4)
47
47
  tzinfo (~> 1.1)
48
- arel (6.0.0)
48
+ arel (6.0.3)
49
49
  builder (3.2.2)
50
50
  diff-lcs (1.2.5)
51
51
  erubis (2.7.0)
52
- globalid (0.3.5)
52
+ globalid (0.3.6)
53
53
  activesupport (>= 4.1.0)
54
54
  i18n (0.7.0)
55
55
  json (1.8.1)
56
- loofah (2.0.2)
56
+ loofah (2.0.3)
57
57
  nokogiri (>= 1.5.9)
58
58
  mail (2.6.3)
59
59
  mime-types (>= 1.16, < 3)
60
- mime-types (2.6.1)
60
+ mime-types (2.6.2)
61
61
  mini_portile (0.6.2)
62
- minitest (5.7.0)
62
+ minitest (5.8.1)
63
63
  nokogiri (1.6.6.2)
64
64
  mini_portile (~> 0.6.0)
65
- pg (0.18.2)
65
+ pg (0.18.3)
66
66
  rack (1.6.4)
67
67
  rack-test (0.6.3)
68
68
  rack (>= 1.0)
69
- rails (4.2.3)
70
- actionmailer (= 4.2.3)
71
- actionpack (= 4.2.3)
72
- actionview (= 4.2.3)
73
- activejob (= 4.2.3)
74
- activemodel (= 4.2.3)
75
- activerecord (= 4.2.3)
76
- activesupport (= 4.2.3)
69
+ rails (4.2.4)
70
+ actionmailer (= 4.2.4)
71
+ actionpack (= 4.2.4)
72
+ actionview (= 4.2.4)
73
+ activejob (= 4.2.4)
74
+ activemodel (= 4.2.4)
75
+ activerecord (= 4.2.4)
76
+ activesupport (= 4.2.4)
77
77
  bundler (>= 1.3.0, < 2.0)
78
- railties (= 4.2.3)
78
+ railties (= 4.2.4)
79
79
  sprockets-rails
80
80
  rails-deprecated_sanitizer (1.0.3)
81
81
  activesupport (>= 4.2.0.alpha)
82
- rails-dom-testing (1.0.6)
82
+ rails-dom-testing (1.0.7)
83
83
  activesupport (>= 4.2.0.beta, < 5.0)
84
84
  nokogiri (~> 1.6.0)
85
85
  rails-deprecated_sanitizer (>= 1.0.1)
86
86
  rails-html-sanitizer (1.0.2)
87
87
  loofah (~> 2.0)
88
- railties (4.2.3)
89
- actionpack (= 4.2.3)
90
- activesupport (= 4.2.3)
88
+ railties (4.2.4)
89
+ actionpack (= 4.2.4)
90
+ activesupport (= 4.2.4)
91
91
  rake (>= 0.8.7)
92
92
  thor (>= 0.18.1, < 2.0)
93
93
  rake (10.4.2)
@@ -103,9 +103,9 @@ GEM
103
103
  rspec-expectations (2.99.0)
104
104
  diff-lcs (>= 1.1.3, < 2.0)
105
105
  rspec-mocks (2.99.1)
106
- sprockets (3.2.0)
107
- rack (~> 1.0)
108
- sprockets-rails (2.3.2)
106
+ sprockets (3.3.5)
107
+ rack (> 1, < 3)
108
+ sprockets-rails (2.3.3)
109
109
  actionpack (>= 3.0)
110
110
  activesupport (>= 3.0)
111
111
  sprockets (>= 2.8, < 4.0)
@@ -85,6 +85,7 @@ module PostgresCopy
85
85
  if block_given?
86
86
  row = line.strip.split(options[:delimiter],-1)
87
87
  yield(row)
88
+ next if row.all?{|f| f.nil? }
88
89
  line = row.join(options[:delimiter]) + "\n"
89
90
  end
90
91
  connection.raw_connection.put_copy_data line
@@ -5,7 +5,7 @@ $:.unshift lib unless $:.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "postgres-copy"
8
- s.version = "0.9.3"
8
+ s.version = "1.0.0"
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.required_ruby_version = ">= 1.9.3"
11
11
  s.authors = ["Diogo Biazus"]
@@ -79,6 +79,15 @@ describe "COPY FROM" do
79
79
  TestModel.order(:id).map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'test data 1'}]
80
80
  end
81
81
 
82
+ it "should ignore all-nil rows" do
83
+ lambda do
84
+ TestModel.copy_from(File.open(File.expand_path('spec/fixtures/tab_with_error.csv'), 'r'), :delimiter => "\t") do |row|
85
+ 0.upto(row.length) {|idx| row[idx] = nil}
86
+ end
87
+ end.should_not raise_error
88
+ TestModel.order(:id).map{|r| r.attributes}.should == []
89
+ end
90
+
82
91
  #we should implement this later
83
92
  #it "should raise error in malformed files" do
84
93
  #lambda do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postgres-copy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diogo Biazus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-30 00:00:00.000000000 Z
11
+ date: 2015-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  requirements: []
174
174
  rubyforge_project:
175
- rubygems_version: 2.4.5
175
+ rubygems_version: 2.4.5.1
176
176
  signing_key:
177
177
  specification_version: 4
178
178
  summary: Put COPY command functionality in ActiveRecord's model class