eco-helpers 3.2.11 → 3.2.12

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: 5831f19c9c5f01a132c28d27e543554f77f586aa7ea9c3d3387d2ca7ca83f72e
4
- data.tar.gz: 184d888c3702368bde62baf9d8075788712fb59ff35ece1a7299a98b2773b05c
3
+ metadata.gz: 91691c5a914be5eebeff46f776d9c5b720e8e9672317051f36b5995beff3977c
4
+ data.tar.gz: 1742764775b28b99f136e451cc79c68359924f7722752ccdae043cf7c1b7f6a9
5
5
  SHA512:
6
- metadata.gz: 414c7bc358e533cc09a28e98b196ceeeef018f083a0f851698328b85856ca12f2485f217b0c4ae54775fcf462dc7224882514472e04ab572601d3f1c1100c238
7
- data.tar.gz: 0f131cf7c826c73b83ed12d6677d2989031a99e3008254bf15fc234e1e86077818f586ea9ac40793376f892c9be1a04ac0e2d64eca3432275bf6122405ad9dfb
6
+ metadata.gz: 3c17e149406ae8ae64c94b623e10a6151d9f0fd4755e736281a89c098c3c6ff180d7f85560d62e63741f3166d283882352e50cf48841c22e4f2106a17e76f3f0
7
+ data.tar.gz: 25199fc81a46ff8897be9af805bb675a4ee3ca11b61439a91450639703583c1907e97513fd26e14375a30956166dcb2cb35161a56b920f221ff6d2efc69bcee4
data/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [3.2.12] - 2025-12-xx
5
+ ## [3.2.13] - 2026-01-xx
6
6
 
7
7
  ### Added
8
8
 
@@ -10,6 +10,21 @@ All notable changes to this project will be documented in this file.
10
10
 
11
11
  ### Fixed
12
12
 
13
+ ## [3.2.12] - 2026-01-19
14
+
15
+ ### Added
16
+
17
+ - **support** for native CSV RS-update headers
18
+ - **removed** case insensitiveness on header names
19
+ - `-tagtree-extract` cli option `-structure-id`
20
+ - To be able to target only one structure
21
+
22
+ ### Changed
23
+
24
+ ### Fixed
25
+
26
+ - Wrong option name `-default-tag` renamed to `-exclude-default-tag`
27
+
13
28
  ## [3.2.11] - 2025-12-04
14
29
 
15
30
  ### Fixed
@@ -26,6 +26,11 @@ class Eco::API::UseCases::Default::Locations::TagtreeExtract
26
26
  options.deep_merge!(output: {indent: indent})
27
27
  end
28
28
 
29
+ add_option('-structure-id', 'Target structure id') do |options|
30
+ id = SCR.get_arg('-structure-id', with_param: true)
31
+ options.deep_merge!(source: {structure_id: id})
32
+ end
33
+
29
34
  add_option('-file-as-source', 'Use a file as locations input (rather than the live locations)') do |options|
30
35
  file = SCR.get_file('-file-as-source', required: true, should_exist: true)
31
36
  options.deep_merge!(source: {file: file})
@@ -21,7 +21,11 @@ class Eco::API::UseCases::Default::Locations::TagtreeExtract < Eco::API::UseCase
21
21
  when :excel_tree, :excel_nodes
22
22
  excel(output_filename) do |workbook|
23
23
  tag_trees.each do |tree|
24
- excel_sheet(workbook, compact_name(tree.name), header: format == :excel_nodes) do |sheet|
24
+ excel_sheet(
25
+ workbook,
26
+ compact_name(tree.name),
27
+ header: format == :excel_nodes
28
+ ) do |sheet|
25
29
  tree_extract(tree).each_with_index do |row, _idx|
26
30
  sheet.append_row(row)
27
31
  end
@@ -121,9 +125,18 @@ class Eco::API::UseCases::Default::Locations::TagtreeExtract < Eco::API::UseCase
121
125
  end
122
126
 
123
127
  def retrieve_live_trees
