decouplio 1.0.0alpha → 1.0.0alpha3
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 +4 -0
- data/README.md +26 -2
- data/benchmarks/Gemfile +2 -1
- data/benchmarks/multi_step_benchmark.rb +336 -0
- data/benchmarks/single_step_benchmark.rb +159 -0
- data/decouplio.gemspec +1 -1
- data/docker-compose.yml +13 -2
- data/docs/aide.rb +59 -0
- data/docs/doby.rb +1 -1
- data/docs/doby_aide.md +208 -0
- data/docs/fail.md +143 -0
- data/docs/fail.rb +126 -29
- data/docs/index.md +1 -1
- data/docs/logic_block.md +4 -0
- data/docs/octo.md +59 -2
- data/docs/quick_start.md +1 -1
- data/docs/resq.md +2 -2
- data/docs/step.md +148 -0
- data/docs/step.rb +119 -18
- data/docs/step_as_a_service.md +25 -11
- data/docs/step_as_a_service.rb +2 -2
- data/docs/wrap.md +8 -0
- data/lib/decouplio/action.rb +22 -3
- data/lib/decouplio/composer.rb +91 -20
- data/lib/decouplio/const/doby_aide_options.rb +15 -0
- data/lib/decouplio/const/reserved_methods.rb +13 -9
- data/lib/decouplio/const/results.rb +2 -0
- data/lib/decouplio/const/types.rb +19 -5
- data/lib/decouplio/const/validations/aide.rb +38 -0
- data/lib/decouplio/const/validations/doby.rb +36 -0
- data/lib/decouplio/const/validations/fail.rb +5 -1
- data/lib/decouplio/const/validations/octo.rb +2 -1
- data/lib/decouplio/errors/aide_can_not_be_first_step_error.rb +18 -0
- data/lib/decouplio/errors/aide_controversial_keys_error.rb +26 -0
- data/lib/decouplio/errors/aide_finish_him_error.rb +26 -0
- data/lib/decouplio/errors/doby_controversial_keys_error.rb +26 -0
- data/lib/decouplio/errors/doby_finish_him_error.rb +26 -0
- data/lib/decouplio/errors/{fail_is_first_step_error.rb → fail_can_not_be_first_step_error.rb} +1 -1
- data/lib/decouplio/errors/step_is_not_defined_for_aide_error.rb +26 -0
- data/lib/decouplio/errors/step_is_not_defined_for_doby_error.rb +27 -0
- data/lib/decouplio/logic_dsl.rb +30 -3
- data/lib/decouplio/options_validator.rb +122 -8
- data/lib/decouplio/steps/aide.rb +37 -0
- data/lib/decouplio/steps/doby.rb +14 -9
- data/lib/decouplio/steps/fail.rb +7 -22
- data/lib/decouplio/steps/inner_action_fail.rb +7 -22
- data/lib/decouplio/steps/inner_action_step.rb +7 -18
- data/lib/decouplio/steps/octo.rb +7 -2
- data/lib/decouplio/steps/service_fail.rb +11 -23
- data/lib/decouplio/steps/service_pass.rb +4 -1
- data/lib/decouplio/steps/service_step.rb +11 -19
- data/lib/decouplio/steps/shared/fail_resolver.rb +40 -0
- data/lib/decouplio/steps/shared/step_resolver.rb +43 -0
- data/lib/decouplio/steps/step.rb +7 -18
- data/lib/decouplio/steps/wrap.rb +7 -18
- data/lib/decouplio/validators/condition.rb +10 -0
- data/lib/decouplio/version.rb +1 -1
- metadata +22 -7
- data/benchmarks/benchmarks.rb +0 -527
- data/docs/doby.md +0 -80
data/lib/decouplio/action.rb
CHANGED
@@ -7,15 +7,18 @@ require_relative 'default_error_handler'
|
|
7
7
|
require_relative 'errors/logic_redefinition_error'
|
8
8
|
require_relative 'errors/logic_is_not_defined_error'
|
9
9
|
require_relative 'errors/error_store_error'
|
10
|
+
require_relative 'const/results'
|
10
11
|
|
11
12
|
module Decouplio
|
12
13
|
class Action
|
14
|
+
PREVIOUS_STEP_INDEX = -2
|
15
|
+
|
13
16
|
extend Forwardable
|
14
17
|
def_delegators :@error_store, :errors, :add_error
|
15
18
|
attr_reader :railway_flow, :ctx, :error_store
|
16
19
|
|
17
20
|
def initialize(
|
18
|
-
parent_railway_flow: nil, parent_ctx: nil,
|
21
|
+
parent_railway_flow: nil, parent_ctx: nil, error_store:, **params
|
19
22
|
)
|
20
23
|
@error_store = error_store
|
21
24
|
@ctx = parent_ctx || params
|
@@ -43,6 +46,10 @@ module Decouplio
|
|
43
46
|
@failure = false
|
44
47
|
end
|
45
48
|
|
49
|
+
def previous_step
|
50
|
+
railway_flow[PREVIOUS_STEP_INDEX]
|
51
|
+
end
|
52
|
+
|
46
53
|
def append_railway_flow(stp)
|
47
54
|
railway_flow << stp
|
48
55
|
end
|
@@ -55,10 +62,22 @@ module Decouplio
|
|
55
62
|
#{railway_flow.join(' -> ')}
|
56
63
|
|
57
64
|
Context:
|
58
|
-
#{ctx}
|
65
|
+
#{ctx.map { |k, v| "#{k.inspect} => #{v.inspect}" }.join("\n ")}
|
59
66
|
|
60
67
|
Errors:
|
61
|
-
#{
|
68
|
+
#{
|
69
|
+
if errors.is_a?(Hash)
|
70
|
+
if errors.empty?
|
71
|
+
'None'
|
72
|
+
else
|
73
|
+
errors.map do |k, v|
|
74
|
+
"#{k.inspect} => #{v.inspect}"
|
75
|
+
end.join("\n ")
|
76
|
+
end
|
77
|
+
else
|
78
|
+
errors
|
79
|
+
end
|
80
|
+
}
|
62
81
|
INSPECT
|
63
82
|
end
|
64
83
|
|
data/lib/decouplio/composer.rb
CHANGED
@@ -21,6 +21,7 @@ require_relative 'steps/service_step'
|
|
21
21
|
require_relative 'steps/service_fail'
|
22
22
|
require_relative 'steps/service_pass'
|
23
23
|
require_relative 'steps/doby'
|
24
|
+
require_relative 'steps/aide'
|
24
25
|
require_relative 'options_validator'
|
25
26
|
require_relative 'validators/condition'
|
26
27
|
|
@@ -129,7 +130,9 @@ module Decouplio
|
|
129
130
|
when Decouplio::Const::Types::SERVICE_TYPE_PASS
|
130
131
|
create_inner_service_pass(stp, flow)
|
131
132
|
when Decouplio::Const::Types::DOBY_TYPE
|
132
|
-
create_doby(stp)
|
133
|
+
create_doby(stp, flow)
|
134
|
+
when Decouplio::Const::Types::AIDE_TYPE
|
135
|
+
create_aide(stp, flow)
|
133
136
|
end
|
134
137
|
end
|
135
138
|
|
@@ -183,7 +186,8 @@ module Decouplio
|
|
183
186
|
def create_octo(stp)
|
184
187
|
Decouplio::Steps::Octo.new(
|
185
188
|
name: stp[:name],
|
186
|
-
ctx_key: stp[:ctx_key]
|
189
|
+
ctx_key: stp[:ctx_key],
|
190
|
+
method: stp[:method]
|
187
191
|
)
|
188
192
|
end
|
189
193
|
|
@@ -266,11 +270,23 @@ module Decouplio
|
|
266
270
|
)
|
267
271
|
end
|
268
272
|
|
269
|
-
def create_doby(stp)
|
273
|
+
def create_doby(stp, flow)
|
270
274
|
Decouplio::Steps::Doby.new(
|
271
275
|
name: stp[:name],
|
272
276
|
doby_class: stp[:doby_class],
|
273
|
-
doby_options: stp[:doby_options]
|
277
|
+
doby_options: stp[:doby_options],
|
278
|
+
on_success_type: success_type(flow, stp),
|
279
|
+
on_failure_type: failure_type(flow, stp)
|
280
|
+
)
|
281
|
+
end
|
282
|
+
|
283
|
+
def create_aide(stp, flow)
|
284
|
+
Decouplio::Steps::Aide.new(
|
285
|
+
name: stp[:name],
|
286
|
+
aide_class: stp[:aide_class],
|
287
|
+
aide_options: stp[:aide_options],
|
288
|
+
on_success_type: success_type(flow, stp),
|
289
|
+
on_failure_type: failure_type(flow, stp)
|
274
290
|
)
|
275
291
|
end
|
276
292
|
|
@@ -294,6 +310,8 @@ module Decouplio
|
|
294
310
|
compose_fail_flow(stp, step_id, flow, idx, flow_hash, next_steps)
|
295
311
|
when Decouplio::Const::Types::DOBY_TYPE
|
296
312
|
compose_doby_flow(stp, step_id, flow, idx, flow_hash, next_steps)
|
313
|
+
when Decouplio::Const::Types::AIDE_TYPE
|
314
|
+
compose_aide_flow(stp, step_id, flow, idx, flow_hash, next_steps)
|
297
315
|
when Decouplio::Const::Types::IF_TYPE_PASS, Decouplio::Const::Types::UNLESS_TYPE_PASS
|
298
316
|
compose_pass_condition_flow(stp, flow, idx, flow_hash)
|
299
317
|
when Decouplio::Const::Types::IF_TYPE_FAIL, Decouplio::Const::Types::UNLESS_TYPE_FAIL
|
@@ -327,22 +345,22 @@ module Decouplio
|
|
327
345
|
stp[:flow][Decouplio::Const::Results::FINISH_HIM] = Decouplio::Const::Results::NO_STEP
|
328
346
|
end
|
329
347
|
|
330
|
-
def compose_doby_flow(stp,
|
348
|
+
def compose_doby_flow(stp, step_id, flow, idx, flow_hash, next_steps)
|
331
349
|
flow_values = flow.values + (next_steps&.values || [])
|
332
350
|
stp[:flow][Decouplio::Const::Results::PASS] = next_success_step(
|
333
351
|
flow_values,
|
334
352
|
idx,
|
335
|
-
|
353
|
+
flow[step_id][:on_success]
|
336
354
|
)
|
337
355
|
stp[:flow][Decouplio::Const::Results::FAIL] = next_failure_step(
|
338
356
|
flow_values,
|
339
357
|
idx,
|
340
|
-
|
358
|
+
flow[step_id][:on_failure]
|
341
359
|
)
|
342
360
|
stp[:flow][Decouplio::Const::Results::ERROR] = next_failure_step(
|
343
361
|
flow_values,
|
344
362
|
idx,
|
345
|
-
|
363
|
+
flow[step_id][:on_error]
|
346
364
|
)
|
347
365
|
stp[:flow][Decouplio::Const::Results::PASS] ||= flow_hash[Decouplio::Const::Results::PASS]
|
348
366
|
stp[:flow][Decouplio::Const::Results::FAIL] ||= flow_hash[Decouplio::Const::Results::FAIL]
|
@@ -350,6 +368,29 @@ module Decouplio
|
|
350
368
|
stp[:flow][Decouplio::Const::Results::FINISH_HIM] = Decouplio::Const::Results::NO_STEP
|
351
369
|
end
|
352
370
|
|
371
|
+
def compose_aide_flow(stp, step_id, flow, idx, flow_hash, next_steps)
|
372
|
+
flow_values = flow.values + (next_steps&.values || [])
|
373
|
+
stp[:flow][Decouplio::Const::Results::PASS] = next_failure_step(
|
374
|
+
flow_values,
|
375
|
+
idx,
|
376
|
+
flow[step_id][:on_success]
|
377
|
+
)
|
378
|
+
stp[:flow][Decouplio::Const::Results::FAIL] = next_failure_step(
|
379
|
+
flow_values,
|
380
|
+
idx,
|
381
|
+
flow[step_id][:on_failure]
|
382
|
+
)
|
383
|
+
stp[:flow][Decouplio::Const::Results::ERROR] = next_failure_step(
|
384
|
+
flow_values,
|
385
|
+
idx,
|
386
|
+
flow[step_id][:on_error]
|
387
|
+
)
|
388
|
+
stp[:flow][Decouplio::Const::Results::PASS] ||= flow_hash[Decouplio::Const::Results::FAIL]
|
389
|
+
stp[:flow][Decouplio::Const::Results::FAIL] ||= flow_hash[Decouplio::Const::Results::FAIL]
|
390
|
+
stp[:flow][Decouplio::Const::Results::ERROR] ||= flow_hash[Decouplio::Const::Results::ERROR]
|
391
|
+
stp[:flow][Decouplio::Const::Results::FINISH_HIM] = Decouplio::Const::Results::NO_STEP
|
392
|
+
end
|
393
|
+
|
353
394
|
def compose_fail_flow(stp, step_id, flow, idx, flow_hash, next_steps)
|
354
395
|
flow_values = flow.values + (next_steps&.values || [])
|
355
396
|
stp[:flow][Decouplio::Const::Results::PASS] = next_failure_step(
|
@@ -409,18 +450,30 @@ module Decouplio
|
|
409
450
|
return :finish_him if [:on_success, true].include?(finish_him(stp))
|
410
451
|
|
411
452
|
step_id = stp.dig(:flow, Decouplio::Const::Results::PASS)
|
412
|
-
Decouplio::Const::
|
413
|
-
|
414
|
-
|
453
|
+
if step_id.nil? && Decouplio::Const::Results::STEP_PASS == stp[:on_success]
|
454
|
+
Decouplio::Const::Results::STEP_PASS
|
455
|
+
elsif step_id.nil? && Decouplio::Const::Results::STEP_FAIL == stp[:on_success]
|
456
|
+
Decouplio::Const::Results::STEP_FAIL
|
457
|
+
else
|
458
|
+
Decouplio::Const::Types::PASS_FLOW.include?(
|
459
|
+
flow[step_id]&.[](:type)
|
460
|
+
)
|
461
|
+
end
|
415
462
|
end
|
416
463
|
|
417
464
|
def failure_type(flow, stp)
|
418
465
|
return :finish_him if [:on_failure, true].include?(finish_him(stp))
|
419
466
|
|
420
467
|
step_id = stp.dig(:flow, Decouplio::Const::Results::FAIL)
|
421
|
-
Decouplio::Const::
|
422
|
-
|
423
|
-
|
468
|
+
if step_id.nil? && Decouplio::Const::Results::STEP_PASS == stp[:on_failure]
|
469
|
+
Decouplio::Const::Results::STEP_PASS
|
470
|
+
elsif step_id.nil? && Decouplio::Const::Results::STEP_FAIL == stp[:on_on_failure]
|
471
|
+
Decouplio::Const::Results::STEP_FAIL
|
472
|
+
else
|
473
|
+
Decouplio::Const::Types::FAIL_FLOW.include?(
|
474
|
+
flow[step_id]&.[](:type)
|
475
|
+
)
|
476
|
+
end
|
424
477
|
end
|
425
478
|
|
426
479
|
def finish_him(stp)
|
@@ -543,7 +596,18 @@ module Decouplio
|
|
543
596
|
def next_success_step(steps, idx, value)
|
544
597
|
steps_slice = steps[(idx + 1)..]
|
545
598
|
steps_slice.each_with_index do |stp, index|
|
546
|
-
if
|
599
|
+
if (
|
600
|
+
Decouplio::Const::Results::STEP_PASS == value &&
|
601
|
+
Decouplio::Const::Types::SUCCESS_TRACK_STEP_TYPES.include?(stp[:type])
|
602
|
+
) || (
|
603
|
+
Decouplio::Const::Results::STEP_FAIL == value &&
|
604
|
+
Decouplio::Const::Types::FAILURE_TRACK_STEP_TYPES.include?(stp[:type])
|
605
|
+
) || (
|
606
|
+
!value &&
|
607
|
+
Decouplio::Const::Types::SUCCESS_TRACK_STEP_TYPES.include?(stp[:type])
|
608
|
+
)
|
609
|
+
return stp[:step_id]
|
610
|
+
elsif value == stp[:name]
|
547
611
|
prev_step = steps_slice[index - 1]
|
548
612
|
if [
|
549
613
|
Decouplio::Const::Types::IF_TYPE_PASS,
|
@@ -553,8 +617,6 @@ module Decouplio
|
|
553
617
|
else
|
554
618
|
return stp[:step_id]
|
555
619
|
end
|
556
|
-
elsif !value && Decouplio::Const::Types::SUCCESS_TRACK_STEP_TYPES.include?(stp[:type])
|
557
|
-
return stp[:step_id]
|
558
620
|
end
|
559
621
|
end
|
560
622
|
|
@@ -564,7 +626,18 @@ module Decouplio
|
|
564
626
|
def next_failure_step(steps, idx, value)
|
565
627
|
steps_slice = steps[(idx + 1)..]
|
566
628
|
steps_slice.each_with_index do |stp, index|
|
567
|
-
if
|
629
|
+
if (
|
630
|
+
Decouplio::Const::Results::STEP_PASS == value &&
|
631
|
+
Decouplio::Const::Types::SUCCESS_TRACK_STEP_TYPES.include?(stp[:type])
|
632
|
+
) || (
|
633
|
+
Decouplio::Const::Results::STEP_FAIL == value &&
|
634
|
+
Decouplio::Const::Types::FAILURE_TRACK_STEP_TYPES.include?(stp[:type])
|
635
|
+
) || (
|
636
|
+
!value &&
|
637
|
+
Decouplio::Const::Types::FAILURE_TRACK_STEP_TYPES.include?(stp[:type])
|
638
|
+
)
|
639
|
+
return stp[:step_id]
|
640
|
+
elsif value == stp[:name]
|
568
641
|
prev_step = steps_slice[index - 1]
|
569
642
|
if [
|
570
643
|
Decouplio::Const::Types::IF_TYPE_FAIL,
|
@@ -574,8 +647,6 @@ module Decouplio
|
|
574
647
|
else
|
575
648
|
return stp[:step_id]
|
576
649
|
end
|
577
|
-
elsif !value && Decouplio::Const::Types::FAILURE_TRACK_STEP_TYPES.include?(stp[:type])
|
578
|
-
return stp[:step_id]
|
579
650
|
end
|
580
651
|
end
|
581
652
|
|
@@ -1,17 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'results'
|
4
|
+
|
3
5
|
module Decouplio
|
4
6
|
module Const
|
5
7
|
module ReservedMethods
|
6
|
-
NAMES =
|
7
|
-
[]
|
8
|
-
success
|
9
|
-
failure
|
10
|
-
fail_action
|
11
|
-
pass_action
|
12
|
-
append_railway_flow
|
13
|
-
inspect
|
14
|
-
to_s
|
8
|
+
NAMES = [
|
9
|
+
:[],
|
10
|
+
:success?,
|
11
|
+
:failure?,
|
12
|
+
:fail_action,
|
13
|
+
:pass_action,
|
14
|
+
:append_railway_flow,
|
15
|
+
:inspect,
|
16
|
+
:to_s,
|
17
|
+
Decouplio::Const::Results::STEP_PASS,
|
18
|
+
Decouplio::Const::Results::STEP_FAIL
|
15
19
|
].freeze
|
16
20
|
end
|
17
21
|
end
|
@@ -14,6 +14,7 @@ module Decouplio
|
|
14
14
|
UNLESS_TYPE_FAIL = :unless_fail
|
15
15
|
OCTO_TYPE = :octo
|
16
16
|
DOBY_TYPE = :doby
|
17
|
+
AIDE_TYPE = :aide
|
17
18
|
ACTION_TYPE_STEP = :action_step
|
18
19
|
ACTION_TYPE_FAIL = :action_fail
|
19
20
|
ACTION_TYPE_PASS = :action_pass
|
@@ -81,6 +82,14 @@ module Decouplio
|
|
81
82
|
SERVICE_TYPE_PASS => {
|
82
83
|
IF_TYPE => IF_TYPE_PASS,
|
83
84
|
UNLESS_TYPE => UNLESS_TYPE_PASS
|
85
|
+
},
|
86
|
+
DOBY_TYPE => {
|
87
|
+
IF_TYPE => IF_TYPE_PASS,
|
88
|
+
UNLESS_TYPE => UNLESS_TYPE_PASS
|
89
|
+
},
|
90
|
+
AIDE_TYPE => {
|
91
|
+
IF_TYPE => IF_TYPE_FAIL,
|
92
|
+
UNLESS_TYPE => UNLESS_TYPE_FAIL
|
84
93
|
}
|
85
94
|
}.freeze
|
86
95
|
STEP_TYPE_TO_RESQ_TYPE = {
|
@@ -93,7 +102,8 @@ module Decouplio
|
|
93
102
|
UNLESS_TYPE_PASS => RESQ_TYPE_STEP,
|
94
103
|
IF_TYPE_FAIL => RESQ_TYPE_FAIL,
|
95
104
|
UNLESS_TYPE_FAIL => RESQ_TYPE_FAIL,
|
96
|
-
DOBY_TYPE => RESQ_TYPE_STEP
|
105
|
+
DOBY_TYPE => RESQ_TYPE_STEP,
|
106
|
+
AIDE_TYPE => RESQ_TYPE_FAIL
|
97
107
|
}.freeze
|
98
108
|
STEP_TYPE_TO_INNER_TYPE = {
|
99
109
|
STEP_TYPE => ACTION_TYPE_STEP,
|
@@ -115,7 +125,8 @@ module Decouplio
|
|
115
125
|
OCTO_TYPE,
|
116
126
|
WRAP_TYPE,
|
117
127
|
RESQ_TYPE,
|
118
|
-
DOBY_TYPE
|
128
|
+
DOBY_TYPE,
|
129
|
+
AIDE_TYPE
|
119
130
|
].freeze
|
120
131
|
PASS_FLOW = [
|
121
132
|
STEP_TYPE,
|
@@ -135,7 +146,8 @@ module Decouplio
|
|
135
146
|
IF_TYPE_FAIL,
|
136
147
|
UNLESS_TYPE_FAIL,
|
137
148
|
ACTION_TYPE_FAIL,
|
138
|
-
SERVICE_TYPE_FAIL
|
149
|
+
SERVICE_TYPE_FAIL,
|
150
|
+
AIDE_TYPE
|
139
151
|
].freeze
|
140
152
|
|
141
153
|
MAIN_FLOW_TYPES = [
|
@@ -143,7 +155,8 @@ module Decouplio
|
|
143
155
|
FAIL_TYPE,
|
144
156
|
PASS_TYPE,
|
145
157
|
WRAP_TYPE,
|
146
|
-
DOBY_TYPE
|
158
|
+
DOBY_TYPE,
|
159
|
+
AIDE_TYPE
|
147
160
|
].freeze
|
148
161
|
SUCCESS_TRACK_STEP_TYPES = [
|
149
162
|
STEP_TYPE,
|
@@ -166,7 +179,8 @@ module Decouplio
|
|
166
179
|
UNLESS_TYPE_FAIL,
|
167
180
|
RESQ_TYPE_FAIL,
|
168
181
|
ACTION_TYPE_FAIL,
|
169
|
-
SERVICE_TYPE_FAIL
|
182
|
+
SERVICE_TYPE_FAIL,
|
183
|
+
AIDE_TYPE
|
170
184
|
].freeze
|
171
185
|
end
|
172
186
|
end
|
@@ -0,0 +1,38 @@
|
|
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
|
@@ -0,0 +1,36 @@
|
|
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
|
@@ -19,6 +19,10 @@ module Decouplio
|
|
19
19
|
ERROR_MESSAGE
|
20
20
|
|
21
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
|
22
26
|
finish_him: true
|
23
27
|
if: <instance method symbol>
|
24
28
|
unless: <instance method symbol>
|
@@ -27,7 +31,7 @@ module Decouplio
|
|
27
31
|
OPTIONS_IS_NOT_ALLOWED = '"%s" option(s) is not allowed for "fail"'
|
28
32
|
METHOD_NOT_DEFINED = 'fail :%s'
|
29
33
|
CONTROVERSIAL_KEYS = '"%s" option(s) is not allowed along with "%s" option(s)'
|
30
|
-
FIRST_STEP = '"fail" can not be first step'
|
34
|
+
FIRST_STEP = '"fail" can not be the first step'
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
@@ -28,7 +28,8 @@ module Decouplio
|
|
28
28
|
%s
|
29
29
|
ERROR_MESSAGE
|
30
30
|
ALLOWED_OPTIONS_MESSAGE = <<~ALLOWED_OPTIONS
|
31
|
-
ctx_key: <ctx key with strategy name to be used for strategy mapping> - required
|
31
|
+
ctx_key: <ctx key with strategy name to be used for strategy mapping> - required if "method" option is not present
|
32
|
+
method: <method which will return strategy name to be used for strategy mapping> - required if "ctx_key" option is not present
|
32
33
|
if: <instance method symbol>
|
33
34
|
unless: <instance method symbol>
|
34
35
|
ALLOWED_OPTIONS
|
@@ -0,0 +1,18 @@
|
|
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
|
@@ -0,0 +1,26 @@
|
|
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
|
@@ -0,0 +1,26 @@
|
|
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
|
@@ -0,0 +1,26 @@
|
|
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
|
@@ -0,0 +1,26 @@
|
|
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
|
data/lib/decouplio/errors/{fail_is_first_step_error.rb → fail_can_not_be_first_step_error.rb}
RENAMED
@@ -5,7 +5,7 @@ require_relative '../const/validations/fail'
|
|
5
5
|
|
6
6
|
module Decouplio
|
7
7
|
module Errors
|
8
|
-
class
|
8
|
+
class FailCanNotBeFirstStepError < Decouplio::Errors::BaseError
|
9
9
|
def template
|
10
10
|
Decouplio::Const::Validations::Fail::FIRST_STEP
|
11
11
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base_error'
|
4
|
+
require_relative '../const/validations/fail'
|
5
|
+
|
6
|
+
module Decouplio
|
7
|
+
module Errors
|
8
|
+
class StepIsNotDefinedForAideError < 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::STEP_IS_NOT_DEFINED,
|
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
|