eco-helpers 3.0.6 → 3.0.8
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 +4 -4
- data/CHANGELOG.md +28 -1
- data/Rakefile +5 -0
- data/eco-helpers.gemspec +3 -0
- data/lib/eco/api/policies/default_policies/99_user_access_policy.rb +5 -2
- data/lib/eco/api/policies.rb +4 -2
- data/lib/eco/api/session/batch/job.rb +5 -2
- data/lib/eco/api/session/batch.rb +18 -2
- data/lib/eco/api/session/config.rb +1 -0
- data/lib/eco/api/session.rb +5 -1
- data/lib/eco/api/usecases/graphql/helpers/base/case_env.rb +1 -0
- data/lib/eco/api/usecases/graphql/helpers/base/error_handling.rb +52 -0
- data/lib/eco/api/usecases/graphql/helpers/base.rb +1 -0
- data/lib/eco/api/usecases/graphql/samples/location/command/dsl.rb +19 -18
- data/lib/eco/api/usecases/graphql/samples/location/command/results.rb +1 -7
- data/lib/eco/api/usecases/graphql/samples/location/command/service/tree_update.rb +9 -6
- data/lib/eco/api/usecases/graphql/samples/location/command/track_changed_ids.rb +2 -8
- data/lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible.rb +5 -2
- data/lib/eco/api/usecases/graphql/samples/location/service/tree_diff.rb +4 -2
- data/lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb +5 -3
- data/lib/eco/assets.rb +4 -2
- data/lib/eco/cli/scripting/args_helpers.rb +5 -2
- data/lib/eco/cli_default/options.rb +24 -2
- data/lib/eco/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5f99b7ad6dad2fcd262a6269bbe2c7a2acae695b077712ce745c9f0746e2580
|
4
|
+
data.tar.gz: de2217f416b703f1cc0ae06f6c42bddbebedef906013b128b5efcdc552df40af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6149a32bf28606ac1051a127deabefd66fbab577700035f36ba01b9268438b1223423a30e399c1efaed92858586722a0dfa6d7d1a180a4ff0870c894ac730fde
|
7
|
+
data.tar.gz: 1799bbf948a1725f99b567b0934c29eb53f3361db5c22c660e616e876cc857c15c85330db3d2e60df4a6d5f1c0c9697722e1ded6b114897cbe8b5a257fd06511
|
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.0.
|
5
|
+
## [3.0.9] - 2024-08-xx
|
6
6
|
|
7
7
|
### Added
|
8
8
|
|
@@ -10,6 +10,33 @@ All notable changes to this project will be documented in this file.
|
|
10
10
|
|
11
11
|
### Fixed
|
12
12
|
|
13
|
+
## [3.0.8] - 2024-08-30
|
14
|
+
|
15
|
+
### Added
|
16
|
+
|
17
|
+
- options to choose `-batch-mode` [`:batch`|`:job`]
|
18
|
+
|
19
|
+
### Changed
|
20
|
+
|
21
|
+
- When `-skip-api-policies`
|
22
|
+
- Default policy: to skip non generic logic when api policies are skept
|
23
|
+
- Still run default policies
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
|
27
|
+
- unknown option `suggestions`
|
28
|
+
|
29
|
+
## [3.0.7] - 2024-08-27
|
30
|
+
|
31
|
+
### Added
|
32
|
+
|
33
|
+
- `Eco::API::UseCases::GraphQL::Helpers::Base::ErrorHandling`
|
34
|
+
|
35
|
+
### Fixed
|
36
|
+
|
37
|
+
- `Service:TreeUpdate`
|
38
|
+
- Should NOT call `re_archive` when there was a error that is NOT due to an interrupt (i.e. so when raised **error** or `exit`ed)
|
39
|
+
|
13
40
|
## [3.0.6] - 2024-08-26
|
14
41
|
|
15
42
|
### Added
|
data/Rakefile
CHANGED
@@ -19,6 +19,11 @@ RSpec::Core::RakeTask.new(:spec_fast) do |task|
|
|
19
19
|
end
|
20
20
|
task(rspec_fast: :spec_fast)
|
21
21
|
|
22
|
+
desc "run rubocop diaplying cop names"
|
23
|
+
RuboCop::RakeTask.new(:rubocop) do |t|
|
24
|
+
t.options = ['--display-cop-names']
|
25
|
+
end
|
26
|
+
|
22
27
|
# default task name is yard
|
23
28
|
desc "Yard: generate all the documentation"
|
24
29
|
YARD::Rake::YardocTask.new(:doc) do |t|
|
data/eco-helpers.gemspec
CHANGED
@@ -1,3 +1,4 @@
|
|
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
4
|
|
@@ -54,3 +55,5 @@ Gem::Specification.new do |spec|
|
|
54
55
|
spec.add_dependency 'roo-xls', '>= 1.2.0', '< 1.3'
|
55
56
|
spec.add_dependency 'rubyzip', '>= 2.3.2', '< 2.4'
|
56
57
|
end
|
58
|
+
|
59
|
+
# rubocop:enable Gemspec/DevelopmentDependencies
|
@@ -14,8 +14,10 @@ class Eco::API::Policies::DefaultPolicies::UserAccess < Eco::API::Common::Loader
|
|
14
14
|
self.account_removed_count = 0
|
15
15
|
|
16
16
|
people.each do |person|
|
17
|
-
remove_account_when_no_email!(person)
|
18
|
-
|
17
|
+
remove_account_when_no_email!(person)
|
18
|
+
|
19
|
+
next if options.dig(:skip, :api_policies)
|
20
|
+
next unless (account = person.account)
|
19
21
|
next if options.dig(:exclude, :account)
|
20
22
|
|
21
23
|
add_def_policy_group_if_applicable!(account)
|
@@ -35,6 +37,7 @@ class Eco::API::Policies::DefaultPolicies::UserAccess < Eco::API::Common::Loader
|
|
35
37
|
end
|
36
38
|
|
37
39
|
def remove_account_when_no_email!(person)
|
40
|
+
return unless person.email.to_s.empty?
|
38
41
|
return unless person.account
|
39
42
|
|
40
43
|
self.account_removed_count += 1 if had_account?(person)
|
data/lib/eco/api/policies.rb
CHANGED
@@ -15,8 +15,10 @@ module Eco
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def add(policy)
|
18
|
-
|
19
|
-
|
18
|
+
msg = "Expected Eco::API::Policies::Policy object. Given: #{policy}"
|
19
|
+
raise ArgumentError, msg unless policy.is_a?(Eco::API::Policies::Policy)
|
20
|
+
|
21
|
+
super
|
20
22
|
end
|
21
23
|
|
22
24
|
def launch(people:, session:, job:, options: {})
|
@@ -350,9 +350,12 @@ module Eco
|
|
350
350
|
# Applies the changes introduced by api policies
|
351
351
|
def apply_policies(pre_queue)
|
352
352
|
people(pre_queue).tap do |entries|
|
353
|
-
|
353
|
+
if options.dig(:skip, :api_policies)
|
354
|
+
policies = session.default_policies
|
355
|
+
else
|
356
|
+
policies = session.policies
|
357
|
+
end
|
354
358
|
|
355
|
-
policies = session.policies
|
356
359
|
next if policies.empty?
|
357
360
|
|
358
361
|
policies.launch(
|
@@ -12,6 +12,16 @@ module Eco
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
# @return [Symbol] the batch mode to run
|
16
|
+
def batch_mode(opts = self.options)
|
17
|
+
opts.dig(:workflow, :batch, :mode) || :batch
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [Boolean] are we running in `:job` mode?
|
21
|
+
def job_mode?(opts = self.options)
|
22
|
+
batch_mode(opts) == :job
|
23
|
+
end
|
24
|
+
|
15
25
|
# Gets the _people_ of the organization according `params`.
|
16
26
|
# If `people` is not `nil`, scopes to only the people specified.
|
17
27
|
# @note
|
@@ -113,6 +123,11 @@ module Eco
|
|
113
123
|
)
|
114
124
|
end
|
115
125
|
|
126
|
+
# Default way to retrieve options (unless provided)
|
127
|
+
def options
|
128
|
+
ASSETS.cli.options
|
129
|
+
end
|
130
|
+
|
116
131
|
def launch_batch( # rubocop:disable Metrics/AbcSize
|
117
132
|
data,
|
118
133
|
method:,
|
@@ -120,7 +135,8 @@ module Eco
|
|
120
135
|
job_mode: true, # rubocop:disable Lint/UnusedMethodArgument
|
121
136
|
per_page: DEFAULT_BATCH_BLOCK,
|
122
137
|
people_api: api&.people,
|
123
|
-
silent: false
|
138
|
+
silent: false,
|
139
|
+
options: self.options
|
124
140
|
)
|
125
141
|
iteration = 1
|
126
142
|
done = 0
|
@@ -145,7 +161,7 @@ module Eco
|
|
145
161
|
|
146
162
|
start_slice = Time.now
|
147
163
|
offer_retry_on(Ecoportal::API::Errors::TimeOut) do
|
148
|
-
people_api.batch(job_mode:
|
164
|
+
people_api.batch(job_mode: job_mode?(options)) do |batch|
|
149
165
|
slice.each do |person|
|
150
166
|
batch.public_send(method, person) do |response|
|
151
167
|
faltal("Request with no response") unless response
|
data/lib/eco/api/session.rb
CHANGED
@@ -252,11 +252,15 @@ module Eco
|
|
252
252
|
# @return [Eco::API::Policies]
|
253
253
|
def policies
|
254
254
|
@policies ||= config.policies.dup.tap do |policies|
|
255
|
-
default_policies = Eco::API::Policies::DefaultPolicies.new
|
256
255
|
policies.merge(default_policies)
|
257
256
|
end
|
258
257
|
end
|
259
258
|
|
259
|
+
# The native policies
|
260
|
+
def default_policies
|
261
|
+
@default_policies ||= Eco::API::Policies::DefaultPolicies.new
|
262
|
+
end
|
263
|
+
|
260
264
|
# Set of helpers to simplify your code
|
261
265
|
# @see Eco::API::MicroCases
|
262
266
|
# @return [Eco::API::MicroCases]
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Eco::API::UseCases::GraphQL::Helpers::Base
|
2
|
+
# Basic stuff you would need in any use case
|
3
|
+
module ErrorHandling
|
4
|
+
include Eco::Language::AuxiliarLogger
|
5
|
+
|
6
|
+
attr_reader :exception
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def interrupted?(err = exception)
|
11
|
+
interrupt_errors.any? {|klass| err.is_a?(klass)}
|
12
|
+
end
|
13
|
+
|
14
|
+
def error_raised?
|
15
|
+
exception && !interrupted?
|
16
|
+
end
|
17
|
+
|
18
|
+
def rescued
|
19
|
+
yield
|
20
|
+
rescue StandardError => err
|
21
|
+
self.exception ||= err
|
22
|
+
log(:error) { err.patch_full_message }
|
23
|
+
end
|
24
|
+
|
25
|
+
def with_error_handling
|
26
|
+
@exception = nil
|
27
|
+
yield
|
28
|
+
rescue SystemExit => sext
|
29
|
+
@exception = sext
|
30
|
+
exit sext.status
|
31
|
+
rescue *interrupt_errors => int
|
32
|
+
@exception = int
|
33
|
+
raise
|
34
|
+
rescue SystemStackError
|
35
|
+
puts $! # rubocop:disable Style/SpecialGlobalVars
|
36
|
+
puts caller[0..100]
|
37
|
+
raise
|
38
|
+
rescue StandardError, SignalException => err
|
39
|
+
@exception = err
|
40
|
+
raise
|
41
|
+
end
|
42
|
+
|
43
|
+
def interrupt_errors
|
44
|
+
return @interrupt_errors if @interrupt_errors
|
45
|
+
|
46
|
+
errs = [Interrupt]
|
47
|
+
errs << IRB::Abort if Object.const_defined?(:IRB) && IRB.const_defined?(:Abort)
|
48
|
+
|
49
|
+
@interrupt_errors = errs
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -24,38 +24,39 @@ class Eco::API::UseCases::GraphQL::Samples::Location
|
|
24
24
|
|
25
25
|
# Main processor
|
26
26
|
def process # rubocop:disable Metrics/AbcSize
|
27
|
-
self.error
|
28
|
-
self.exception = nil
|
27
|
+
self.error = false
|
29
28
|
|
30
|
-
|
29
|
+
with_error_handling do
|
30
|
+
super if defined?(super)
|
31
31
|
|
32
|
-
|
33
|
-
|
32
|
+
# this may trigger a backup of the tagtree
|
33
|
+
self.current_tree ||= live_tree
|
34
34
|
|
35
|
-
|
36
|
-
|
35
|
+
inputs(force_continue: force_continue?) do |input, stage|
|
36
|
+
results[stage] ||= []
|
37
37
|
|
38
|
-
|
38
|
+
track_mode = batch_tree_track_mode(stage)
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
# yields the result of each batch
|
41
|
+
sliced_batches(input, desc: stage, track_tree_mode: track_mode) do |sliced_input, response, page, pages, done, total| # rubocop:disable Metrics/ParameterLists, Layout/LineLength
|
42
|
+
track_current_tree(response&.structure)
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
results[stage] << (page_results = request_results_class.new(sliced_input, response))
|
45
|
+
update_tags_remap_table(page_results, stage, current_tree)
|
46
|
+
|
47
|
+
self.error = page_errors?(page_results, page, pages, done, total, stage: stage)
|
48
|
+
break if error
|
49
|
+
end
|
46
50
|
|
47
|
-
self.error = page_errors?(page_results, page, pages, done, total, stage: stage)
|
48
51
|
break if error
|
49
52
|
end
|
50
|
-
|
51
|
-
break if error
|
52
53
|
end
|
53
54
|
rescue SystemStackError
|
54
55
|
puts $! # rubocop:disable Style/SpecialGlobalVars
|
55
56
|
puts caller[0..100]
|
56
57
|
raise
|
57
|
-
rescue StandardError =>
|
58
|
-
log(:error) {
|
58
|
+
rescue StandardError => err
|
59
|
+
log(:error) { err.patch_full_message }
|
59
60
|
raise
|
60
61
|
ensure
|
61
62
|
rescued { self.tags_remap_csv_file = generate_tags_remap_csv }
|
@@ -3,13 +3,7 @@ class Eco::API::UseCases::GraphQL::Samples::Location
|
|
3
3
|
module Command::Results
|
4
4
|
include Eco::API::UseCases::GraphQL::Helpers::Base::CaseEnv
|
5
5
|
|
6
|
-
attr_accessor :error
|
7
|
-
|
8
|
-
def rescued
|
9
|
-
yield
|
10
|
-
rescue StandardError => e
|
11
|
-
log(:error) { self.exception ||= e.patch_full_message }
|
12
|
-
end
|
6
|
+
attr_accessor :error
|
13
7
|
|
14
8
|
def request_results_class
|
15
9
|
Eco::API::UseCases::GraphQL::Helpers::Location::Command::Results
|
@@ -7,7 +7,7 @@ class Eco::API::UseCases::GraphQL::Samples::Location
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
def included(base)
|
10
|
-
super
|
10
|
+
super
|
11
11
|
base.send :include, Eco::API::UseCases::GraphQL::Samples::Location::Service::TreeDiff
|
12
12
|
base.send :include, Eco::API::UseCases::GraphQL::Samples::Location::Command::DSL
|
13
13
|
base.send :include, Eco::API::UseCases::GraphQL::Utils::Sftp
|
@@ -17,9 +17,11 @@ class Eco::API::UseCases::GraphQL::Samples::Location
|
|
17
17
|
|
18
18
|
module InstanceMethods
|
19
19
|
def process
|
20
|
-
|
20
|
+
with_error_handling do
|
21
|
+
super
|
22
|
+
end
|
21
23
|
ensure
|
22
|
-
rescued { re_archive }
|
24
|
+
rescued { re_archive } unless error_raised?
|
23
25
|
rescued { email_digest('TagTree Update') }
|
24
26
|
end
|
25
27
|
|
@@ -28,6 +30,7 @@ class Eco::API::UseCases::GraphQL::Samples::Location
|
|
28
30
|
# @note this is an additional necessary step
|
29
31
|
def re_archive
|
30
32
|
return if simulate?
|
33
|
+
return if error_raised?
|
31
34
|
|
32
35
|
stage = :rearchive
|
33
36
|
|
@@ -85,9 +88,9 @@ class Eco::API::UseCases::GraphQL::Samples::Location
|
|
85
88
|
return if simulate?
|
86
89
|
return if options.dig(:workflow, :no_email)
|
87
90
|
|
88
|
-
digest_msgs
|
89
|
-
|
90
|
-
subject
|
91
|
+
digest_msgs = logger.cache.logs(level: %i[info error warn])
|
92
|
+
str_exception = exception ? " - Exception!" : ''
|
93
|
+
subject = "#{config.active_enviro} - #{title}#{str_exception}"
|
91
94
|
session.mail(subject: subject, body: digest_msgs.join)
|
92
95
|
end
|
93
96
|
|
@@ -58,23 +58,17 @@ class Eco::API::UseCases::GraphQL::Samples::Location
|
|
58
58
|
next if prev_id == new_id
|
59
59
|
|
60
60
|
tags_remap_table << [[prev_id], [new_id]]
|
61
|
-
|
62
|
-
# next unless ref_tree.is_a?(Eco::API::Organization::TagTree)
|
63
|
-
# next unless ref_tree.tag?(new_id)
|
64
|
-
|
65
|
-
# msg = "Node '#{prev_id}' was updated to '#{new_id}', "
|
66
|
-
# msg << "but in current structure '#{new_id}' is not present"
|
67
|
-
# log(:warn) { msg }
|
68
61
|
end
|
69
62
|
end
|
70
63
|
|
71
64
|
# Generates the final tags remap file
|
72
65
|
def generate_tags_remap_csv(filename = tags_remap_csv_full_filename)
|
73
|
-
return
|
66
|
+
return if tags_remap_table.empty?
|
74
67
|
|
75
68
|
timestamp_file(filename).tap do |file|
|
76
69
|
CSV.open(file, 'w') do |csv|
|
77
70
|
csv << %w[prev_node_ids new_node_ids]
|
71
|
+
|
78
72
|
tags_remap_table.each do |tags_remap|
|
79
73
|
csv << tags_remap.to_csv_row
|
80
74
|
end
|
@@ -8,7 +8,7 @@ module Eco::API::UseCases::GraphQL::Samples::Location::Service
|
|
8
8
|
module Convertible
|
9
9
|
class << self
|
10
10
|
def included(base)
|
11
|
-
super
|
11
|
+
super
|
12
12
|
base.send :include, Inputable
|
13
13
|
end
|
14
14
|
end
|
@@ -24,12 +24,15 @@ module Eco::API::UseCases::GraphQL::Samples::Location::Service
|
|
24
24
|
|
25
25
|
csv.transform_headers do |name|
|
26
26
|
next name unless header_maps.key?(name)
|
27
|
+
|
27
28
|
header_maps[name]
|
28
29
|
end
|
29
30
|
end.then do |csv|
|
30
31
|
transform_input_csv(csv).tap do |res|
|
31
32
|
next if res.is_a?(Eco::CSV::Table)
|
32
|
-
|
33
|
+
|
34
|
+
msg = "Expecting and Eco::CSV::Table. Given: #{res.class}"
|
35
|
+
raise ArgumentError, msg
|
33
36
|
end
|
34
37
|
end
|
35
38
|
end
|
@@ -46,13 +46,15 @@ module Eco::API::UseCases::GraphQL::Samples
|
|
46
46
|
|
47
47
|
class << self
|
48
48
|
def included(base)
|
49
|
-
super
|
49
|
+
super
|
50
50
|
base.send :include, Convertible
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
def process
|
55
|
-
|
55
|
+
with_error_handling do
|
56
|
+
compare
|
57
|
+
end
|
56
58
|
end
|
57
59
|
|
58
60
|
def compare
|
@@ -31,10 +31,12 @@ module Eco::API::UseCases::GraphQL::Samples
|
|
31
31
|
include Converter
|
32
32
|
|
33
33
|
def process
|
34
|
-
|
35
|
-
|
34
|
+
with_error_handling do
|
35
|
+
as_nodes_json(input_tagtree).tap do |list|
|
36
|
+
next generate_live_nodes_file(list) unless list.empty?
|
36
37
|
|
37
|
-
|
38
|
+
log(:error) { "There are no location nodes!" }
|
39
|
+
end
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
data/lib/eco/assets.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module Eco
|
2
2
|
class Assets
|
3
|
-
|
4
3
|
attr_reader :active_config
|
5
4
|
|
6
5
|
def initialize
|
@@ -17,10 +16,12 @@ module Eco
|
|
17
16
|
|
18
17
|
def config(key: active_config, update_active: true)
|
19
18
|
configs[:default] ||= Eco::API::Session::Config.new(key)
|
19
|
+
|
20
20
|
unless configs.key?(key)
|
21
|
-
@active_config = key
|
21
|
+
@active_config = key if update_active
|
22
22
|
configs[key] = configs[:default].clone(key)
|
23
23
|
end
|
24
|
+
|
24
25
|
configs[key].tap do |config|
|
25
26
|
config.active_api(key) if config.apis.defined?(key)
|
26
27
|
yield(config) if block_given?
|
@@ -36,6 +37,7 @@ module Eco
|
|
36
37
|
@cli_init = true
|
37
38
|
require_relative('cli_default')
|
38
39
|
end
|
40
|
+
|
39
41
|
@cli.tap { yield(@cli) if block_given? }
|
40
42
|
end
|
41
43
|
end
|
@@ -2,6 +2,8 @@ module Eco
|
|
2
2
|
class CLI
|
3
3
|
class Scripting
|
4
4
|
module ArgsHelpers
|
5
|
+
class UnknownArgument < ArgumentError; end
|
6
|
+
|
5
7
|
# @return [Array<String] the command line arguments.
|
6
8
|
def argv
|
7
9
|
@argv || ARGV
|
@@ -31,7 +33,8 @@ module Eco
|
|
31
33
|
}
|
32
34
|
unknown = arguments.unknown(**args) do |key, correct|
|
33
35
|
next suggestions[key] = correct unless correct.empty?
|
34
|
-
|
36
|
+
|
37
|
+
suggestions[key] = ['-- not known similar options! --']
|
35
38
|
end
|
36
39
|
unknown = unknown.select {|arg| is_modifier?(arg)} if only_options
|
37
40
|
|
@@ -49,7 +52,7 @@ module Eco
|
|
49
52
|
msg << "\nUse 'ruby main.rb -org [-usecase] --help -options' for more information"
|
50
53
|
msg << "\n - Please, remember that use case specific options "
|
51
54
|
msg << "should come after the use case in the command line.\n"
|
52
|
-
raise msg
|
55
|
+
raise UnknownArgument, msg
|
53
56
|
end
|
54
57
|
|
55
58
|
# @return [Boolean] if `key` is in the command line.
|
@@ -27,7 +27,7 @@ ASSETS.cli.config do |cnf| # rubocop:disable Metrics/BlockLength
|
|
27
27
|
puts conf.usecases.help(refine: huc)
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
help_str = [
|
31
31
|
"Please specify one of the below:",
|
32
32
|
" -filters to display available filters on people",
|
33
33
|
" -input-filters to display available filters on input data",
|
@@ -36,7 +36,9 @@ ASSETS.cli.config do |cnf| # rubocop:disable Metrics/BlockLength
|
|
36
36
|
"TIPS:",
|
37
37
|
" * You may specify the usecase to know its specific options by: -usecase_name --help -options",
|
38
38
|
" * You may specify a refinement to show specific information only: --help -usecases tags"
|
39
|
-
].join("\n")
|
39
|
+
].join("\n")
|
40
|
+
|
41
|
+
puts help_str unless hpf || hif || ho || huc
|
40
42
|
exit
|
41
43
|
end
|
42
44
|
|
@@ -151,6 +153,26 @@ ASSETS.cli.config do |cnf| # rubocop:disable Metrics/BlockLength
|
|
151
153
|
session.config.dry_run!
|
152
154
|
end
|
153
155
|
|
156
|
+
desc = "It specifies the type of batch to be used (default: ':batch')"
|
157
|
+
options_set.add("-batch-mode", desc) do |options, session|
|
158
|
+
mode_in = SCR.get_arg("-batch-mode", with_param: true)
|
159
|
+
mode_str = mode_in.to_s.downcase
|
160
|
+
mode_sym = %i[batch job].find do |md|
|
161
|
+
next true if md.to_s == mode_str
|
162
|
+
|
163
|
+
md.to_s == mode_str.gsub(':', '')
|
164
|
+
end
|
165
|
+
|
166
|
+
unless mode_sym
|
167
|
+
session.log(:warn) {
|
168
|
+
"Unknown job_mode: #{mode_in}. Switching to default: ':batch'"
|
169
|
+
}
|
170
|
+
mode_sym = :batch
|
171
|
+
end
|
172
|
+
|
173
|
+
options.deep_merge!(workflow: {batch: {mode: mode_sym}})
|
174
|
+
end
|
175
|
+
|
154
176
|
desc = "Runs runs post_launch cases even if in dry-run"
|
155
177
|
options_set.add("-run-postlaunch", desc) do |options, session|
|
156
178
|
options.deep_merge!(post_launch: {run: true})
|
data/lib/eco/version.rb
CHANGED
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.0.
|
4
|
+
version: 3.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -726,6 +726,7 @@ files:
|
|
726
726
|
- lib/eco/api/usecases/graphql/helpers.rb
|
727
727
|
- lib/eco/api/usecases/graphql/helpers/base.rb
|
728
728
|
- lib/eco/api/usecases/graphql/helpers/base/case_env.rb
|
729
|
+
- lib/eco/api/usecases/graphql/helpers/base/error_handling.rb
|
729
730
|
- lib/eco/api/usecases/graphql/helpers/base/graphql_env.rb
|
730
731
|
- lib/eco/api/usecases/graphql/helpers/location.rb
|
731
732
|
- lib/eco/api/usecases/graphql/helpers/location/base.rb
|
@@ -921,7 +922,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
921
922
|
- !ruby/object:Gem::Version
|
922
923
|
version: '0'
|
923
924
|
requirements: []
|
924
|
-
rubygems_version: 3.5.
|
925
|
+
rubygems_version: 3.5.18
|
925
926
|
signing_key:
|
926
927
|
specification_version: 4
|
927
928
|
summary: eco-helpers to manage people api cases
|