eco-rake 0.2.5 → 0.2.6

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: 391b705005f0caede947bd5260f5f6f04e794bf1af974509b87cf7e8a751c58c
4
- data.tar.gz: 015ea6c334d09e3fd7c464b04a8e41e2089a9417f239f82ba814f992ea7f6ff5
3
+ metadata.gz: e6f834edf2918e4ff4e45cfcf538da2e59b632fad4222a3b996f5ab00c60fb25
4
+ data.tar.gz: 1f0a90c3242171b560b6adb848e50fc58cd569e61e915e7e9363e6c50c4c6266
5
5
  SHA512:
6
- metadata.gz: 1355859370ee7cc87bb1f7ae87da8749bd7178afd745dc4a58b3020ed525497d1d8a6c533ce51c0a0908d8997a140109a33fa09ca75141416af02be844f7945c
7
- data.tar.gz: 1bb06bc6724b3fb4500e8aa8b95126f334c2d495c3624f0c579bb183c13f276ba749290051669d883b1aae6318e07e95f08d1f68b687855e720300bbd71f87cb
6
+ metadata.gz: b619ed8b4ebdf32cb30fdef61f5821d821c1338464e3cfe5d2331df930f00582c0c008c1fe3dac53744b328e4d126a8609f87c71d647889028215f9b709e0895
7
+ data.tar.gz: c90b0316f090eec3f5ed131a0bfd808e75ca190f38c8f5f447524161de88c43f39aafe0d9db91a6882c4d7bd70a62ece823a3fde56cdfdc71062eee178d934a6
data/CHANGELOG.md CHANGED
@@ -2,10 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [0.2.6] - 2024-10-xx
5
+ ## [0.2.6] - 2024-12-09
6
6
 
7
7
  ### Added
8
8
 
9
+ - `EcoRake::Lib::People::SyncLaunch` new constant `join_files`
10
+ - To specify the integration to use the target folder in raw
11
+ - Which will use all the files with matching pattern within.
12
+
9
13
  ### Fixed
10
14
 
11
15
  ### Changed
@@ -21,6 +21,7 @@ class EcoRake
21
21
  attr_const :snapshot_mode, default: :full
22
22
  attr_const :local_folder, default: '.'
23
23
  attr_const :mail_to
24
+ attr_const :join_files, default: false
24
25
 
25
26
  option_reopen :schema, default_lookup: :default_schema, required: true
26
27
  option_reopen :folder, default_lookup: :local_folder
@@ -30,7 +31,7 @@ class EcoRake
30
31
  def task(*_args)
31
32
  return missing_files_notify unless latest_file
32
33
  return process_deltas if delta?
33
- return process_full_file if full? || delta_last?
34
+ process_full_file if full? || delta_last?
34
35
  end
35
36
 
36
37
  private
@@ -56,7 +57,7 @@ class EcoRake
56
57
  puts msg
57
58
  exit 1 if options[:simulate]
58
59
  exit 1 if options[:no_email]
59
- exit 1 unless inbox = mail_to
60
+ exit 1 unless (inbox = mail_to)
60
61
 
61
62
  email_missing_files(enviro: target_enviro, to: inbox)
62
63
  exit 1
@@ -87,12 +88,14 @@ class EcoRake
87
88
  # @note it ensures basic information is not missing or inconsistent.
88
89
  def base_command(file_or_folder)
89
90
  raise "Missing target file or folder in #{self.class}" if file_or_folder.to_s.strip.empty?
91
+
90
92
  usecase = base_usecase.to_sym
91
93
  case usecase
92
94
  when :hris
93
95
  msg = "Inconsistent configuration in #{self.class}. BASE_USECASE is '#{usecase}', "
94
96
  msg << "but file SNAPSHOT_MODE is '#{snapshot_mode}'"
95
97
  raise msg if delta? || delta_last?
98
+
96
99
  "-hris-from #{double_quote(file_or_folder)}"
97
100
  when :upsert
98
101
  "-upsert-from #{double_quote(file_or_folder)}"
@@ -110,28 +113,39 @@ class EcoRake
110
113
  %i[partial delta].any? {|m| m == mode}
111
114
  end
112
115
 
116
+ # only last delta (i.e. customer builds deltas based on eP full snapshot)
113
117
  def delta_last?
114
- snapshot_mode.to_s.downcase.to_sym == :delta_last
118
+ snapshot_mode.to_s.downcase.to_sym == :delta_last
115
119
  end
116
120
 
117
121
  # Amont the `target_files` the last in alphabetic order.
118
122
  def latest_file
119
- @latest_file ||= target_files.last
123
+ @latest_file ||= ''.then do
124
+ next options[:folder] if join_files
125
+
126
+ target_files.last
127
+ end
120
128
  end
121
129
 
122
130
  # @note if there is a file_pattern method or FILE_PATTERN const, it's used as a pattern.
123
131
  # @return [Array<String>] the `csv` files of the target folder
124
132
  def target_files
125
- @target_files ||= csv_files(options[:folder], regexp: file_pattern)
133
+ @target_files ||= [].then do
134
+ next options[:folder] if join_files
135
+
136
+ csv_files(options[:folder], regexp: file_pattern)
137
+ end
126
138
  end
127
139
 
128
140
  # Deletes the files identified as target.
129
141
  def clear_files
130
142
  deleted_files = target_files.each_with_object([]) do |file, deleted|
131
143
  next unless File.exist?(file)
144
+
132
145
  File.delete(file)
133
146
  deleted << file
134
147
  end
148
+
135
149
  puts "Deleted these files:\n • #{deleted_files.join("\n • ")}" unless deleted_files.empty?
136
150
  end
137
151
  end
@@ -1,5 +1,5 @@
1
1
  require 'rake-commander'
2
2
 
3
3
  class EcoRake < RakeCommander
4
- VERSION = '0.2.5'.freeze
4
+ VERSION = '0.2.6'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura Samper
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-01 00:00:00.000000000 Z
11
+ date: 2024-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -274,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
274
  - !ruby/object:Gem::Version
275
275
  version: '0'
276
276
  requirements: []
277
- rubygems_version: 3.5.18
277
+ rubygems_version: 3.5.23
278
278
  signing_key:
279
279
  specification_version: 4
280
280
  summary: A set of helpers to build re-usable `rake` integration helpers.