eco-rake 0.2.27 → 0.3.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: 6bf18dd9479afb806f1ebf0c345f12f7cd82be69fc5cf534d39450c346c21445
4
- data.tar.gz: e6cd8de5706785cb1ef3281969810a7a71dfee547f9f48522304414c8c975c3e
3
+ metadata.gz: 7a1ba96010109294f444deef656029ca05be31e9b099c0a5cb3b7ff824c66483
4
+ data.tar.gz: 5796ba024c12bf269d8791ee0c7be547ebbf14aaa94e788bb234313eeb7cd4f8
5
5
  SHA512:
6
- metadata.gz: 4804dc49cac78f378a7d6c2126141c67d0cf5694daa7cf2722a7541682c901cf2434875d1d7649ecf0394092f313ca8d70014605c9c60ba1cdbb7429eacede0a
7
- data.tar.gz: a29e0c6d232bc9b10cc7745498273454fba67b37da23849b306185b0a64a1e06cc1e46d324c1f44c6ade52910bb6743d7379c19683d4d9b02c0a72ba7fb98f98
6
+ metadata.gz: 84a590632c68ed9e0cffb835db1d8a1863356265e4749814de67af2a06f55a4c41399d4ddae5f251231423af47bbf156b5d46f5a400ecb05cfcb2a95452dc22b
7
+ data.tar.gz: '0081f5eb3714944a67b4b0231cc6a06f50fd57f5ae9a472d10858b92be0d0281a24690d01c36ce2bdf1ee37617a212a09f868d19f1ff7f948a88a905dc9a2876'
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 3.2.2
2
+ TargetRubyVersion: 3.2
3
3
  NewCops: enable
4
4
 
5
5
  Metrics/ClassLength:
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
- ## [0.2.28] - 2025-04-xx
5
+ ## [0.3.3] - 2025-11-xx
6
6
 
7
7
  ### Added
8
8
 
@@ -10,6 +10,19 @@ All notable changes to this project will be documented in this file.
10
10
 
11
11
  ### Fixed
12
12
 
13
+ ## [0.3.2] - 2025-11-22
14
+
15
+ ### Fixed
16
+
17
+ - `space` (`-w`) forwarding
18
+
19
+ ## [0.3.1] - 2025-04-29
20
+
21
+ ### Added
22
+
23
+ - `--notify` option
24
+ - Force notification even if in dry-run mode (`--simulate`)
25
+
13
26
  ## [0.2.27] - 2025-04-04
14
27
 
15
28
  ### Added
data/eco-rake.gemspec CHANGED
@@ -1,32 +1,36 @@
1
+ # rubocop:disable Gemspec/DevelopmentDependencies
1
2
  lib = File.expand_path('lib', __dir__)
2
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "eco-rake/version"
4
+
5
+ require 'eco-rake/version'
4
6
 
5
7
  Gem::Specification.new do |spec|
6
- spec.name = "eco-rake"
8
+ spec.name = 'eco-rake'
7
9
  spec.version = EcoRake::VERSION
8
- spec.authors = ["Oscar Segura Samper"]
9
- spec.email = ["oscar@ecoportal.co.nz"]
10
+ spec.authors = ['Oscar Segura Samper']
11
+ spec.email = ['oscar@ecoportal.co.nz']
10
12
 
11
13
  spec.summary = 'A set of helpers to build re-usable `rake` integration helpers.'
12
- spec.homepage = "https://www.ecoportal.com"
14
+ spec.homepage = 'https://www.ecoportal.com'
13
15
  spec.licenses = %w[MIT]
14
16
 
