ndr_import 11.0.0 → 11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52ae4b12ab514a7bda584c93b3124fdeab03cea5292424c0e380c92f6e3a3c1a
4
- data.tar.gz: 4b9dff76aa434bb87e542bcf694d4f99a91b2cd69e2eeaf6730a32b78fe61cc9
3
+ metadata.gz: ab2194b39d6226b9c8883f89ef30045c714fe276cdd5312f0b53f643cebbc003
4
+ data.tar.gz: 54433f513c6a6fb546f2f1b217d711214e44e1c30f488d1d00f9a67f41b94c0b
5
5
  SHA512:
6
- metadata.gz: 27e3c4578ab466ae9977727de5b972e8e5bf7e2f9fa62ab53cd60437e4d7232e5da3ce3afbcf6b94dd943b219b051ccc6177b73189e736ecf8d10f582f6f0bc9
7
- data.tar.gz: b06ef69bba53f56314574ff9749011289180624d0f73f7660537610ba29e3ec01114810bc781ccb8c67440c30f1406a05c56e508299a026a7467bb7968d4cb16
6
+ metadata.gz: 6c60e8a7a9abd7e30ff754898e6c332f150133488ab5837cdf030bff483db6b3eda6196bb42a2bb42099104690d2621c1b9ad39580313ff82c66f813043f2843
7
+ data.tar.gz: 4094561f3f994b0a82ee974f5eba00f6e70fdf219c311534ab070dc5da8f861a4dbe73d67842db2231766a18d0a1721cd13e9a8e46a9910987e450f388f06369
data/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
1
  ## [Unreleased]
2
2
  =======
3
- *no unreleased changes*
3
+ * no unreleased changes*
4
+
5
+ ## 11.0.2 / 2024-02-06
6
+ ### Fixed
7
+ * Resolve Rails 7 deprecation warnings
8
+ * Fix XML parsing with latest `nokogiri` 1.16.0
9
+
10
+ ## 11.0.1 / 2023-10-30
11
+ ### Fixed
12
+ * Ensure autogenerated XML column mappings are unique
4
13
 
5
14
  ## 11.0.0 / 2023-10-27
6
15
  ### Changed
7
16
  * XML enhancements. Breaking change, the enhancements are not backward compatible
8
17
  ### Fixed
9
- * Replace unsupported seven_zip_ruby gem with seven-zip fork
18
+ * Replace unsupported `seven_zip_ruby` gem with seven-zip fork
10
19
 
11
20
  ## 10.3.0 / 2023-09-07
12
21
  ### Added
@@ -46,7 +46,7 @@ module NdrImport
46
46
  end
47
47
 
48
48
  def cast_excel_datetime_as_date(raw_value)
49
- raw_value.to_s(:db)
49
+ raw_value.to_formatted_s(:db)
50
50
  end
51
51
 
52
52
  private
@@ -32,7 +32,7 @@ module NdrImport
32
32
  end
33
33
 
34
34
  def cast_excel_datetime_as_date(raw_value)
35
- raw_value.to_s(:db)
35
+ raw_value.to_formatted_s(:db)
36
36
  end
37
37
 
38
38
  # Iterate through the file table by table, yielding each one in turn.
@@ -22,6 +22,11 @@ module NdrImport
22
22
  doc = nil
23
23
 
24
24
  escaping_control_chars_if_necessary(preserve_control_chars, file_data) do
25
+ if Nokogiri::XML('<?xml version="1.0" encoding="UTF-16"?><body/>').
26
+ errors.first.message.match?(/Blank needed here\z/)
27
+ # Nokogiri 1.16.0 workaround for UTF-16 data.
28
+ file_data.sub!('UTF-16', 'UTF-8')
29
+ end
25
30
  doc = Nokogiri::XML(file_data, &:huge)
26
31
  doc.encoding = 'UTF-8'
27
32
  emulate_strict_mode_fatal_check!(doc)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # This stores the current version of the NdrImport gem
3
3
  module NdrImport
4
- VERSION = '11.0.0'
4
+ VERSION = '11.0.2'
5
5
  end
@@ -57,19 +57,19 @@ module NdrImport
57
57
  end
58
58
  end
59
59
 
60
- # Append "_1", "_2" etc to repeating rawtext and optionally mapped field names within a
61
- # single record, so data is not overwritten
60
+ # Append "_1.1", "_2.1", "_1" etc to repeating rawtext and optionally mapped field names
61
+ # within a single record, so data is not overwritten
62
62
  def apply_new_rawtext_and_mapped_names_to(new_column)
63
63
  existing_rawtext = existing_column['rawtext_name'] || existing_column['column']
64
64
  column_name_increment = new_column['column'].scan(/\[(\d+)\]/)
65
65
  relative_path_increment = new_column.dig('xml_cell', 'relative_path').scan(/\[(\d+)\]/)
66
66
 
67
- # Find all the increments (e.g. [1], [2]) from the new column and use their sum
68
- # as the rawtext and column name increment
69
- increment = (column_name_increment + relative_path_increment).flatten.map(&:to_i).sum
70
- new_column['rawtext_name'] = existing_rawtext + "_#{increment}" unless increment.zero?
67
+ # Find all the increments (e.g. [1], [2]) from the new column and concatenate them to
68
+ # use as the rawtext and column name increment
69
+ increment = (column_name_increment + relative_path_increment).flatten.compact.join('.')
70
+ new_column['rawtext_name'] = existing_rawtext + "_#{increment}" if increment.present?
71
71
 
72
- return unless !increment.zero? && increment_field_name
72
+ return unless increment.present? && increment_field_name
73
73
 
74
74
  new_column['mappings'] = incremented_mappings_for(new_column, increment)
75
75
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ndr_import
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.0.0
4
+ version: 11.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - NCRS Development Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-27 00:00:00.000000000 Z
11
+ date: 2024-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -465,7 +465,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
465
465
  - !ruby/object:Gem::Version
466
466
  version: '0'
467
467
  requirements: []
468
- rubygems_version: 3.4.10
468
+ rubygems_version: 3.2.33
469
469
  signing_key:
470
470
  specification_version: 4
471
471
  summary: NDR Import