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 +4 -4
- data/bin/csv-diff +1 -1
- data/csv-utils.gemspec +1 -1
- data/lib/csv_utils/csv_compare.rb +8 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64f2fb9f8282fcb5ba93856ab707e9797ddb4f0195c46ae5564b455527315157
|
4
|
+
data.tar.gz: a6ccb029fd622dfa4906d644a32ec98bd5ff4deecd35869f0adb76f00445ce2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
@@ -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
|
-
|
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.
|
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-
|
11
|
+
date: 2022-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inheritance-helper
|