15
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
- f.match(%r{^(test|spec|features)/})
17
- end
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
17
+ spec.bindir = 'exe'
18
+ spec.executables = spec.files.grep(/^exe\//) { |f| File.basename(f) }
21
19
 
22
20
  spec.metadata['rubygems_mfa_required'] = 'true'
23
21
 
24
22
  spec.required_ruby_version = '>= 3.2.2'
25
23
 
26
- spec.add_development_dependency "rake", ">= 13.0.6", "< 14"
27
- spec.add_development_dependency "redcarpet", ">= 3.6.0", "< 4"
28
- spec.add_development_dependency "rspec", ">= 3.10.0", "< 4"
29
- spec.add_development_dependency "yard", ">= 0.9.34", "< 1"
24
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
25
+ f.match(/^(test|spec|features)\//)
26
+ end
27
+
28
+ spec.require_paths = ['lib']
29
+
30
+ spec.add_development_dependency 'rake', '>= 13.0.6', '< 14'
31
+ spec.add_development_dependency 'redcarpet', '>= 3.6.0', '< 4'
32
+ spec.add_development_dependency 'rspec', '>= 3.10.0', '< 4'
33
+ spec.add_development_dependency 'yard', '>= 0.9.34', '< 1'
30
34
 
31
35
  spec.add_dependency 'aws-sdk-ses', '~> 1', '>= 1.58.0'
32
36
  spec.add_dependency 'dotenv', '~> 3'
@@ -34,3 +38,5 @@ Gem::Specification.new do |spec|
34
38
  spec.add_dependency 'rake-commander', '~> 0.4.2'
35
39
  spec.add_dependency 'sendgrid-ruby', '~> 6.7.0'
36
40
  end
41
+
42
+ # rubocop:enable Gemspec/DevelopmentDependencies
@@ -8,12 +8,13 @@ class EcoRake
8
8
  module Lib
9
9
  module Export
10
10
  class Payload < EcoRake::Lib::BaseTask
11
- FORWARDED_OPTIONS = %i[csv txt col_sep simulate no_email].freeze
11
+ FORWARDED_OPTIONS = %i[csv txt col_sep space simulate no_email notify].freeze
12
12
  FORWARD_RULES = {
13
13
  enviro: ->(enviro) { "-#{enviro}" },
14
14
  space: ->(space) { "-space #{space}" },
15
15
  simulate: '-simulate',
16
16
  no_email: '-no-email',
17
+ notify: '-notify',
17
18
  csv: '-csv',
18
19
  txt: '-txt',
19
20
  col_sep: ->(sep) { "-col-sep #{sep}" },
@@ -55,7 +56,10 @@ class EcoRake
55
56
  value&.iso8601
56
57
  end
57
58
 
58
- 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
59
63
 
60
64
  option_forwarding(**FORWARD_RULES)
61
65
 
@@ -125,8 +129,8 @@ class EcoRake
125
129
  end
126
130
 
127
131
  def success_notify
128
- return if options[:simulate]
129
- return if options[:no_email]
132
+ return if options[:simulate] && !options[:notify]
133
+ return if options[:no_email] && !options[:notify]
130
134
  return unless (inbox = mail_to)
131
135
 
132
136
  email(
@@ -142,8 +146,8 @@ class EcoRake
142
146
  msg = res.to_s
143
147
  puts msg
144
148
 
145
- exit 1 if options[:simulate]
146
- exit 1 if options[:no_email]
149
+ exit 1 if options[:simulate] && !options[:notify]
150
+ exit 1 if options[:no_email] && !options[:notify]
147
151
  exit 1 unless (inbox = mail_to)
148
152
 
149
153
  email(
@@ -3,15 +3,15 @@ class EcoRake
3
3
  module Files
4
4
  class Sftp < EcoRake::Lib::BaseTask
5
5
  FORWARD_RULES = {
6
- enviro: ->(enviro) { "-#{enviro}" },
7
- space: ->(space) { "-space #{space}" },
8
- folder: ->(folder) { "-local-folder #{folder}"},
6
+ enviro: ->(enviro) { "-#{enviro}" },
7
+ space: ->(space) { "-space #{space}" },
8
+ folder: ->(folder) { "-local-folder #{folder}" },
9
9
  list: '-list',
10
10
  get_last: '-get-last',
11
11
  get: '-get',
12
12
  archive: '-archive',
13
- file_pattern: ->(str) { "-file-pattern-const #{str}"},
14
- remote_subfolder: ->(sub) { "-remote-subfolder #{sub}"}
13
+ file_pattern: ->(str) { "-file-pattern-const #{str}" },
14
+ remote_subfolder: ->(sub) { "-remote-subfolder #{sub}" }
15
15
  }.freeze
16
16
 
17
17
  options_with_defaults true
@@ -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(
@@ -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
@@ -104,8 +104,8 @@ class EcoRake
104
104
  msg = 'File decryption failed'
105
105
  puts msg
106
106
 
107
- exit 1 if options[:simulate]
108
- exit 1 if options[:no_email]
107
+ exit 1 if options[:simulate] && !options[:notify]
108
+ exit 1 if options[:no_email] && !options[:notify]
109
109
  exit 1 unless (inbox = mail_to)
110
110
 
111
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
 
@@ -26,10 +27,14 @@ class EcoRake
26
27
 
27
28
  private
28
29
 
30
+ def forwarded_options
31
+ FORWARD_RULES.keys - [:enviro]
32
+ end
33
+
29
34
  def rake_sync_command
30
35
  rake_command(
31
36
  namespaced_task,
32
- *forward_options(*FORWARD_RULES.keys - [:enviro])
37
+ *forward_options(*forwarded_options)
33
38
  )
34
39
  end
35
40
 
@@ -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
@@ -2,10 +2,13 @@ class EcoRake
2
2
  module Lib
3
3
  module Task
4
4
  class RunnerRely < EcoRake::Lib::BaseTask
5
+ FORWARDED_OPTIONS = %i[space task simulate no_email notify].freeze
5
6
  FORWARD_RULES = {
6
7
  simulate: :mirror,
7
8
  task: :mirror,
8
- space: :mirror
9
+ space: :mirror,
10
+ no_email: :mirror,
11
+ notify: :mirror
9
12
  }.freeze
10
13
 
11
14
  options_with_defaults true
@@ -19,12 +22,15 @@ class EcoRake
19
22
 
20
23
  private
21
24
 
25
+ def forwarded_options
26
+ self.class::FORWARDED_OPTIONS
27
+ end
28
+
22
29
  def command
23
30
  cmd = [base_command]
24
31
  cmd << target_task
25
32
  cmd << '--'
26
- cmd << forward_option(:task)
27
- cmd << forward_option(:simulate)
33
+ cmd.push(*forward_options(*forwarded_options))
28
34
  string_cmd(*cmd)
29
35
  end
30
36
 
@@ -1,5 +1,5 @@
1
1
  require 'rake-commander'
2
2
 
3
3
  class EcoRake < RakeCommander
4
- VERSION = '0.2.27'.freeze
4
+ VERSION = '0.3.2'.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.27
4
+ version: 0.3.2
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-03 00:00:00.000000000 Z
11
+ date: 2025-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake