csv-utils 0.1.3 → 0.1.4

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
- SHA1:
3
- metadata.gz: d2ec5906d30d2be8c744e4311fc0c7af0f58a5f4
4
- data.tar.gz: bcd816369f3e2698e30b372e3dc9c5a74a30b02f
2
+ SHA256:
3
+ metadata.gz: 9680eb915003bdf0ea797d2aa736ce5069c4cbbf2f5cfe9f6b0c504701b178cd
4
+ data.tar.gz: 211e3c84c56aa414fa57ca9b6b15e227f3f4089b2e9bf0a8a4e4d19def5d1a81
5
5
  SHA512:
6
- metadata.gz: 44b66f060cbba4c1c2d48d62e40f6b17d437334633199e4de22988100dbd74b4bba92b9c03247bd284c562bf57b1ffdc0823e05d4591781f2cb01882fdaecc55
7
- data.tar.gz: 14aba3fd327f3f03d9e82a3a189791aa1cc84985cd78fbb752dac8d03373868af92919a8e87e900e6e4765c3e41291a2203515cc4fc365c605fd4639df60fd59
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 =~ /Missing or stray quote in line (\d+)/ ||
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
- opened_quote = true
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'csv-utils'
5
- s.version = '0.1.3'
5
+ s.version = '0.1.4'
6
6
  s.summary = 'CSV Utils'
7
7
  s.description = 'Tools for debugging malformed CSV files'
8
8
  s.authors = ['Doug Youch']
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.3
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-04-19 00:00:00.000000000 Z
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
- rubyforge_project:
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