csv-utils 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/csv-find-error +1 -2
- data/bin/csv-readline +13 -1
- data/csv-utils.gemspec +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9680eb915003bdf0ea797d2aa736ce5069c4cbbf2f5cfe9f6b0c504701b178cd
|
4
|
+
data.tar.gz: 211e3c84c56aa414fa57ca9b6b15e227f3f4089b2e9bf0a8a4e4d19def5d1a81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebb5a02c8ad2f63c512fe9b0e03e3dadc00d6fe09c96260e4da28a2986efc7bc6d9414d7e03893df39bf9a83f3d25a92da7b6e81a47225fd466d9bf9acb09cc0
|
7
|
+
data.tar.gz: 470637ff20a19c7674604a0afca3654f41c9d8bed496af1198e2dc0fe6c8aa5e9ccacf32e27d9c3cacba0e77914b585463a3644beff9d4eec54e0aaf18ebb9a1
|
data/bin/csv-find-error
CHANGED
@@ -7,8 +7,7 @@ begin
|
|
7
7
|
CSV.open(ARGV[0], 'rb').each { }
|
8
8
|
rescue CSV::MalformedCSVError => e
|
9
9
|
puts e.class.to_s + ': ' + e.message
|
10
|
-
if e.message =~ /
|
11
|
-
e.message =~ /Unclosed quoted field on line (\d+)/
|
10
|
+
if e.message =~ /line (\d+)/
|
12
11
|
lineno = $1.to_i
|
13
12
|
cmd = "csv-readline #{Shellwords.escape(ARGV[0])} #{lineno}"
|
14
13
|
puts "running #{cmd}"
|
data/bin/csv-readline
CHANGED
@@ -47,7 +47,19 @@ def csv_parse_line(line)
|
|
47
47
|
# return columns
|
48
48
|
end
|
49
49
|
else
|
50
|
-
|
50
|
+
if (last_comma_pos == -1 && pos != 0) ||
|
51
|
+
(last_comma_pos != -1 && line[pos-1] != ',')
|
52
|
+
col_end = line.index(/,/, pos + 1)
|
53
|
+
col_end ||= line.size - 1
|
54
|
+
# slice out the column value
|
55
|
+
val = line[last_comma_pos + 1, col_end - last_comma_pos - 1]
|
56
|
+
columns << [val, :stray_quote]
|
57
|
+
opened_quote = false
|
58
|
+
last_comma_pos = col_end
|
59
|
+
pos = col_end
|
60
|
+
else
|
61
|
+
opened_quote = true
|
62
|
+
end
|
51
63
|
end
|
52
64
|
when ','
|
53
65
|
if ! opened_quote
|
data/csv-utils.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Doug Youch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Tools for debugging malformed CSV files
|
14
14
|
email: dougyouch@gmail.com
|
@@ -42,8 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '0'
|
44
44
|
requirements: []
|
45
|
-
|
46
|
-
rubygems_version: 2.5.2.3
|
45
|
+
rubygems_version: 3.0.3
|
47
46
|
signing_key:
|
48
47
|
specification_version: 4
|
49
48
|
summary: CSV Utils
|