124
- session.live_trees(include_archived: include_archived?).reject do |tree|
128
+ session.live_trees(
129
+ include_archived: include_archived?
130
+ ).reject do |tree|
131
+ next false if tree.id == tagtree_id
132
+ next true if tagtree_id
133
+
125
134
  tree.empty?.tap do |rejected|
126
- log(:warn) { "Tree '#{tree.name}' does NOT have location nodes. Skipping..." } if rejected
135
+ next unless rejected
136
+
137
+ log(:warn) {
138
+ "Tree '#{tree.name}' does NOT have location nodes. Skipping..."
139
+ }
127
140
  end
128
141
  end
129
142
  end
@@ -138,6 +151,10 @@ class Eco::API::UseCases::Default::Locations::TagtreeExtract < Eco::API::UseCase
138
151
  options.dig(:input, :file, :encoding) || 'utf-8'
139
152
  end
140
153
 
154
+ def tagtree_id
155
+ options.dig(:source, :structure_id)
156
+ end
157
+
141
158
  def file_as_source?
142
159
  return true unless file_as_source.nil?
143
160
 
@@ -163,11 +180,17 @@ class Eco::API::UseCases::Default::Locations::TagtreeExtract < Eco::API::UseCase
163
180
  end
164
181
 
165
182
  def output_filename(name = self.class::OUT_FILENAME)
166
- File.join(output_folder, "#{timestamp}_#{config.active_enviro}_#{name}.#{output_file_format}")
183
+ File.join(
184
+ output_folder,
185
+ "#{timestamp}_#{config.active_enviro}_#{name}.#{output_file_format}"
186
+ )
167
187
  end
168
188
 
169
189
  def output_folder
170
- "#{config.active_enviro}/#{self.class::OUT_FOLDER}"
190
+ File.join(
191
+ config.active_enviro,
192
+ self.class::OUT_FOLDER
193
+ )
171
194
  end
172
195
 
173
196
  def timestamp(date = Time.now)
@@ -5,12 +5,20 @@ module Eco::API::UseCases::GraphQL::Samples::Location::Service
5
5
  module Heading
6
6
  # Define the maps src -> dst heading name
7
7
  # @example {'parent_id' => 'parentId' }
8
- HEADER_MAPS = {}.freeze
8
+ HEADER_MAPS = {
9
+ 'Node Name' => 'name',
10
+ 'Node ID' => 'id',
11
+ 'Parent ID' => 'parent_id',
12
+ 'Classification IDs' => 'classifications',
13
+ 'classification_ids' => 'classifications'
14
+ }.freeze
9
15
 
10
16
  private
11
17
 
12
18
  def header_maps
13
- self.class::HEADER_MAPS
19
+ HEADER_MAPS.merge(
20
+ self.class::HEADER_MAPS
21
+ )
14
22
  end
15
23
  end
16
24
  end
@@ -22,12 +22,6 @@ module Eco::API::UseCases::GraphQL::Samples::Location::Service
22
22
  msg << "Given: #{csv.class}"
23
23
  raise ArgumentError, msg unless csv.is_a?(Eco::CSV::Table)
24
24
 
25
- csv = csv.transform_headers do |name|
26
- name = name.to_s.strip.downcase
27
- name = 'classifications' if name == 'classification_ids'
28
- name
29
- end
30
-
31
25
  csv.each do |row|
32
26
  row_transform&.call(row)
33
27
  transform_classifications(row)
@@ -338,7 +338,7 @@ ASSETS.cli.config do |cnf| # rubocop:disable Metrics/BlockLength
338
338
  options.deep_merge!(exclude: {policy_groups: true})
339
339
  end
340
340
 
341
- options_set.add('-default-tag', 'default_tag is not set with the input data') do |options|
341
+ options_set.add('-exclude-default-tag', 'default_tag is not set with the input data') do |options|
342
342
  options.deep_merge!(exclude: {default_tag: true})
343
343
  end
344
344
  options_set.add('-exclude-abilities', 'permissions_custom is not set with the input data') do |options|
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = '3.2.11'.freeze
2
+ VERSION = '3.2.12'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.11
4
+ version: 3.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-03 00:00:00.000000000 Z
11
+ date: 2026-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug