eco-rake 0.1.5 → 0.2.0

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: 7a95738d0726a071fd9302ea5644ae019f0417577e0b9df2debf9d8e1c06b94f
4
- data.tar.gz: eb1655d1f8cbc09ca84bc22be350170b122958a37bbbb70a969f038ee5e2afee
3
+ metadata.gz: 628181cc7bb3f65177780f0ce04dba3e16ce33256bd708c1619a214699622fc5
4
+ data.tar.gz: d70cadf71bcc60f3578993ef16d10300f938bce65ae325faf2e3a9ae86e82c23
5
5
  SHA512:
6
- metadata.gz: 6cb03e0ca5be560bd0e579851eb4476175e56eff2db1c37f41d2f9b07dfd536284c9cce1bf9ab06ff5b9a70d3f4ad3083f6b8ba81b7cfe0d764f00a7317dd23b
7
- data.tar.gz: 85c9dda526770a38a72512a593e4d883895056a06073a79fb9f7bd3a4176fada22b98da712636f13ec3f95e5b1d07e47e00b0bce0f713b3eb33631944473a84c
6
+ metadata.gz: 46504cb702b95c53a542a93cb749951a31093cdd7191f6364c100e58f70c62646448b3341cd4a87c979b4c4c15f2ab2d926f28852191fe92d32ed76e99694ccf
7
+ data.tar.gz: dc9bb1377d36e0bcca062d85cfe90305167771210095563b3fe122a52a06f1d57153cf4d2723b61ec18e9e285add8915f297ca6cc0b1f3253a344d7f871060bc
@@ -0,0 +1,4 @@
1
+ {
2
+ "MD013": false,
3
+ "MD024": false
4
+ }
data/.rubocop.yml CHANGED
@@ -1,90 +1,93 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.7.2
3
- Exclude:
4
- - 'config/routes.rb'
2
+ TargetRubyVersion: 3.2.2
3
+ NewCops: enable
5
4
 
6
- Naming/VariableNumber:
7
- EnforcedStyle: snake_case
8
- Naming/FileName:
9
- Enabled: false
10
-
11
- Metrics/LineLength:
12
- Enabled: false
13
- Metrics/BlockLength:
14
- ExcludedMethods: [context, describe]
15
- Max: 50
16
- Metrics/MethodLength:
17
- Max: 50
18
5
  Metrics/ClassLength:
19
- Max: 200
6
+ Max: 500
20
7
  Metrics/ModuleLength:
21
- Max: 200
8
+ Max: 300
9
+ Metrics/MethodLength:
10
+ Max: 50
22
11
  Metrics/AbcSize:
12
+ Max: 30
13
+ Metrics/ParameterLists:
14
+ Max: 5
15
+ CountKeywordArgs: false
16
+ Metrics/BlockLength:
17
+ CountAsOne: ['array', 'heredoc', 'method_call']
23
18
  Max: 50
24
- Exclude:
25
- - 'lib/eco-rake/base/method_helpers.rb'
26
19
  Metrics/CyclomaticComplexity:
27
- Max: 10
28
- Exclude:
29
- - 'lib/eco-rake/base/method_helpers.rb'
20
+ Max: 30
30
21
  Metrics/PerceivedComplexity:
31
- Max: 10
32
- Exclude:
33
- - 'lib/eco-rake/base/method_helpers.rb'
22
+ Max: 30
34
23
 
35
- ParameterLists:
36
- Max: 5
37
- CountKeywordArgs: false
38
-
39
- Style/Alias:
40
- EnforcedStyle: prefer_alias_method
41
- Style/StringLiterals:
24
+ Style/AccessorGrouping:
42
25
  Enabled: false
43
- Style/FrozenStringLiteralComment:
26
+ Style/ConditionalAssignment:
44
27
  Enabled: false
