csv2avro 1.0.1 → 1.0.2
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/csv2avro.gemspec +2 -2
- data/lib/csv2avro/converter.rb +7 -4
- data/lib/csv2avro/version.rb +1 -1
- data/spec/csv2avro_spec.rb +4 -2
- data/spec/support/data.csv +7 -4
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dd5ca9e046d1e46a845614350ad1e0e2dcdd8a6
|
4
|
+
data.tar.gz: 0c7eefec78b9293b6f1ed954fb22b5ec6b6506ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abbed521cda772e04453d95ec559f37e1e45b84f1fbe46e600e5a1ec0333abdbf28978b31946a451ab87701de4af089787f68b316262152bb00f6d9ceefe1048
|
7
|
+
data.tar.gz: 683f680b56c5c06f0217ca5c6f2ff384b228435175327d746545601636844755a5832cf904c420f004bcc4a0cbb4d751eaf1ddeefe4eeeaa334c6418b8633a02
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
All notable changes to this project are documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## 1.0.2 (2015-06-29; [compare](https://github.com/sspinc/csv2avro/compare/1.0.1...1.0.2))
|
7
|
+
|
8
|
+
### Fixed
|
9
|
+
* Continue on parsing errors
|
10
|
+
|
6
11
|
## 1.0.1 (2015-06-12; [compare](https://github.com/sspinc/csv2avro/compare/1.0.0...1.0.1))
|
7
12
|
|
8
13
|
### Fixed
|
data/csv2avro.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'csv2avro/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "csv2avro"
|
8
8
|
spec.version = CSV2Avro::VERSION
|
9
|
-
spec.authors = ["Peter Ableda"]
|
10
|
-
spec.email = ["scotty@secretsaucepartners.com"]
|
9
|
+
spec.authors = ["Peter Ableda", "Peter Marton"]
|
10
|
+
spec.email = ["scotty@secretsaucepartners.com", "martonpe@secretsaucepartners.com"]
|
11
11
|
spec.summary = %q{Convert CSV files to Avro}
|
12
12
|
spec.description = %q{Convert CSV files to Avro like a boss.}
|
13
13
|
spec.homepage = ""
|
data/lib/csv2avro/converter.rb
CHANGED
@@ -17,7 +17,13 @@ class CSV2Avro
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def convert
|
20
|
-
csv.
|
20
|
+
while not csv.eof? do
|
21
|
+
begin
|
22
|
+
row = csv.shift
|
23
|
+
rescue CSV::MalformedCSVError
|
24
|
+
@error_writer.puts("line #{line_number}: Unable to parse")
|
25
|
+
next
|
26
|
+
end
|
21
27
|
hash = row.to_hash
|
22
28
|
|
23
29
|
add_defaults_to_hash!(hash) if @options[:write_defaults]
|
@@ -33,10 +39,7 @@ class CSV2Avro
|
|
33
39
|
end
|
34
40
|
end
|
35
41
|
end
|
36
|
-
|
37
42
|
@writer.flush
|
38
|
-
rescue CSV::MalformedCSVError
|
39
|
-
@error_writer.puts("line #{line_number}: Unable to parse")
|
40
43
|
end
|
41
44
|
|
42
45
|
private
|
data/lib/csv2avro/version.rb
CHANGED
data/spec/csv2avro_spec.rb
CHANGED
@@ -10,7 +10,7 @@ RSpec.describe CSV2Avro do
|
|
10
10
|
subject(:converter) { CSV2Avro.new(options) }
|
11
11
|
|
12
12
|
it 'should write errors to STDERR' do
|
13
|
-
expect { converter.convert }.to output("line 4: Missing value at name\nline
|
13
|
+
expect { converter.convert }.to output("line 4: Missing value at name\nline 7: Unable to parse\n").to_stderr
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should have a bad row' do
|
@@ -24,7 +24,9 @@ RSpec.describe CSV2Avro do
|
|
24
24
|
expect(AvroReader.new(file).read).to eq(
|
25
25
|
[
|
26
26
|
{ 'id'=>1, 'name'=>'dresses', 'description'=>'Dresses' },
|
27
|
-
{ 'id'=>2, 'name'=>'female-tops', 'description'=>nil }
|
27
|
+
{ 'id'=>2, 'name'=>'female-tops', 'description'=>nil },
|
28
|
+
{ 'id'=>4, 'name'=>'male-tops', 'description'=>"Male Tops\nand Male Shirts"},
|
29
|
+
{ 'id'=>6, 'name'=>'male-shoes', 'description'=>'Male Shoes'}
|
28
30
|
]
|
29
31
|
)
|
30
32
|
end
|
data/spec/support/data.csv
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
id,name,description
|
2
|
-
1,dresses,
|
3
|
-
2,female-tops,
|
4
|
-
3,,"Bras"
|
5
|
-
4,male-tops,"Male Tops
|
2
|
+
1,dresses,Dresses
|
3
|
+
"2","female-tops",
|
4
|
+
"3",,"Bras"
|
5
|
+
"4","male-tops","Male Tops
|
6
|
+
and Male Shirts"
|
7
|
+
"5","female-shoes","\"Shoes\" for women"
|
8
|
+
"6","male-shoes","Male Shoes"
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv2avro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ableda
|
8
|
+
- Peter Marton
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
12
|
+
date: 2015-06-30 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -97,6 +98,7 @@ dependencies:
|
|
97
98
|
description: Convert CSV files to Avro like a boss.
|
98
99
|
email:
|
99
100
|
- scotty@secretsaucepartners.com
|
101
|
+
- martonpe@secretsaucepartners.com
|
100
102
|
executables:
|
101
103
|
- csv2avro
|
102
104
|
extensions: []
|