eco-rake 0.2.26 → 0.3.1

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: 82aa3569542a65b976c4e76b4c0b7b49d834939d6df095cf9c94ba32a5a9f0c2
4
- data.tar.gz: 2e5e35c449188acd082e15c1db42d782a4c994542095b4399df9b59942f6b5a2
3
+ metadata.gz: 3228d82a42bd33d3cea2465b935ca76760536cdb5c304d96c34fdaf202425d31
4
+ data.tar.gz: f52094ec6f05d0c06ebabe2bf229e1ff0a2a143549101ff35c529a81bb0696da
5
5
  SHA512:
6
- metadata.gz: 35abccc09dabcdf650c4af675ca8a8ad9a6f37c90bdf21c841f817a58a6ea14e1e586dc2fc169a5f4ad2b69cc084a8188dff60389b727d19548955f8bb153335
7
- data.tar.gz: c1ffc60eff728e6291462918548a4df78d68aa1d6fa240c3c45b817804a3743d7a8d8b7b418ac2efb5d251153641ac4b8b5aea76c59b873db60a74a5e58108e0
6
+ metadata.gz: '013850736bb0a3223f2cff1166bf66c4b419577c7cf0083d98fc4191aaef4f4597374f2a45a5c8696f53388c6a310db59a3492366179c1a8ab4339f6786f56f6'
7
+ data.tar.gz: 8e9cae51bb25a606e1d166c834047ed837b7a050108b7b00ae90d0ca4ca271765cadcd18ea38ab35a5210fc0b992eb46e3df6f9219c7db11b1ce5a66a59278d5
data/CHANGELOG.md CHANGED
@@ -2,12 +2,35 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [0.2.27] - 2025-04-xx
5
+ ## [0.3.2] - 2025-04-xx
6
6
 
7
7
  ### Added
8
8
 
9
9
  ### Changed
10
10
 
11
+ ### Fixed
12
+
13
+ ## [0.3.1] - 2025-04-29
14
+
15
+ ### Added
16
+
17
+ - `--notify` option
18
+ - Force notification even if in dry-run mode (`--simulate`)
19
+
20
+ ## [0.2.27] - 2025-04-04
21
+
22
+ ### Added
23
+
24
+ - **Upgraded** options of Payload task.
25
+
26
+ ### Changed
27
+
28
+ - **Improved** archiving data files message.
29
+
30
+ ### Fixed
31
+
32
+ - **Removed** character `•` for `*` (Linux printing)
33
+
11
34
  ## [0.2.26] - 2025-04-03
12
35
 
13
36
  ### Fixed
@@ -8,15 +8,19 @@ class EcoRake
8
8
  module Lib
9
9
  module Export
10
10
  class Payload < EcoRake::Lib::BaseTask