45
- Style/CommentedKeyword:
28
+ Style/BlockDelimiters:
29
+ BracesRequiredMethods: ['log']
30
+ AllowedPatterns: ['proc', 'new']
31
+ Style/ClassAndModuleChildren:
46
32
  Enabled: false
47
- Style/MultilineBlockChain:
33
+ Style/FrozenStringLiteralComment:
48
34
  Enabled: false
49
- Style/Documentation:
35
+ Style/StringLiterals:
50
36
  Enabled: false
51
37
  Style/StringLiteralsInInterpolation:
52
38
  Enabled: false
53
- Style/AndOr:
39
+ Style/Documentation:
54
40
  Enabled: false
55
- Style/SlicingWithRange:
41
+ Style/CommentedKeyword:
56
42
  Enabled: false
57
- Style/ClassAndModuleChildren:
43
+ Style/MultilineBlockChain:
58
44
  Enabled: false
59
- Style/OptionalBooleanParameter:
45
+ Style/AndOr:
46
+ Enabled: false
47
+ Style/Alias:
48
+ EnforcedStyle: prefer_alias_method
49
+ Style/FetchEnvVar:
60
50
  Enabled: false
51
+ Style/RegexpLiteral:
52
+ EnforcedStyle: mixed
53
+ AllowInnerSlashes: true
61
54
 
62
55
  Layout/HashAlignment:
63
56
  EnforcedColonStyle: table
64
- Layout/ArgumentAlignment:
65
- EnforcedStyle: with_fixed_indentation
57
+ EnforcedHashRocketStyle: table
58
+ Layout/LeadingCommentSpace:
59
+ Enabled: false
60
+ AllowGemfileRubyComment: true
61
+ Layout/ParameterAlignment:
62
+ Enabled: false
63
+ Layout/MultilineMethodDefinitionBraceLayout:
64
+ EnforcedStyle: symmetrical
65
+ Layout/LineLength:
66
+ Enabled: true
67
+ Layout/SpaceInsideHashLiteralBraces:
68
+ Enabled: false
69
+ Layout/SpaceInsideBlockBraces:
70
+ Enabled: false
71
+ Layout/SpaceAroundOperators:
72
+ Enabled: false
66
73
  Layout/ExtraSpacing:
67
74
  AllowForAlignment: true
75
+ AllowBeforeTrailingComments: true
68
76
  Layout/AccessModifierIndentation:
69
77
  EnforcedStyle: indent
70
78
  Layout/DotPosition:
71
79
  EnforcedStyle: trailing
72
80
  Layout/MultilineMethodCallIndentation:
73
81
  EnforcedStyle: indented
74
- Layout/SpaceInsideHashLiteralBraces:
75
- Enabled: false
76
- Layout/SpaceInsideBlockBraces:
77
- Enabled: false
78
- Layout/SpaceAroundOperators:
79
- Enabled: false
80
82
  Layout/FirstHashElementIndentation:
81
83
  Enabled: false
82
84
  Layout/EmptyLineAfterGuardClause:
83
85
  Enabled: false
84
- Layout/LeadingCommentSpace:
85
- Enabled: false
86
86
 
87
- Lint/AssignmentInCondition:
88
- Enabled: false
89
- Lint/UnderscorePrefixedVariableName:
87
+ Naming/VariableNumber:
88
+ EnforcedStyle: snake_case
89
+ CheckSymbols: false
90
+ Naming/MethodParameterName:
91
+ AllowedNames: ['x', 'y', 'i', 'j', 'id', 'io', 'to']
92
+ Naming/RescuedExceptionsVariableName:
90
93
  Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/CHANGELOG.md CHANGED
@@ -1,32 +1,52 @@
1
1
  # Change Log
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
- ## [0.1.6] - 2024-02-xx
5
+ ## [0.2.1] - 2024-08-xx
5
6
 
6
7
  ### Added
8
+
7
9
  ### Fixed
10
+
8
11
  ### Changed
9
12
 
10
- ## [0.1.5] - 2024-02-xx
13
+ ## [0.2.0] - 2024-08-01
11
14
 
12
- ### Added
13
- - new options for file pattern const and remote subfolder for the SFTP task
15
+ ### Changed
16
+
17
+ - require `ruby 3`
18
+
19
+ ## [0.1.6] - 2024-02-03
14
20
 
15
21
  ### Fixed
16
22
 
23
+ - Compatibility with `ruby 3`
24
+ - call to `super` with no args where method on parent class doesn't match parameters.
25
+
17
26
  ### Changed
18
27
 
28
+ - upgrade dependencies
29
+
30
+ ## [0.1.5] - 2024-02-01
31
+
32
+ ### Added
33
+
34
+ - new options for file pattern const and remote subfolder for the SFTP task
35
+
19
36
  ## [0.1.4] - 2023-07-23
20
37
 
21
38
  ### Fixed
22
- - Type in `EcoRake::Utils::Mailing#email`
39
+
40
+ - Type in `EcoRake::Utils::Mailing#email`
23
41
 
24
42
  ## [0.1.2] - 2023-06-09
25
43
 
26
44
  ### Changed
27
- - Notify when file decryption fails
45
+
46
+ - Notify when file decryption fails
28
47
 
29
48
  ## [0.1.1] - 2023-06-06
30
49
 
31
50
  ### Added
32
- - Very first version, with support to migrate all the rake integrations.
51
+
52
+ - Very first version, with support to migrate all the rake integrations.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # EcoRake
2
2
 
3
- A set of helpers to build re-usable `rake` integration helpers.
3
+ A set of helpers to build re-usable `rake` integration helpers.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,8 +18,9 @@ Or install it yourself as:
18
18
 
19
19
  $ gem install eco-rake
20
20
 
21
- ## Usage
21
+ ## Changelog
22
22
 
23
+ See {file:CHANGELOG.md} for a list of changes.
23
24
 
24
25
  ## Development
25
26
 
data/eco-rake.gemspec CHANGED
@@ -19,16 +19,17 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.required_ruby_version = '>= 2.7.2'
22
+ spec.metadata['rubygems_mfa_required'] = 'true'
23
+
24
+ spec.required_ruby_version = '>= 3.2.2'
23
25
 
24
- spec.add_development_dependency "bundler", ">= 2.4.9", "< 3"
25
26
  spec.add_development_dependency "rake", ">= 13.0.6", "< 14"
26
- spec.add_development_dependency "redcarpet", ">= 3.6.0", "< 4"
27
27
  spec.add_development_dependency "rspec", ">= 3.10.0", "< 4"
28
28
  spec.add_development_dependency "yard", ">= 0.9.34", "< 1"
29
+ spec.add_development_dependency "redcarpet", ">= 3.6.0", "< 4"
29
30
 
30
- #spec.add_dependency 'aws-sdk-s3', '>= 1.83.0', '< 2'
31
- spec.add_dependency 'aws-sdk-ses', '>= 1.36.0', '< 2'
32
- spec.add_dependency 'dotenv', '>= 2.7.6', '< 3'
33
- spec.add_dependency 'rake-commander', '>= 0.3.6', "< 0.4"
31
+ #spec.add_dependency 'aws-sdk-s3', '>= 1.142.0', '< 2'
32
+ spec.add_dependency 'aws-sdk-ses', '~> 1', '>= 1.58.0'
33
+ spec.add_dependency 'dotenv', '~> 3'
34
+ spec.add_dependency 'rake-commander', '~> 0.4'
34
35
  end
@@ -16,10 +16,10 @@ class EcoRake
16
16
  target_files.each do |file|
17
17
  delete_file(gpg_to_csv_filename(file))
18
18
  stat = sh_continue(decrypt_command(file, ignore_mdc_error: ignore_mdc_error))
19
- status = stat unless stat == 0
19
+ status = stat unless stat.zero?
20
20
  end
21
21
  delete_file(*target_files, message: "Deleting files from '#{source_folder}'") unless options[:simulate]
22
- exit status unless status == 0
22
+ exit status unless status.zero?
23
23
  end
24
24
 
25
25
  def display_target_files
@@ -39,7 +39,7 @@ class EcoRake
39
39
  cmd = [base_command]
40
40
  cmd << forward_option(:folder)
41
41
  cmd << forward_options(:list, :get_last, :get, :archive).compact.first || '-list'
42
- cmd.push(*forward_options(:remote_subfolder, :file_pattern).compact)
42
+ cmd.push(*forward_options(:remote_subfolder, :file_pattern))
43
43
  cmd << '-no-people'
44
44
  cmd = yield(cmd) if block_given?
45
45
  string_cmd(*cmd)
@@ -9,7 +9,6 @@ class EcoRake
9
9
  option '-o', '--only-stats', TrueClass, desc: 'To display only stats in the feedback'
10
10
  option '-b', '--no-policy', FalseClass, desc: 'To skip the batch policy'
11
11
  option '-n', '--no-get', FalseClass, desc: 'Skip get people step'
12
- option '-p', '--file-pattern', TrueClass, desc: "Specifies the target file pattern (can use a const)"
13
12
  end
14
13
  end
15
14
  end
@@ -18,9 +18,8 @@ class EcoRake
18
18
  def task(*_args)
19
19
  upsert_local_dir(options[:folder])
20
20
  sh_continue pull_file
21
- if do_decrypt
22
- failed_decryption_notify unless 0 == sh_continue(rake_decrypt)
23
- end
21
+ failed_decryption_notify if do_decrypt && !sh_continue(rake_decrypt).zero?
22
+
24
23
  sh_continue rake_sync_command
25
24
  return if options[:simulate]
26
25
  sh_continue rake_sftp_archive if pull_driver == 'sftp'
@@ -38,7 +38,7 @@ class EcoRake
38
38
  def namespaced_task(task_name = target_task)
39
39
  ns = self.class.namespace || ''
40
40
  ns_with_enviro = ns.split(':').any? {|s| s == options[:enviro]}
41
- ns = ns_with_enviro ? ns : "#{ns}:#{options[:enviro]}"
41
+ ns = "#{ns}:#{options[:enviro]}" unless ns_with_enviro
42
42
  "#{ns}:#{task_name || self.class.task}"
43
43
  end
44
44
  end
@@ -13,7 +13,7 @@ class EcoRake
13
13
  raise ArgumentError, msg if missing && argument_required? && raise
14
14
  return nil if missing && argument_required?
15
15
 
16
- value = value == :not_used ? default : value
16
+ value = default if value == :not_used
17
17
  "#{opt} \"#{value}\""
18
18
  end
19
19
 
@@ -22,12 +22,12 @@ class EcoRake
22
22
  # Implements the mirror of Boolean options/switches.
23
23
  def boolean_mirror(value = :not_used)
24
24
  opt = name_hyphened
25
- puts "boolean_mirror (#{value}): #{opt}" if name == :no_get
25
+ # puts "boolean_mirror (#{value}): #{opt}" if name == :no_get
26
26
 
27
27
  return nil unless [TrueClass, NilClass, FalseClass].any? {|klass| type_coercion == klass}
28
28
  enabled_value = !boolean_name? || [TrueClass, NilClass].any? {|klass| type_coercion == klass}
29
- return opt if value == enabled_value
30
- return name_false_hypen if boolean_name? && value == !enabled_value
29
+ return opt if value == enabled_value
30
+ name_false_hypen if boolean_name? && value == !enabled_value
31
31
  end
32
32
  end
33
33
  end
@@ -11,7 +11,7 @@ class EcoRake
11
11
  module ClassMethods
12
12
  private
13
13
 
14
- def add_to_options(opt, *args)
14
+ def add_to_options(opt, **kargs)
15
15
  super.tap do |out|
16
16
  next unless opt.respond_to?(:parent=)
17
17
  opt.parent = self if opt == out
@@ -44,7 +44,8 @@ class EcoRake
44
44
  # @return [Boolean]
45
45
  def gpg_version_gte?(major:, minor:)
46
46
  result = shell_gpg_version
47
- return false unless match = result.match(GPG_VERSION_REGEX)
47
+ return false unless (match = result.match(GPG_VERSION_REGEX))
48
+
48
49
  maj = match[:maj].to_i
49
50
  min = match[:min].to_i
50
51
  (maj >= major) && (min >= minor)
@@ -1,5 +1,5 @@
1
1
  require 'rake-commander'
2
2
 
3
3
  class EcoRake < RakeCommander
4
- VERSION = '0.1.5'.freeze
4
+ VERSION = '0.2.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,35 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
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-01-31 00:00:00.000000000 Z
11
+ date: 2024-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 2.4.9
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '3'
23
- type: :development
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 2.4.9
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '3'
33
13
  - !ruby/object:Gem::Dependency
34
14
  name: rake
35
15
  requirement: !ruby/object:Gem::Requirement
@@ -51,12 +31,12 @@ dependencies:
51
31
  - !ruby/object:Gem::Version
52
32
  version: '14'
53
33
  - !ruby/object:Gem::Dependency
54
- name: redcarpet
34
+ name: rspec
55
35
  requirement: !ruby/object:Gem::Requirement
56
36
  requirements:
57
37
  - - ">="
58
38
  - !ruby/object:Gem::Version
59
- version: 3.6.0
39
+ version: 3.10.0
60
40
  - - "<"
61
41
  - !ruby/object:Gem::Version
62
42
  version: '4'
@@ -66,108 +46,96 @@ dependencies:
66
46
  requirements:
67
47
  - - ">="
68
48
  - !ruby/object:Gem::Version
69
- version: 3.6.0
49
+ version: 3.10.0
70
50
  - - "<"
71
51
  - !ruby/object:Gem::Version
72
52
  version: '4'
73
53
  - !ruby/object:Gem::Dependency
74
- name: rspec
54
+ name: yard
75
55
  requirement: !ruby/object:Gem::Requirement
76
56
  requirements:
77
57
  - - ">="
78
58
  - !ruby/object:Gem::Version
79
- version: 3.10.0
59
+ version: 0.9.34
80
60
  - - "<"
81
61
  - !ruby/object:Gem::Version
82
- version: '4'
62
+ version: '1'
83
63
  type: :development
84
64
  prerelease: false
85
65
  version_requirements: !ruby/object:Gem::Requirement
86
66
  requirements:
87
67
  - - ">="
88
68
  - !ruby/object:Gem::Version
89
- version: 3.10.0
69
+ version: 0.9.34
90
70
  - - "<"
91
71
  - !ruby/object:Gem::Version
92
- version: '4'
72
+ version: '1'
93
73
  - !ruby/object:Gem::Dependency
94
- name: yard
74
+ name: redcarpet
95
75
  requirement: !ruby/object:Gem::Requirement
96
76
  requirements:
97
77
  - - ">="
98
78
  - !ruby/object:Gem::Version
99
- version: 0.9.34
79
+ version: 3.6.0
100
80
  - - "<"
101
81
  - !ruby/object:Gem::Version
102
- version: '1'
82
+ version: '4'
103
83
  type: :development
104
84
  prerelease: false
105
85
  version_requirements: !ruby/object:Gem::Requirement
106
86
  requirements:
107
87
  - - ">="
108
88
  - !ruby/object:Gem::Version
109
- version: 0.9.34
89
+ version: 3.6.0
110
90
  - - "<"
111
91
  - !ruby/object:Gem::Version
112
- version: '1'
92
+ version: '4'
113
93
  - !ruby/object:Gem::Dependency
114
94
  name: aws-sdk-ses
115
95
  requirement: !ruby/object:Gem::Requirement
116
96
  requirements:
117
- - - ">="
97
+ - - "~>"
118
98
  - !ruby/object:Gem::Version
119
- version: 1.36.0
120
- - - "<"
99
+ version: '1'
100
+ - - ">="
121
101
  - !ruby/object:Gem::Version
122
- version: '2'
102
+ version: 1.58.0
123
103
  type: :runtime
124
104
  prerelease: false
125
105
  version_requirements: !ruby/object:Gem::Requirement
126
106
  requirements:
127
- - - ">="
107
+ - - "~>"
128
108
  - !ruby/object:Gem::Version
129
- version: 1.36.0
130
- - - "<"
109
+ version: '1'
110
+ - - ">="
131
111
  - !ruby/object:Gem::Version
132
- version: '2'
112
+ version: 1.58.0
133
113
  - !ruby/object:Gem::Dependency
134
114
  name: dotenv
135
115
  requirement: !ruby/object:Gem::Requirement
136
116
  requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- version: 2.7.6
140
- - - "<"
117
+ - - "~>"
141
118
  - !ruby/object:Gem::Version
142
119
  version: '3'
143
120
  type: :runtime
144
121
  prerelease: false
145
122
  version_requirements: !ruby/object:Gem::Requirement
146
123
  requirements:
147
- - - ">="
148
- - !ruby/object:Gem::Version
149
- version: 2.7.6
150
- - - "<"
124
+ - - "~>"
151
125
  - !ruby/object:Gem::Version
152
126
  version: '3'
153
127
  - !ruby/object:Gem::Dependency
154
128
  name: rake-commander
155
129
  requirement: !ruby/object:Gem::Requirement
156
130
  requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: 0.3.6
160
- - - "<"
131
+ - - "~>"
161
132
  - !ruby/object:Gem::Version
162
133
  version: '0.4'
163
134
  type: :runtime
164
135
  prerelease: false
165
136
  version_requirements: !ruby/object:Gem::Requirement
166
137
  requirements:
167
- - - ">="
168
- - !ruby/object:Gem::Version
169
- version: 0.3.6
170
- - - "<"
138
+ - - "~>"
171
139
  - !ruby/object:Gem::Version
172
140
  version: '0.4'
173
141
  description:
@@ -179,8 +147,10 @@ extra_rdoc_files: []
179
147
  files:
180
148
  - ".gitignore"
181
149
  - ".gitlab-ci.yml"
150
+ - ".markdownlint.json"
182
151
  - ".rspec"
183
152
  - ".rubocop.yml"
153
+ - ".ruby-version"
184
154
  - ".yardopts"
185
155
  - CHANGELOG.md
186
156
  - Gemfile
@@ -248,7 +218,8 @@ files:
248
218
  homepage: https://www.ecoportal.com
249
219
  licenses:
250
220
  - MIT
251
- metadata: {}
221
+ metadata:
222
+ rubygems_mfa_required: 'true'
252
223
  post_install_message:
253
224
  rdoc_options: []
254
225
  require_paths:
@@ -257,14 +228,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
257
228
  requirements:
258
229
  - - ">="
259
230
  - !ruby/object:Gem::Version
260
- version: 2.7.2
231
+ version: 3.2.2
261
232
  required_rubygems_version: !ruby/object:Gem::Requirement
262
233
  requirements:
263
234
  - - ">="
264
235
  - !ruby/object:Gem::Version
265
236
  version: '0'
266
237
  requirements: []
267
- rubygems_version: 3.4.12
238
+ rubygems_version: 3.5.6
268
239
  signing_key:
269
240
  specification_version: 4
270
241
  summary: A set of helpers to build re-usable `rake` integration helpers.