decouplio 1.0.0alpha4 → 1.0.0alpha8
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/.rubocop.yml +6 -11
- data/.ruby-version +1 -1
- data/decouplio.gemspec +1 -1
- data/lib/decouplio/action.rb +16 -42
- data/lib/decouplio/action_state_printer.rb +37 -0
- data/lib/decouplio/composer.rb +3 -76
- data/lib/decouplio/const/{doby_aide_options.rb → step_options.rb} +2 -1
- data/lib/decouplio/const/types.rb +7 -27
- data/lib/decouplio/default_meta_store.rb +39 -0
- data/lib/decouplio/logic_dsl.rb +53 -35
- data/lib/decouplio/options_validator.rb +1 -110
- data/lib/decouplio/steps/inner_action_fail.rb +5 -3
- data/lib/decouplio/steps/inner_action_pass.rb +7 -5
- data/lib/decouplio/steps/inner_action_step.rb +5 -3
- data/lib/decouplio/steps/service_fail.rb +4 -2
- data/lib/decouplio/steps/service_pass.rb +4 -2
- data/lib/decouplio/steps/service_step.rb +4 -2
- data/lib/decouplio/validators/condition.rb +0 -10
- data/lib/decouplio/version.rb +1 -1
- metadata +8 -18
- data/lib/decouplio/const/validations/aide.rb +0 -38
- data/lib/decouplio/const/validations/doby.rb +0 -36
- data/lib/decouplio/default_error_handler.rb +0 -24
- data/lib/decouplio/errors/aide_can_not_be_first_step_error.rb +0 -18
- data/lib/decouplio/errors/aide_controversial_keys_error.rb +0 -26
- data/lib/decouplio/errors/aide_finish_him_error.rb +0 -26
- data/lib/decouplio/errors/doby_controversial_keys_error.rb +0 -26
- data/lib/decouplio/errors/doby_finish_him_error.rb +0 -26
- data/lib/decouplio/errors/step_is_not_defined_for_aide_error.rb +0 -26
- data/lib/decouplio/errors/step_is_not_defined_for_doby_error.rb +0 -27
- data/lib/decouplio/steps/aide.rb +0 -37
- data/lib/decouplio/steps/doby.rb +0 -37
@@ -10,8 +10,6 @@ require_relative 'errors/extra_key_for_pass_error'
|
|
10
10
|
require_relative 'errors/extra_key_for_resq_error'
|
11
11
|
require_relative 'errors/extra_key_for_wrap_error'
|
12
12
|
require_relative 'errors/fail_finish_him_error'
|
13
|
-
require_relative 'errors/doby_finish_him_error'
|
14
|
-
require_relative 'errors/aide_finish_him_error'
|
15
13
|
require_relative 'errors/invalid_error_class_error'
|
16
14
|
require_relative 'errors/invalid_wrap_name_error'
|
17
15
|
require_relative 'errors/pass_finish_him_error'
|
@@ -23,19 +21,14 @@ require_relative 'errors/step_is_not_defined_for_step_error'
|
|
23
21
|
require_relative 'errors/step_is_not_defined_for_fail_error'
|
24
22
|
require_relative 'errors/step_is_not_defined_for_pass_error'
|
25
23
|
require_relative 'errors/step_is_not_defined_for_wrap_error'
|
26
|
-
require_relative 'errors/step_is_not_defined_for_aide_error'
|
27
|
-
require_relative 'errors/step_is_not_defined_for_doby_error'
|
28
24
|
require_relative 'errors/wrap_finish_him_error'
|
29
25
|
require_relative 'errors/wrap_klass_method_error'
|
30
26
|
require_relative 'errors/step_controversial_keys_error'
|
31
|
-
require_relative 'errors/doby_controversial_keys_error'
|
32
|
-
require_relative 'errors/aide_controversial_keys_error'
|
33
27
|
require_relative 'errors/fail_controversial_keys_error'
|
34
28
|
require_relative 'errors/pass_controversial_keys_error'
|
35
29
|
require_relative 'errors/octo_controversial_keys_error'
|
36
30
|
require_relative 'errors/wrap_controversial_keys_error'
|
37
31
|
require_relative 'errors/palp_is_not_defined_error'
|
38
|
-
require_relative 'errors/error_store_error'
|
39
32
|
require_relative 'errors/step_name_error'
|
40
33
|
|
41
34
|
module Decouplio
|
@@ -78,25 +71,18 @@ module Decouplio
|
|
78
71
|
validate_wrap(options: filtered_options, name: options[:name], step_names: step_names)
|
79
72
|
when Decouplio::Const::Types::ACTION_TYPE_STEP
|
80
73
|
validate_action(action_class: options[:action], type: Decouplio::Const::Types::STEP_TYPE)
|
81
|
-
validate_error_store(parent_action_class: @action_class, child_action_class: options[:action])
|
82
74
|
validate_step(options: filtered_options, step_names: step_names)
|
83
75
|
when Decouplio::Const::Types::ACTION_TYPE_FAIL
|
84
76
|
validate_action(action_class: options[:action], type: Decouplio::Const::Types::FAIL_TYPE)
|
85
|
-
validate_error_store(parent_action_class: @action_class, child_action_class: options[:action])
|
86
77
|
validate_fail(options: filtered_options, step_names: step_names)
|
87
78
|
when Decouplio::Const::Types::ACTION_TYPE_PASS
|
88
79
|
validate_action(action_class: options[:action], type: Decouplio::Const::Types::PASS_TYPE)
|
89
|
-
validate_error_store(parent_action_class: @action_class, child_action_class: options[:action])
|
90
80
|
validate_pass(options: filtered_options, step_names: step_names)
|
91
81
|
when Decouplio::Const::Types::RESQ_TYPE_STEP,
|
92
82
|
Decouplio::Const::Types::RESQ_TYPE_FAIL,
|
93
83
|
Decouplio::Const::Types::RESQ_TYPE_PASS
|
94
84
|
validate(options: options[:step_to_resq], step_names: step_names)
|
95
85
|
validate_resq(options: filtered_options)
|
96
|
-
when Decouplio::Const::Types::DOBY_TYPE
|
97
|
-
validate_doby(options: filtered_options, step_names: step_names)
|
98
|
-
when Decouplio::Const::Types::AIDE_TYPE
|
99
|
-
validate_aide(options: filtered_options, step_names: step_names)
|
100
86
|
end
|
101
87
|
end
|
102
88
|
|
@@ -154,18 +140,6 @@ module Decouplio
|
|
154
140
|
check_resq_exception_classes_inheritance(options: options)
|
155
141
|
end
|
156
142
|
|
157
|
-
def validate_doby(options:, step_names:)
|
158
|
-
check_step_presence_for_doby(options: options, step_names: step_names)
|
159
|
-
check_doby_controversial_keys(options: options)
|
160
|
-
check_doby_finish_him(options: options)
|
161
|
-
end
|
162
|
-
|
163
|
-
def validate_aide(options:, step_names:)
|
164
|
-
check_step_presence_for_aide(options: options, step_names: step_names)
|
165
|
-
check_aide_controversial_keys(options: options)
|
166
|
-
check_aide_finish_him(options: options)
|
167
|
-
end
|
168
|
-
|
169
143
|
def validate_name(name:)
|
170
144
|
return unless Decouplio::Const::ReservedMethods::NAMES.include?(name)
|
171
145
|
|
@@ -202,34 +176,6 @@ module Decouplio
|
|
202
176
|
end
|
203
177
|
end
|
204
178
|
|
205
|
-
def check_step_presence_for_doby(options:, step_names:)
|
206
|
-
options.slice(*STEP_CHECK_STEP_PRESENCE).each do |option_key, option_value|
|
207
|
-
next if %i[on_success on_failure on_error].include?(option_key) &&
|
208
|
-
STEP_ALLOWED_ON_S_ON_F_VALUES.include?(option_value)
|
209
|
-
|
210
|
-
next if step_names.keys.include?(option_value)
|
211
|
-
|
212
|
-
raise Decouplio::Errors::StepIsNotDefinedForDobyError.new(
|
213
|
-
errored_option: options.slice(option_key).to_s,
|
214
|
-
details: option_value
|
215
|
-
)
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
def check_step_presence_for_aide(options:, step_names:)
|
220
|
-
options.slice(*STEP_CHECK_STEP_PRESENCE).each do |option_key, option_value|
|
221
|
-
next if %i[on_success on_failure on_error].include?(option_key) &&
|
222
|
-
STEP_ALLOWED_ON_S_ON_F_VALUES.include?(option_value)
|
223
|
-
|
224
|
-
next if step_names.keys.include?(option_value)
|
225
|
-
|
226
|
-
raise Decouplio::Errors::StepIsNotDefinedForAideError.new(
|
227
|
-
errored_option: options.slice(option_key).to_s,
|
228
|
-
details: option_value
|
229
|
-
)
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
179
|
def check_step_presence_for_fail(options:, step_names:)
|
234
180
|
options.slice(*STEP_CHECK_STEP_PRESENCE).each do |option_key, option_value|
|
235
181
|
next if %i[on_success on_failure on_error].include?(option_key) &&
|
@@ -280,36 +226,6 @@ module Decouplio
|
|
280
226
|
end
|
281
227
|
end
|
282
228
|
|
283
|
-
def check_doby_controversial_keys(options:)
|
284
|
-
on_success_on_failure = options.slice(:on_success, :on_failure)
|
285
|
-
finish_him = options.slice(:finish_him)
|
286
|
-
|
287
|
-
if !on_success_on_failure.empty? && !finish_him.empty?
|
288
|
-
raise Decouplio::Errors::DobyControversialKeysError.new(
|
289
|
-
errored_option: on_success_on_failure.merge(finish_him).to_s,
|
290
|
-
details: [on_success_on_failure.keys.join(', '), :finish_him]
|
291
|
-
)
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
|
-
def check_aide_controversial_keys(options:)
|
296
|
-
on_success_on_failure = options.slice(:on_success, :on_failure)
|
297
|
-
finish_him = options.slice(:finish_him)
|
298
|
-
|
299
|
-
if !on_success_on_failure.empty? && !finish_him.empty?
|
300
|
-
raise Decouplio::Errors::AideControversialKeysError.new(
|
301
|
-
errored_option: on_success_on_failure.merge(finish_him).to_s,
|
302
|
-
details: [on_success_on_failure.keys.join(', '), :finish_him]
|
303
|
-
)
|
304
|
-
end
|
305
|
-
end
|
306
|
-
|
307
|
-
def validate_error_store(parent_action_class:, child_action_class:)
|
308
|
-
return if parent_action_class.error_store == child_action_class.error_store
|
309
|
-
|
310
|
-
raise Decouplio::Errors::ErrorStoreError
|
311
|
-
end
|
312
|
-
|
313
229
|
def check_fail_extra_keys(options:)
|
314
230
|
extra_keys = options.keys - FAIL_ALLOWED_OPTIONS
|
315
231
|
|
@@ -426,32 +342,6 @@ module Decouplio
|
|
426
342
|
end
|
427
343
|
end
|
428
344
|
|
429
|
-
def check_doby_finish_him(options:)
|
430
|
-
finish_him_value = options.dig(:finish_him)
|
431
|
-
|
432
|
-
return unless finish_him_value && options.key?(:finish_him)
|
433
|
-
|
434
|
-
unless ALLOWED_STEP_FINISH_HIM_VALUES.include?(finish_him_value)
|
435
|
-
raise Decouplio::Errors::DobyFinishHimError.new(
|
436
|
-
errored_option: options.slice(:finish_him).to_s,
|
437
|
-
details: finish_him_value
|
438
|
-
)
|
439
|
-
end
|
440
|
-
end
|
441
|
-
|
442
|
-
def check_aide_finish_him(options:)
|
443
|
-
finish_him_value = options.dig(:finish_him)
|
444
|
-
|
445
|
-
return unless options.key?(:finish_him)
|
446
|
-
|
447
|
-
return if ALLOWED_FAIL_FINISH_HIM_VALUES.include?(finish_him_value)
|
448
|
-
|
449
|
-
raise Decouplio::Errors::AideFinishHimError.new(
|
450
|
-
errored_option: options.slice(:finish_him).to_s,
|
451
|
-
details: finish_him_value
|
452
|
-
)
|
453
|
-
end
|
454
|
-
|
455
345
|
def check_fail_finish_him(options:)
|
456
346
|
finish_him_value = options.dig(:finish_him)
|
457
347
|
|
@@ -567,6 +457,7 @@ module Decouplio
|
|
567
457
|
hash_case
|
568
458
|
wrap_flow
|
569
459
|
step_to_resq
|
460
|
+
_args
|
570
461
|
].freeze
|
571
462
|
|
572
463
|
# *************************************************
|
@@ -16,7 +16,11 @@ module Decouplio
|
|
16
16
|
|
17
17
|
def process(instance:)
|
18
18
|
instance.append_railway_flow(@name)
|
19
|
-
outcome = @action.call(
|
19
|
+
outcome = @action.call(
|
20
|
+
parent_ctx: instance.ctx,
|
21
|
+
parent_railway_flow: instance.railway_flow,
|
22
|
+
meta_store: instance.ms
|
23
|
+
)
|
20
24
|
|
21
25
|
resolve(outcome: outcome, instance: instance)
|
22
26
|
end
|
@@ -26,8 +30,6 @@ module Decouplio
|
|
26
30
|
def resolve(outcome:, instance:)
|
27
31
|
result = outcome.success?
|
28
32
|
|
29
|
-
instance.error_store.merge(outcome.error_store)
|
30
|
-
|
31
33
|
Decouplio::Steps::Shared::FailResolver.call(
|
32
34
|
instance: instance,
|
33
35
|
result: result,
|
@@ -15,16 +15,18 @@ module Decouplio
|
|
15
15
|
|
16
16
|
def process(instance:)
|
17
17
|
instance.append_railway_flow(@name)
|
18
|
-
|
18
|
+
@action.call(
|
19
|
+
parent_ctx: instance.ctx,
|
20
|
+
parent_railway_flow: instance.railway_flow,
|
21
|
+
meta_store: instance.ms
|
22
|
+
)
|
19
23
|
|
20
|
-
resolve(
|
24
|
+
resolve(instance: instance)
|
21
25
|
end
|
22
26
|
|
23
27
|
private
|
24
28
|
|
25
|
-
def resolve(
|
26
|
-
instance.error_store.merge(outcome.error_store)
|
27
|
-
|
29
|
+
def resolve(instance:)
|
28
30
|
instance.pass_action
|
29
31
|
|
30
32
|
if @on_success_type == Decouplio::Const::Results::FINISH_HIM
|
@@ -16,7 +16,11 @@ module Decouplio
|
|
16
16
|
|
17
17
|
def process(instance:)
|
18
18
|
instance.append_railway_flow(@name)
|
19
|
-
outcome = @action.call(
|
19
|
+
outcome = @action.call(
|
20
|
+
parent_ctx: instance.ctx,
|
21
|
+
parent_railway_flow: instance.railway_flow,
|
22
|
+
meta_store: instance.ms
|
23
|
+
)
|
20
24
|
|
21
25
|
resolve(outcome: outcome, instance: instance)
|
22
26
|
end
|
@@ -26,8 +30,6 @@ module Decouplio
|
|
26
30
|
def resolve(outcome:, instance:)
|
27
31
|
result = outcome.success?
|
28
32
|
|
29
|
-
instance.error_store.merge(outcome.error_store)
|
30
|
-
|
31
33
|
Decouplio::Steps::Shared::StepResolver.call(
|
32
34
|
instance: instance,
|
33
35
|
result: result,
|
@@ -6,10 +6,11 @@ require_relative 'shared/fail_resolver'
|
|
6
6
|
module Decouplio
|
7
7
|
module Steps
|
8
8
|
class ServiceFail < Decouplio::Steps::BaseStep
|
9
|
-
def initialize(name:, service:, on_success_type:, on_failure_type:)
|
9
|
+
def initialize(name:, service:, args:, on_success_type:, on_failure_type:)
|
10
10
|
super()
|
11
11
|
@name = name
|
12
12
|
@service = service
|
13
|
+
@args = args
|
13
14
|
@on_success_type = on_success_type
|
14
15
|
@on_failure_type = on_failure_type
|
15
16
|
end
|
@@ -18,7 +19,8 @@ module Decouplio
|
|
18
19
|
instance.append_railway_flow(@name)
|
19
20
|
result = @service.call(
|
20
21
|
ctx: instance.ctx,
|
21
|
-
|
22
|
+
ms: instance.meta_store,
|
23
|
+
**@args
|
22
24
|
)
|
23
25
|
|
24
26
|
resolve(result: result, instance: instance)
|
@@ -5,10 +5,11 @@ require_relative 'base_step'
|
|
5
5
|
module Decouplio
|
6
6
|
module Steps
|
7
7
|
class ServicePass < Decouplio::Steps::BaseStep
|
8
|
-
def initialize(name:, service:, on_success_type:, on_failure_type:)
|
8
|
+
def initialize(name:, service:, args:, on_success_type:, on_failure_type:)
|
9
9
|
super()
|
10
10
|
@name = name
|
11
11
|
@service = service
|
12
|
+
@args = args
|
12
13
|
@on_success_type = on_success_type
|
13
14
|
@on_failure_type = on_failure_type
|
14
15
|
end
|
@@ -17,7 +18,8 @@ module Decouplio
|
|
17
18
|
instance.append_railway_flow(@name)
|
18
19
|
@service.call(
|
19
20
|
ctx: instance.ctx,
|
20
|
-
|
21
|
+
ms: instance.meta_store,
|
22
|
+
**@args
|
21
23
|
)
|
22
24
|
|
23
25
|
resolve(instance: instance)
|
@@ -6,10 +6,11 @@ require_relative 'shared/step_resolver'
|
|
6
6
|
module Decouplio
|
7
7
|
module Steps
|
8
8
|
class ServiceStep < Decouplio::Steps::BaseStep
|
9
|
-
def initialize(name:, service:, on_success_type:, on_failure_type:)
|
9
|
+
def initialize(name:, service:, args:, on_success_type:, on_failure_type:)
|
10
10
|
super()
|
11
11
|
@name = name
|
12
12
|
@service = service
|
13
|
+
@args = args
|
13
14
|
@on_success_type = on_success_type
|
14
15
|
@on_failure_type = on_failure_type
|
15
16
|
end
|
@@ -18,7 +19,8 @@ module Decouplio
|
|
18
19
|
instance.append_railway_flow(@name)
|
19
20
|
result = @service.call(
|
20
21
|
ctx: instance.ctx,
|
21
|
-
|
22
|
+
ms: instance.meta_store,
|
23
|
+
**@args
|
22
24
|
)
|
23
25
|
|
24
26
|
resolve(result: result, instance: instance)
|
@@ -42,16 +42,6 @@ module Decouplio
|
|
42
42
|
errored_option: condition_options.to_s,
|
43
43
|
details: %i[if unless]
|
44
44
|
)
|
45
|
-
when Decouplio::Const::Types::DOBY_TYPE
|
46
|
-
raise Decouplio::Errors::DobyControversialKeysError.new(
|
47
|
-
errored_option: condition_options.to_s,
|
48
|
-
details: %i[if unless]
|
49
|
-
)
|
50
|
-
when Decouplio::Const::Types::AIDE_TYPE
|
51
|
-
raise Decouplio::Errors::AideControversialKeysError.new(
|
52
|
-
errored_option: condition_options.to_s,
|
53
|
-
details: %i[if unless]
|
54
|
-
)
|
55
45
|
end
|
56
46
|
end
|
57
47
|
end
|
data/lib/decouplio/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decouplio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.0alpha8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Bal
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -128,17 +128,16 @@ files:
|
|
128
128
|
- docker-compose.yml
|
129
129
|
- lib/decouplio.rb
|
130
130
|
- lib/decouplio/action.rb
|
131
|
+
- lib/decouplio/action_state_printer.rb
|
131
132
|
- lib/decouplio/composer.rb
|
132
133
|
- lib/decouplio/const/colors.rb
|
133
|
-
- lib/decouplio/const/doby_aide_options.rb
|
134
134
|
- lib/decouplio/const/error_messages.rb
|
135
135
|
- lib/decouplio/const/reserved_methods.rb
|
136
136
|
- lib/decouplio/const/results.rb
|
137
|
+
- lib/decouplio/const/step_options.rb
|
137
138
|
- lib/decouplio/const/types.rb
|
138
139
|
- lib/decouplio/const/validations/action_option_class.rb
|
139
|
-
- lib/decouplio/const/validations/aide.rb
|
140
140
|
- lib/decouplio/const/validations/common.rb
|
141
|
-
- lib/decouplio/const/validations/doby.rb
|
142
141
|
- lib/decouplio/const/validations/fail.rb
|
143
142
|
- lib/decouplio/const/validations/logic.rb
|
144
143
|
- lib/decouplio/const/validations/octo.rb
|
@@ -147,14 +146,9 @@ files:
|
|
147
146
|
- lib/decouplio/const/validations/resq.rb
|
148
147
|
- lib/decouplio/const/validations/step.rb
|
149
148
|
- lib/decouplio/const/validations/wrap.rb
|
150
|
-
- lib/decouplio/
|
149
|
+
- lib/decouplio/default_meta_store.rb
|
151
150
|
- lib/decouplio/errors/action_class_error.rb
|
152
|
-
- lib/decouplio/errors/aide_can_not_be_first_step_error.rb
|
153
|
-
- lib/decouplio/errors/aide_controversial_keys_error.rb
|
154
|
-
- lib/decouplio/errors/aide_finish_him_error.rb
|
155
151
|
- lib/decouplio/errors/base_error.rb
|
156
|
-
- lib/decouplio/errors/doby_controversial_keys_error.rb
|
157
|
-
- lib/decouplio/errors/doby_finish_him_error.rb
|
158
152
|
- lib/decouplio/errors/error_store_error.rb
|
159
153
|
- lib/decouplio/errors/execution_error.rb
|
160
154
|
- lib/decouplio/errors/extra_key_for_fail_error.rb
|
@@ -184,8 +178,6 @@ files:
|
|
184
178
|
- lib/decouplio/errors/resq_handler_method_error.rb
|
185
179
|
- lib/decouplio/errors/step_controversial_keys_error.rb
|
186
180
|
- lib/decouplio/errors/step_finish_him_error.rb
|
187
|
-
- lib/decouplio/errors/step_is_not_defined_for_aide_error.rb
|
188
|
-
- lib/decouplio/errors/step_is_not_defined_for_doby_error.rb
|
189
181
|
- lib/decouplio/errors/step_is_not_defined_for_fail_error.rb
|
190
182
|
- lib/decouplio/errors/step_is_not_defined_for_pass_error.rb
|
191
183
|
- lib/decouplio/errors/step_is_not_defined_for_step_error.rb
|
@@ -201,10 +193,8 @@ files:
|
|
201
193
|
- lib/decouplio/octo_options_validator.rb
|
202
194
|
- lib/decouplio/options_validator.rb
|
203
195
|
- lib/decouplio/processor.rb
|
204
|
-
- lib/decouplio/steps/aide.rb
|
205
196
|
- lib/decouplio/steps/base_resq.rb
|
206
197
|
- lib/decouplio/steps/base_step.rb
|
207
|
-
- lib/decouplio/steps/doby.rb
|
208
198
|
- lib/decouplio/steps/fail.rb
|
209
199
|
- lib/decouplio/steps/if_condition_fail.rb
|
210
200
|
- lib/decouplio/steps/if_condition_pass.rb
|
@@ -226,11 +216,11 @@ files:
|
|
226
216
|
- lib/decouplio/steps/wrap.rb
|
227
217
|
- lib/decouplio/validators/condition.rb
|
228
218
|
- lib/decouplio/version.rb
|
229
|
-
homepage: https://github.
|
219
|
+
homepage: https://differencialx.github.io/decouplio.github.io/
|
230
220
|
licenses:
|
231
221
|
- MIT
|
232
222
|
metadata:
|
233
|
-
homepage_uri: https://github.
|
223
|
+
homepage_uri: https://differencialx.github.io/decouplio.github.io/
|
234
224
|
source_code_uri: https://github.com/differencialx/decouplio/blob/master/docs
|
235
225
|
changelog_uri: https://github.com/differencialx/decouplio/blob/master/docs/CHANGELOG.md
|
236
226
|
post_install_message:
|
@@ -248,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
238
|
- !ruby/object:Gem::Version
|
249
239
|
version: 1.3.1
|
250
240
|
requirements: []
|
251
|
-
rubygems_version: 3.
|
241
|
+
rubygems_version: 3.1.6
|
252
242
|
signing_key:
|
253
243
|
specification_version: 4
|
254
244
|
summary: Gem for business logic encapsulation
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decouplio
|
4
|
-
module Const
|
5
|
-
module Validations
|
6
|
-
module Aide
|
7
|
-
VALIDATION_ERROR_MESSAGE = <<~ERROR_MESSAGE
|
8
|
-
Next options are not allowed for "aide":
|
9
|
-
%s
|
10
|
-
|
11
|
-
Details:
|
12
|
-
%s
|
13
|
-
|
14
|
-
Allowed options are:
|
15
|
-
%s
|
16
|
-
|
17
|
-
Please read the manual about allowed options here:
|
18
|
-
%s
|
19
|
-
ERROR_MESSAGE
|
20
|
-
|
21
|
-
ALLOWED_OPTIONS_MESSAGE = <<~ALLOWED_OPTIONS
|
22
|
-
on_success: <step name OR :finish_him>
|
23
|
-
on_failure: <step name OR :finish_him>
|
24
|
-
finish_him: :on_success
|
25
|
-
finish_him: :on_failure
|
26
|
-
finish_him: true
|
27
|
-
if: <instance method symbol>
|
28
|
-
unless: <instance method symbol>
|
29
|
-
ALLOWED_OPTIONS
|
30
|
-
MANUAL_URL = 'https://stub.aide.manual.url'
|
31
|
-
OPTIONS_IS_NOT_ALLOWED = '"%s" option(s) is not allowed for "aide"'
|
32
|
-
METHOD_NOT_DEFINED = 'aide :%s'
|
33
|
-
CONTROVERSIAL_KEYS = '"%s" option(s) is not allowed along with "%s" option(s)'
|
34
|
-
FIRST_STEP = '"aide" can not be the first step'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decouplio
|
4
|
-
module Const
|
5
|
-
module Validations
|
6
|
-
module Doby
|
7
|
-
VALIDATION_ERROR_MESSAGE = <<~ERROR_MESSAGE
|
8
|
-
Next options are not allowed for "doby":
|
9
|
-
%s
|
10
|
-
|
11
|
-
Details:
|
12
|
-
%s
|
13
|
-
|
14
|
-
Allowed options are:
|
15
|
-
%s
|
16
|
-
|
17
|
-
Please read the manual about allowed options here:
|
18
|
-
%s
|
19
|
-
ERROR_MESSAGE
|
20
|
-
|
21
|
-
ALLOWED_OPTIONS_MESSAGE = <<~ALLOWED_OPTIONS
|
22
|
-
on_success: <step name OR :finish_him>
|
23
|
-
on_failure: <step name OR :finish_him>
|
24
|
-
finish_him: :on_success
|
25
|
-
finish_him: :on_failure
|
26
|
-
if: <instance method symbol>
|
27
|
-
unless: <instance method symbol>
|
28
|
-
ALLOWED_OPTIONS
|
29
|
-
MANUAL_URL = 'https://stub.doby.manual.url'
|
30
|
-
OPTIONS_IS_NOT_ALLOWED = '"%s" option(s) is not allowed for "doby"'
|
31
|
-
METHOD_NOT_DEFINED = 'doby :%s'
|
32
|
-
CONTROVERSIAL_KEYS = '"%s" option(s) is not allowed along with "%s" option(s)'
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decouplio
|
4
|
-
class DefaultErrorHandler
|
5
|
-
attr_reader :errors
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
@errors = {}
|
9
|
-
end
|
10
|
-
|
11
|
-
def add_error(key, message)
|
12
|
-
@errors.store(
|
13
|
-
key,
|
14
|
-
(@errors[key] || []) + [message].flatten
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
def merge(error_store)
|
19
|
-
@errors = @errors.merge(error_store.errors) do |_key, this_val, other_val|
|
20
|
-
this_val + other_val
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'base_error'
|
4
|
-
require_relative '../const/validations/aide'
|
5
|
-
|
6
|
-
module Decouplio
|
7
|
-
module Errors
|
8
|
-
class AideCanNotBeFirstStepError < Decouplio::Errors::BaseError
|
9
|
-
def template
|
10
|
-
Decouplio::Const::Validations::Aide::FIRST_STEP
|
11
|
-
end
|
12
|
-
|
13
|
-
def interpolation_values
|
14
|
-
[]
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'base_error'
|
4
|
-
require_relative '../const/validations/aide'
|
5
|
-
|
6
|
-
module Decouplio
|
7
|
-
module Errors
|
8
|
-
class AideControversialKeysError < Decouplio::Errors::BaseError
|
9
|
-
def template
|
10
|
-
Decouplio::Const::Validations::Aide::VALIDATION_ERROR_MESSAGE
|
11
|
-
end
|
12
|
-
|
13
|
-
def interpolation_values
|
14
|
-
[
|
15
|
-
@errored_option,
|
16
|
-
format(
|
17
|
-
Decouplio::Const::Validations::Aide::CONTROVERSIAL_KEYS,
|
18
|
-
*@details
|
19
|
-
),
|
20
|
-
Decouplio::Const::Validations::Aide::ALLOWED_OPTIONS_MESSAGE,
|
21
|
-
Decouplio::Const::Validations::Aide::MANUAL_URL
|
22
|
-
]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'base_error'
|
4
|
-
require_relative '../const/validations/aide'
|
5
|
-
|
6
|
-
module Decouplio
|
7
|
-
module Errors
|
8
|
-
class AideFinishHimError < Decouplio::Errors::BaseError
|
9
|
-
def template
|
10
|
-
Decouplio::Const::Validations::Aide::VALIDATION_ERROR_MESSAGE
|
11
|
-
end
|
12
|
-
|
13
|
-
def interpolation_values
|
14
|
-
[
|
15
|
-
@errored_option,
|
16
|
-
format(
|
17
|
-
Decouplio::Const::Validations::Common::WRONG_FINISH_HIM_VALUE,
|
18
|
-
@details
|
19
|
-
),
|
20
|
-
Decouplio::Const::Validations::Aide::ALLOWED_OPTIONS_MESSAGE,
|
21
|
-
Decouplio::Const::Validations::Aide::MANUAL_URL
|
22
|
-
]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'base_error'
|
4
|
-
require_relative '../const/validations/doby'
|
5
|
-
|
6
|
-
module Decouplio
|
7
|
-
module Errors
|
8
|
-
class DobyControversialKeysError < Decouplio::Errors::BaseError
|
9
|
-
def template
|
10
|
-
Decouplio::Const::Validations::Doby::VALIDATION_ERROR_MESSAGE
|
11
|
-
end
|
12
|
-
|
13
|
-
def interpolation_values
|
14
|
-
[
|
15
|
-
@errored_option,
|
16
|
-
format(
|
17
|
-
Decouplio::Const::Validations::Doby::CONTROVERSIAL_KEYS,
|
18
|
-
*@details
|
19
|
-
),
|
20
|
-
Decouplio::Const::Validations::Doby::ALLOWED_OPTIONS_MESSAGE,
|
21
|
-
Decouplio::Const::Validations::Doby::MANUAL_URL
|
22
|
-
]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'base_error'
|
4
|
-
require_relative '../const/validations/doby'
|
5
|
-
|
6
|
-
module Decouplio
|
7
|
-
module Errors
|
8
|
-
class DobyFinishHimError < Decouplio::Errors::BaseError
|
9
|
-
def template
|
10
|
-
Decouplio::Const::Validations::Doby::VALIDATION_ERROR_MESSAGE
|
11
|
-
end
|
12
|
-
|
13
|
-
def interpolation_values
|
14
|
-
[
|
15
|
-
@errored_option,
|
16
|
-
format(
|
17
|
-
Decouplio::Const::Validations::Common::WRONG_FINISH_HIM_VALUE,
|
18
|
-
@details
|
19
|
-
),
|
20
|
-
Decouplio::Const::Validations::Doby::ALLOWED_OPTIONS_MESSAGE,
|
21
|
-
Decouplio::Const::Validations::Doby::MANUAL_URL
|
22
|
-
]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|