11
- INCLUDED_OPTIONS = %i[csv simulate no_email].freeze
12
- FORWARD_RULES = {
13
- enviro: ->(enviro) { "-#{enviro}" },
14
- space: ->(space) { "-space #{space}" },
15
- simulate: '-simulate',
16
- no_email: '-no-email',
17
- csv: '-csv',
18
- full: ->(full) { full ? nil : '-delta' },
19
- asat: ->(asat) { "-asatdate #{asat}" }
11
+ FORWARDED_OPTIONS = %i[csv txt col_sep simulate no_email notify].freeze
12
+ FORWARD_RULES = {
13
+ enviro: ->(enviro) { "-#{enviro}" },
14
+ space: ->(space) { "-space #{space}" },
15
+ simulate: '-simulate',
16
+ no_email: '-no-email',
17
+ notify: '-notify',
18
+ csv: '-csv',
19
+ txt: '-txt',
20
+ col_sep: ->(sep) { "-col-sep #{sep}" },
21
+ multi_sep: ->(sep) { "-multi-sep #{sep}" },
22
+ full: ->(full) { full ? nil : '-delta' },
23
+ asat: ->(asat) { "-asatdate #{asat}" }
20
24
  }.freeze
21
25
 
22
26
  attr_const :mail_to
@@ -38,12 +42,24 @@ class EcoRake
38
42
  str_desc = 'Generate files in csv format?'
39
43
  option '-c', '--csv', TrueClass, default: true, desc: str_desc
40
44
 
45
+ str_desc = "If the generated files sould be in 'txt' format"
46
+ option '-x', '--txt', TrueClass, desc: str_desc, default: false
47
+
48
+ str_desc = "The column separator"
49
+ option '-p', '--col-sep', TrueClass, desc: str_desc # default: nil # ','
50
+
51
+ str_desc = "Multi value separator (for extract-registers)"
52
+ option '-u', '--multi-sep', TrueClass, desc: str_desc # , default: nil # '|'
53
+
41
54
  str_desc = 'Specifies the date when the export was done (default: now).'
42
55
  option '-a', '--asat [DATE]', Time, default: Time.now.iso8601, desc: str_desc do |value|
43
56
  value&.iso8601
44
57
  end
45
58
 
46
- option '-m', '--no-email', FalseClass, desc: 'Do not notify'
59
+ option '-m', '--no-email', TrueClass, desc: 'Do not notify', default: false
60
+
61
+ str_desc = 'Notify (even if dry-run or not remote)'
62
+ option '-y', '--notify', TrueClass, desc: str_desc, default: false
47
63
 
48
64
  option_forwarding(**FORWARD_RULES)
49
65
 
@@ -75,7 +91,7 @@ class EcoRake
75
91
  end
76
92
 
77
93
  def export_registers
78
- forward_command('-extract-registers')
94
+ forward_command('-extract-registers', :multi_sep)
79
95
  end
80
96
 
81
97
  def export_pack
@@ -90,13 +106,20 @@ class EcoRake
90
106
  raise "Expecting String with usecase. Given: #{use.class}" unless use.is_a?(String)
91
107
 
92
108
  cmd = [base_command(use)]
93
- cmd.push(*forward_options(*self.class::INCLUDED_OPTIONS, *opts))
109
+ cmd.push(*forward_options(
110
+ *forwarded_options,
111
+ *opts
112
+ ))
94
113
 
95
114
  cmd = yield(cmd) if block_given?
96
115
 
97
116
  string_cmd(*cmd)
98
117
  end
99
118
 
119
+ def forwarded_options
120
+ self.class::FORWARDED_OPTIONS
121
+ end
122
+
100
123
  def base_command(use = nil)
101
124
  string_cmd(
102
125
  ruby_runner,
@@ -106,8 +129,8 @@ class EcoRake
106
129
  end
107
130
 
108
131
  def success_notify
109
- return if options[:simulate]
110
- return if options[:no_email]
132
+ return if options[:simulate] && !options[:notify]
133
+ return if options[:no_email] && !options[:notify]
111
134
  return unless (inbox = mail_to)
112
135
 
113
136
  email(
@@ -123,8 +146,8 @@ class EcoRake
123
146
  msg = res.to_s
124
147
  puts msg
125
148
 
126
- exit 1 if options[:simulate]
127
- exit 1 if options[:no_email]
149
+ exit 1 if options[:simulate] && !options[:notify]
150
+ exit 1 if options[:no_email] && !options[:notify]
128
151
  exit 1 unless (inbox = mail_to)
129
152
 
130
153
  email(
@@ -31,7 +31,7 @@ class EcoRake
31
31
 
32
32
  def display_target_files
33
33
  puts "Source gpg files ('#{source_folder}'):"
34
- target_files.each {|file| puts " #{File.basename(file)}"}
34
+ target_files.each {|file| puts " * #{File.basename(file)}"}
35
35
  end
36
36
 
37
37
  def warn_missing_file
@@ -18,7 +18,7 @@ class EcoRake
18
18
  msg = "#{target_files.count} target log files (from '#{source_folder}') will be #{str_op}"
19
19
  msg << " to '#{dest_folder}':" unless remove?
20
20
  puts msg
21
- target_files.each {|file| puts " #{File.basename(file)}"}
21
+ target_files.each {|file| puts " * #{File.basename(file)}"}
22
22
  elsif options[:remove]
23
23
  delete_file(*target_files, message: "Removing the following #{target_files.count} files from '#{source_folder}':")
24
24
  else
@@ -6,14 +6,15 @@ class EcoRake
6
6
  # - Should be able to log at debug level.
7
7
  # @note in integration repos this is used to be called `run:hris`
8
8
  class SyncLaunch < EcoRake::Lib::People::BaseTask
9
- ADDITIONAL_OPTIONS = %i[only_stats no_policy simulate no_email].freeze
9
+ ADDITIONAL_OPTIONS = %i[only_stats no_policy simulate no_email notify].freeze
10
10
  FORWARD_RULES = {
11
11
  space: ->(space) { "-space #{space}" },
12
12
  schema: ->(schema) { "-schema-id \"#{schema}\"" },
13
13
  only_stats: '-feed-only-stats',
14
14
  no_policy: '-skip-batch-policy',
15
15
  simulate: '-simulate',
16
- no_email: '-no-email'
16
+ no_email: '-no-email',
17
+ notify: '-notify'
17
18
  }.freeze
18
19
 
19
20
  attr_const :target_enviro, required: true
@@ -59,8 +60,8 @@ class EcoRake
59
60
  msg = 'Missing files to be processed'
60
61
  puts msg
61
62
 
62
- exit 1 if options[:simulate]
63
- exit 1 if options[:no_email]
63
+ exit 1 if options[:simulate] && !options[:notify]
64
+ exit 1 if options[:no_email] && !options[:notify]
64
65
  exit 1 unless (inbox = mail_to)
65
66
 
66
67
  email_missing_files(
@@ -163,7 +164,7 @@ class EcoRake
163
164
 
164
165
  return if deleted_files.empty?
165
166
 
166
- puts "Deleted these files:\n #{deleted_files.join("\n ")}"
167
+ puts "Deleted these files:\n * #{deleted_files.join("\n * ")}"
167
168
  end
168
169
  end
169
170
  end
@@ -10,7 +10,10 @@ class EcoRake
10
10
  option '-o', '--only-stats', TrueClass, desc: 'To display only stats in the feedback'
11
11
  option '-b', '--no-policy', FalseClass, desc: 'To skip the batch policy'
12
12
  option '-n', '--no-get', FalseClass, desc: 'Skip get people step'
13
- option '-m', '--no-email', FalseClass, desc: 'Do not notify'
13
+ option '-m', '--no-email', TrueClass, desc: 'Do not notify', default: false
14
+
15
+ str_desc = 'Notify (even if dry-run or not remote)'
16
+ option '-y', '--notify', TrueClass, desc: str_desc, default: false
14
17
  end
15
18
  end
16
19
  end
@@ -88,7 +88,11 @@ class EcoRake
88
88
  msg << data_files.join("\n * ")
89
89
  puts msg
90
90
  else
91
- move_file(*data_files, folder: dest_folder, message: 'Archiving these files:')
91
+ move_file(
92
+ *data_files,
93
+ folder: dest_folder,
94
+ message: "Archiving these files to the '#{dest_folder}':"
95
+ )
92
96
  end
93
97
  end
94
98
 
@@ -100,8 +104,8 @@ class EcoRake
100
104
  msg = 'File decryption failed'
101
105
  puts msg
102
106
 
103
- exit 1 if options[:simulate]
104
- exit 1 if options[:no_email]
107
+ exit 1 if options[:simulate] && !options[:notify]
108
+ exit 1 if options[:no_email] && !options[:notify]
105
109
  exit 1 unless (inbox = mail_to)
106
110
 
107
111
  email(
@@ -12,6 +12,7 @@ class EcoRake
12
12
  no_policy: :mirror,
13
13
  no_get: :mirror,
14
14
  no_email: :mirror,
15
+ notify: :mirror,
15
16
  simulate: :mirror
16
17
  }.freeze
17
18
 
@@ -5,7 +5,9 @@ class EcoRake
5
5
  FORWARD_RULES = {
6
6
  enviro: ->(enviro) { "-#{enviro}" },
7
7
  space: ->(space) { "-space #{space}" },
8
- simulate: '-simulate'
8
+ simulate: '-simulate',
9
+ no_email: '-no-email',
10
+ notify: '-notify'
9
11
  }.freeze
10
12
 
11
13
  options_with_defaults true
@@ -79,7 +81,7 @@ class EcoRake
79
81
 
80
82
  def command(*args)
81
83
  cmd = [ruby_runner]
82
- cmd.push(*forward_options(:enviro, :space, :simulate))
84
+ cmd.push(*forward_options(:enviro, :space, :simulate, :no_email, :notify))
83
85
  cmd.push(*args)
84
86
  cmd = yield(cmd) if block_given?
85
87
  string_cmd(*cmd)
@@ -6,6 +6,10 @@ class EcoRake
6
6
  option '-e', '--enviro ENVIRO', String, desc: 'Target environment to run against (i.e. org, live)', required: true
7
7
  option '-w', '--space SPACE', String, desc: 'Target space of the envionment (i.e. uat)'
8
8
  option '-t', '--task NAME', String, desc: 'Target task to run', required: true
9
+ option '-m', '--no-email', TrueClass, desc: 'Do not notify', default: false
10
+
11
+ str_desc = 'Notify (even if dry-run or not remote)'
12
+ option '-y', '--notify', TrueClass, desc: str_desc, default: false
9
13
  end
10
14
  end
11
15
  end
@@ -5,7 +5,9 @@ class EcoRake
5
5
  FORWARD_RULES = {
6
6
  simulate: :mirror,
7
7
  task: :mirror,
8
- space: :mirror
8
+ space: :mirror,
9
+ no_email: :mirror,
10
+ notify: :mirror
9
11
  }.freeze
10
12
 
11
13
  options_with_defaults true
@@ -23,8 +25,7 @@ class EcoRake
23
25
  cmd = [base_command]
24
26
  cmd << target_task
25
27
  cmd << '--'
26
- cmd << forward_option(:task)
27
- cmd << forward_option(:simulate)
28
+ cmd.push(*forward_options(:task, :simulate, :no_email, :notify))
28
29
  string_cmd(*cmd)
29
30
  end
30
31
 
@@ -64,7 +64,7 @@ class EcoRake
64
64
 
65
65
  unless ok
66
66
  msg = "Command failed (status = #{res.exitstatus})"
67
- puts "#{msg}\n #{comm}"
67
+ puts "#{msg}\n * #{comm}"
68
68
  end
69
69
 
70
70
  res.exitstatus
@@ -24,7 +24,7 @@ class EcoRake
24
24
 
25
25
  files.each do |file|
26
26
  File.delete(file)
27
- puts " #{file}" if message
27
+ puts " * #{file}" if message
28
28
  end
29
29
  end
30
30
 
@@ -34,7 +34,7 @@ class EcoRake
34
34
  files.each do |file|
35
35
  new_name = File.join(folder, File.basename(file))
36
36
  File.rename(file, new_name)
37
- puts " #{File.basename(file)}" if message
37
+ puts " * #{File.basename(file)}" if message
38
38
  end
39
39
  end
40
40
 
@@ -1,5 +1,5 @@
1
1
  require 'rake-commander'
2
2
 
3
3
  class EcoRake < RakeCommander
4
- VERSION = '0.2.26'.freeze
4
+ VERSION = '0.3.1'.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.26
4
+ version: 0.3.1
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: 2025-04-02 00:00:00.000000000 Z
11
+ date: 2025-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake