csv-utils 0.3.16 → 0.3.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cda417e397f1791d177bb6eadd107edfdcd31a6680a3d2fef07b5be6df91dd6c
4
- data.tar.gz: 7dee11a2b59738a8ad1ea9f692ef2da6472bab65039fbeed630c34d369a952c0
3
+ metadata.gz: 64f2fb9f8282fcb5ba93856ab707e9797ddb4f0195c46ae5564b455527315157
4
+ data.tar.gz: a6ccb029fd622dfa4906d644a32ec98bd5ff4deecd35869f0adb76f00445ce2b
5
5
  SHA512:
6
- metadata.gz: af9f536d693cdcac8db949cbec1981b38637149927910b59aa570becef637cbae54c5371bc9d6031698c993e536c063b0ba89a0ca1be6c6d6ca7056e4326cc83
7
- data.tar.gz: f48853f7756f3a7e36c34e37fd38ce611db880fb5e083340eedf817800f094dcd7900b89f3f7edab2eb8eac6e2c837e9209ec3dba1cc79d95d2f065f36b15d45
6
+ metadata.gz: 84721ad624e58a68fe4027a596748982531df61640e944b1bb52e2b6adae3ca64d36584a98a3ea74306272f03da3deaec9a32d89497ac73b4051adb559597fb0
7
+ data.tar.gz: 1f0097b68da9fee5b4765f7280e8a249318f9d6c2c215ac1174f9a035992b497b31f150e9caf1fd439bffe27fc868bd120ea1b9bf4a521786dc84b29aa82e030
data/bin/csv-diff CHANGED
@@ -104,7 +104,7 @@ end
104
104
 
105
105
  stats = Hash.new(0)
106
106
  puts "comparing #{ARGV[0]} with #{ARGV[1]}"
107
- diff_file_name = 'diff-results-' + ARGV[0]
107
+ diff_file_name = 'diff-results-' + File.basename(ARGV[0])
108
108
  CSV.open(diff_file_name, 'wb') do |out|
109
109
  out << ['Result'] + csv1.first.keys
110
110
  comparer.compare(csv2_sorted_file_name) do |action, record|
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.3.16'
5
+ s.version = '0.3.17'
6
6
  s.licenses = ['MIT']
7
7
  s.summary = 'CSV Utils'
8
8
  s.description = 'Tools for debugging malformed CSV files'
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # CSVUtils::CSVCompare purpose is to determine which rows in the secondary_data_file need to be created, deleted or updated
4
2
  # **requires both CSV files to be sorted on the same columns, CSVUtils::CSVSort can accomplish this
5
3
  # In order to receive updates, update_comparison_columns must configured or use inheritance and change the update_row? method
@@ -19,10 +17,12 @@ class CSVUtils::CSVCompare
19
17
  end
20
18
 
21
19
  def compare(secondary_data_file)
22
- src = CSV.open(primary_data_file)
20
+ src = CSV.open(primary_data_file, 'rb')
23
21
  src_headers = src.shift
24
- dest = CSV.open(secondary_data_file)
22
+ strip_bom!(src_headers[0])
23
+ dest = CSV.open(secondary_data_file, 'rb')
25
24
  dest_headers = dest.shift
25
+ strip_bom!(dest_headers[0])
26
26
 
27
27
  read_next_src = true
28
28
  read_next_dest = true
@@ -80,4 +80,8 @@ class CSVUtils::CSVCompare
80
80
 
81
81
  false
82
82
  end
83
+
84
+ def strip_bom!(col)
85
+ col.sub!("\xEF\xBB\xBF".force_encoding('ASCII-8BIT'), '')
86
+ end
83
87
  end
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.3.16
4
+ version: 0.3.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-15 00:00:00.000000000 Z
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inheritance-helper