cmdx 1.11.0 → 1.13.0
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/.cursor/rules/cursor-instructions.mdc +8 -0
- data/.yard-lint.yml +174 -0
- data/CHANGELOG.md +24 -0
- data/docs/attributes/definitions.md +5 -1
- data/docs/attributes/validations.md +47 -6
- data/docs/basics/execution.md +56 -0
- data/docs/basics/setup.md +26 -3
- data/docs/deprecation.md +0 -2
- data/docs/getting_started.md +11 -0
- data/docs/logging.md +6 -10
- data/docs/outcomes/result.md +12 -8
- data/docs/outcomes/states.md +4 -4
- data/docs/outcomes/statuses.md +6 -6
- data/docs/tips_and_tricks.md +4 -0
- data/examples/active_record_database_transaction.md +27 -0
- data/examples/flipper_feature_flags.md +50 -0
- data/examples/redis_idempotency.md +71 -0
- data/examples/sentry_error_tracking.md +46 -0
- data/lib/cmdx/attribute.rb +6 -0
- data/lib/cmdx/callback_registry.rb +2 -1
- data/lib/cmdx/chain.rb +20 -7
- data/lib/cmdx/coercion_registry.rb +2 -1
- data/lib/cmdx/coercions/boolean.rb +3 -3
- data/lib/cmdx/coercions/complex.rb +1 -0
- data/lib/cmdx/coercions/string.rb +1 -0
- data/lib/cmdx/coercions/symbol.rb +1 -0
- data/lib/cmdx/configuration.rb +1 -3
- data/lib/cmdx/context.rb +5 -2
- data/lib/cmdx/executor.rb +29 -24
- data/lib/cmdx/middleware_registry.rb +1 -0
- data/lib/cmdx/result.rb +32 -89
- data/lib/cmdx/task.rb +10 -11
- data/lib/cmdx/utils/call.rb +3 -1
- data/lib/cmdx/utils/condition.rb +0 -3
- data/lib/cmdx/utils/format.rb +1 -1
- data/lib/cmdx/validators/exclusion.rb +2 -0
- data/lib/cmdx/validators/inclusion.rb +2 -0
- data/lib/cmdx/validators/length.rb +6 -0
- data/lib/cmdx/validators/numeric.rb +6 -0
- data/lib/cmdx/version.rb +1 -1
- data/lib/generators/cmdx/locale_generator.rb +6 -5
- data/mkdocs.yml +5 -1
- metadata +20 -1
data/lib/cmdx/result.rb
CHANGED
|
@@ -95,7 +95,7 @@ module CMDx
|
|
|
95
95
|
# @rbs @cause: (Exception | nil)
|
|
96
96
|
attr_reader :cause
|
|
97
97
|
|
|
98
|
-
def_delegators :task, :context, :chain, :errors
|
|
98
|
+
def_delegators :task, :context, :chain, :errors, :dry_run?
|
|
99
99
|
alias ctx context
|
|
100
100
|
|
|
101
101
|
# @param task [CMDx::Task] The task instance this result represents
|
|
@@ -118,6 +118,7 @@ module CMDx
|
|
|
118
118
|
@metadata = {}
|
|
119
119
|
@reason = nil
|
|
120
120
|
@cause = nil
|
|
121
|
+
@rolled_back = false
|
|
121
122
|
end
|
|
122
123
|
|
|
123
124
|
STATES.each do |s|
|
|
@@ -129,26 +130,6 @@ module CMDx
|
|
|
129
130
|
#
|
|
130
131
|
# @rbs () -> bool
|
|
131
132
|
define_method(:"#{s}?") { state == s }
|
|
132
|
-
|
|
133
|
-
# @param block [Proc] Block to execute conditionally
|
|
134
|
-
#
|
|
135
|
-
# @yield [self] Executes the block if result is in specified state
|
|
136
|
-
#
|
|
137
|
-
# @return [self] Returns self for method chaining
|
|
138
|
-
#
|
|
139
|
-
# @raise [ArgumentError] When no block is provided
|
|
140
|
-
#
|
|
141
|
-
# @example
|
|
142
|
-
# result.handle_initialized { |r| puts "Starting execution" }
|
|
143
|
-
# result.handle_complete { |r| puts "Task completed" }
|
|
144
|
-
#
|
|
145
|
-
# @rbs () { (Result) -> void } -> self
|
|
146
|
-
define_method(:"handle_#{s}") do |&block|
|
|
147
|
-
raise ArgumentError, "block required" unless block
|
|
148
|
-
|
|
149
|
-
block.call(self) if send(:"#{s}?")
|
|
150
|
-
self
|
|
151
|
-
end
|
|
152
133
|
end
|
|
153
134
|
|
|
154
135
|
# @return [self] Returns self for method chaining
|
|
@@ -171,25 +152,6 @@ module CMDx
|
|
|
171
152
|
complete? || interrupted?
|
|
172
153
|
end
|
|
173
154
|
|
|
174
|
-
# @param block [Proc] Block to execute conditionally
|
|
175
|
-
#
|
|
176
|
-
# @yield [self] Executes the block if task has been executed
|
|
177
|
-
#
|
|
178
|
-
# @return [self] Returns self for method chaining
|
|
179
|
-
#
|
|
180
|
-
# @raise [ArgumentError] When no block is provided
|
|
181
|
-
#
|
|
182
|
-
# @example
|
|
183
|
-
# result.handle_executed { |r| puts "Task finished: #{r.outcome}" }
|
|
184
|
-
#
|
|
185
|
-
# @rbs () { (Result) -> void } -> self
|
|
186
|
-
def handle_executed(&)
|
|
187
|
-
raise ArgumentError, "block required" unless block_given?
|
|
188
|
-
|
|
189
|
-
yield(self) if executed?
|
|
190
|
-
self
|
|
191
|
-
end
|
|
192
|
-
|
|
193
155
|
# @raise [RuntimeError] When attempting to transition from invalid state
|
|
194
156
|
#
|
|
195
157
|
# @example
|
|
@@ -241,26 +203,6 @@ module CMDx
|
|
|
241
203
|
#
|
|
242
204
|
# @rbs () -> bool
|
|
243
205
|
define_method(:"#{s}?") { status == s }
|
|
244
|
-
|
|
245
|
-
# @param block [Proc] Block to execute conditionally
|
|
246
|
-
#
|
|
247
|
-
# @yield [self] Executes the block if result has specified status
|
|
248
|
-
#
|
|
249
|
-
# @return [self] Returns self for method chaining
|
|
250
|
-
#
|
|
251
|
-
# @raise [ArgumentError] When no block is provided
|
|
252
|
-
#
|
|
253
|
-
# @example
|
|
254
|
-
# result.handle_success { |r| puts "Task succeeded" }
|
|
255
|
-
# result.handle_failed { |r| puts "Task failed: #{r.reason}" }
|
|
256
|
-
#
|
|
257
|
-
# @rbs () { (Result) -> void } -> self
|
|
258
|
-
define_method(:"handle_#{s}") do |&block|
|
|
259
|
-
raise ArgumentError, "block required" unless block
|
|
260
|
-
|
|
261
|
-
block.call(self) if send(:"#{s}?")
|
|
262
|
-
self
|
|
263
|
-
end
|
|
264
206
|
end
|
|
265
207
|
|
|
266
208
|
# @return [Boolean] Whether the task execution was successful (not failed)
|
|
@@ -274,25 +216,6 @@ module CMDx
|
|
|
274
216
|
end
|
|
275
217
|
alias ok? good?
|
|
276
218
|
|
|
277
|
-
# @param block [Proc] Block to execute conditionally
|
|
278
|
-
#
|
|
279
|
-
# @yield [self] Executes the block if task execution was successful
|
|
280
|
-
#
|
|
281
|
-
# @return [self] Returns self for method chaining
|
|
282
|
-
#
|
|
283
|
-
# @raise [ArgumentError] When no block is provided
|
|
284
|
-
#
|
|
285
|
-
# @example
|
|
286
|
-
# result.handle_good { |r| puts "Task completed successfully" }
|
|
287
|
-
#
|
|
288
|
-
# @rbs () { (Result) -> void } -> self
|
|
289
|
-
def handle_good(&)
|
|
290
|
-
raise ArgumentError, "block required" unless block_given?
|
|
291
|
-
|
|
292
|
-
yield(self) if good?
|
|
293
|
-
self
|
|
294
|
-
end
|
|
295
|
-
|
|
296
219
|
# @return [Boolean] Whether the task execution was unsuccessful (not success)
|
|
297
220
|
#
|
|
298
221
|
# @example
|
|
@@ -303,22 +226,21 @@ module CMDx
|
|
|
303
226
|
!success?
|
|
304
227
|
end
|
|
305
228
|
|
|
306
|
-
# @
|
|
307
|
-
#
|
|
308
|
-
# @yield [self] Executes the block if task execution was unsuccessful
|
|
229
|
+
# @yield [self] Executes the block if task status or state matches
|
|
309
230
|
#
|
|
310
231
|
# @return [self] Returns self for method chaining
|
|
311
232
|
#
|
|
312
233
|
# @raise [ArgumentError] When no block is provided
|
|
313
234
|
#
|
|
314
235
|
# @example
|
|
315
|
-
# result.
|
|
236
|
+
# result.on(:bad) { |r| puts "Task had issues: #{r.reason}" }
|
|
237
|
+
# result.on(:success, :complete) { |r| puts "Task completed successfully" }
|
|
316
238
|
#
|
|
317
239
|
# @rbs () { (Result) -> void } -> self
|
|
318
|
-
def
|
|
240
|
+
def on(*states_or_statuses, &)
|
|
319
241
|
raise ArgumentError, "block required" unless block_given?
|
|
320
242
|
|
|
321
|
-
yield(self) if
|
|
243
|
+
yield(self) if states_or_statuses.any? { |s| send(:"#{s}?") }
|
|
322
244
|
self
|
|
323
245
|
end
|
|
324
246
|
|
|
@@ -326,6 +248,7 @@ module CMDx
|
|
|
326
248
|
# @param halt [Boolean] Whether to halt execution after skipping
|
|
327
249
|
# @param cause [Exception, nil] Exception that caused the skip
|
|
328
250
|
# @param metadata [Hash] Additional metadata about the skip
|
|
251
|
+
# @option metadata [Object] :* Any key-value pairs for additional metadata
|
|
329
252
|
#
|
|
330
253
|
# @raise [RuntimeError] When attempting to skip from invalid status
|
|
331
254
|
#
|
|
@@ -352,6 +275,7 @@ module CMDx
|
|
|
352
275
|
# @param halt [Boolean] Whether to halt execution after failure
|
|
353
276
|
# @param cause [Exception, nil] Exception that caused the failure
|
|
354
277
|
# @param metadata [Hash] Additional metadata about the failure
|
|
278
|
+
# @option metadata [Object] :* Any key-value pairs for additional metadata
|
|
355
279
|
#
|
|
356
280
|
# @raise [RuntimeError] When attempting to fail from invalid status
|
|
357
281
|
#
|
|
@@ -407,6 +331,7 @@ module CMDx
|
|
|
407
331
|
# @param halt [Boolean] Whether to halt execution after throwing
|
|
408
332
|
# @param cause [Exception, nil] Exception that caused the throw
|
|
409
333
|
# @param metadata [Hash] Additional metadata to merge
|
|
334
|
+
# @option metadata [Object] :* Any key-value pairs for additional metadata
|
|
410
335
|
#
|
|
411
336
|
# @raise [TypeError] When result is not a CMDx::Result instance
|
|
412
337
|
#
|
|
@@ -495,6 +420,27 @@ module CMDx
|
|
|
495
420
|
failed? && !caused_failure?
|
|
496
421
|
end
|
|
497
422
|
|
|
423
|
+
# @return [void]
|
|
424
|
+
#
|
|
425
|
+
# @example
|
|
426
|
+
# result.rolled_back!
|
|
427
|
+
# result.rolled_back? # => true
|
|
428
|
+
#
|
|
429
|
+
# @rbs () -> void
|
|
430
|
+
def rolled_back!
|
|
431
|
+
@rolled_back = true
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
# @return [Boolean] Whether the result has been rolled back
|
|
435
|
+
#
|
|
436
|
+
# @example
|
|
437
|
+
# result.rolled_back? # => true
|
|
438
|
+
#
|
|
439
|
+
# @rbs () -> bool
|
|
440
|
+
def rolled_back?
|
|
441
|
+
!!@rolled_back
|
|
442
|
+
end
|
|
443
|
+
|
|
498
444
|
# @return [Integer] Index of this result in the chain
|
|
499
445
|
#
|
|
500
446
|
# @example
|
|
@@ -533,6 +479,7 @@ module CMDx
|
|
|
533
479
|
if interrupted?
|
|
534
480
|
hash[:reason] = reason
|
|
535
481
|
hash[:cause] = cause
|
|
482
|
+
hash[:rolled_back] = rolled_back?
|
|
536
483
|
end
|
|
537
484
|
|
|
538
485
|
if failed?
|
|
@@ -557,8 +504,6 @@ module CMDx
|
|
|
557
504
|
end
|
|
558
505
|
end
|
|
559
506
|
|
|
560
|
-
# @param keys [Array] Array of keys to deconstruct
|
|
561
|
-
#
|
|
562
507
|
# @return [Array] Array containing state, status, reason, cause, and metadata
|
|
563
508
|
#
|
|
564
509
|
# @example
|
|
@@ -570,8 +515,6 @@ module CMDx
|
|
|
570
515
|
[state, status, reason, cause, metadata]
|
|
571
516
|
end
|
|
572
517
|
|
|
573
|
-
# @param keys [Array] Array of keys to deconstruct
|
|
574
|
-
#
|
|
575
518
|
# @return [Hash] Hash with key-value pairs for pattern matching
|
|
576
519
|
#
|
|
577
520
|
# @example
|
data/lib/cmdx/task.rb
CHANGED
|
@@ -71,6 +71,7 @@ module CMDx
|
|
|
71
71
|
attr_reader :chain
|
|
72
72
|
|
|
73
73
|
def_delegators :result, :skip!, :fail!, :throw!
|
|
74
|
+
def_delegators :chain, :dry_run?
|
|
74
75
|
|
|
75
76
|
# @param context [Hash, Context] The initial context for the task
|
|
76
77
|
#
|
|
@@ -94,12 +95,13 @@ module CMDx
|
|
|
94
95
|
@id = Identifier.generate
|
|
95
96
|
@context = Context.build(context)
|
|
96
97
|
@result = Result.new(self)
|
|
97
|
-
@chain = Chain.build(@result)
|
|
98
|
+
@chain = Chain.build(@result, dry_run: @context.delete(:dry_run))
|
|
98
99
|
end
|
|
99
100
|
|
|
100
101
|
class << self
|
|
101
102
|
|
|
102
103
|
# @param options [Hash] Configuration options to merge with existing settings
|
|
104
|
+
# @option options [Object] :* Any configuration option key-value pairs
|
|
103
105
|
#
|
|
104
106
|
# @return [Hash] The merged settings hash
|
|
105
107
|
#
|
|
@@ -136,7 +138,6 @@ module CMDx
|
|
|
136
138
|
|
|
137
139
|
# @param type [Symbol] The type of registry to register with
|
|
138
140
|
# @param object [Object] The object to register
|
|
139
|
-
# @param args [Array] Additional arguments for registration
|
|
140
141
|
#
|
|
141
142
|
# @raise [RuntimeError] If the registry type is unknown
|
|
142
143
|
#
|
|
@@ -158,7 +159,6 @@ module CMDx
|
|
|
158
159
|
|
|
159
160
|
# @param type [Symbol] The type of registry to deregister from
|
|
160
161
|
# @param object [Object] The object to deregister
|
|
161
|
-
# @param args [Array] Additional arguments for deregistration
|
|
162
162
|
#
|
|
163
163
|
# @raise [RuntimeError] If the registry type is unknown
|
|
164
164
|
#
|
|
@@ -178,8 +178,6 @@ module CMDx
|
|
|
178
178
|
end
|
|
179
179
|
end
|
|
180
180
|
|
|
181
|
-
# @param args [Array] Arguments to build the attribute with
|
|
182
|
-
#
|
|
183
181
|
# @example
|
|
184
182
|
# attributes :name, :email
|
|
185
183
|
# attributes :age, type: Integer, default: 18
|
|
@@ -190,8 +188,6 @@ module CMDx
|
|
|
190
188
|
end
|
|
191
189
|
alias attribute attributes
|
|
192
190
|
|
|
193
|
-
# @param args [Array] Arguments to build the optional attribute with
|
|
194
|
-
#
|
|
195
191
|
# @example
|
|
196
192
|
# optional :description, :notes
|
|
197
193
|
# optional :priority, type: Symbol, default: :normal
|
|
@@ -201,8 +197,6 @@ module CMDx
|
|
|
201
197
|
register(:attribute, Attribute.optional(...))
|
|
202
198
|
end
|
|
203
199
|
|
|
204
|
-
# @param args [Array] Arguments to build the required attribute with
|
|
205
|
-
#
|
|
206
200
|
# @example
|
|
207
201
|
# required :name, :email
|
|
208
202
|
# required :age, type: Integer, min: 0
|
|
@@ -242,6 +236,8 @@ module CMDx
|
|
|
242
236
|
end
|
|
243
237
|
|
|
244
238
|
# @param args [Array] Arguments to pass to the task constructor
|
|
239
|
+
# @param kwargs [Hash] Keyword arguments to pass to the task constructor
|
|
240
|
+
# @option kwargs [Object] :* Any key-value pairs to pass to the task constructor
|
|
245
241
|
#
|
|
246
242
|
# @return [Result] The execution result
|
|
247
243
|
#
|
|
@@ -259,6 +255,8 @@ module CMDx
|
|
|
259
255
|
end
|
|
260
256
|
|
|
261
257
|
# @param args [Array] Arguments to pass to the task constructor
|
|
258
|
+
# @param kwargs [Hash] Keyword arguments to pass to the task constructor
|
|
259
|
+
# @option kwargs [Object] :* Any key-value pairs to pass to the task constructor
|
|
262
260
|
#
|
|
263
261
|
# @return [Result] The execution result
|
|
264
262
|
#
|
|
@@ -322,8 +320,6 @@ module CMDx
|
|
|
322
320
|
end
|
|
323
321
|
end
|
|
324
322
|
|
|
325
|
-
# @return [Hash] A hash representation of the task
|
|
326
|
-
#
|
|
327
323
|
# @option return [Integer] :index The result index
|
|
328
324
|
# @option return [String] :chain_id The chain identifier
|
|
329
325
|
# @option return [String] :type The task type ("Task" or "Workflow")
|
|
@@ -331,6 +327,8 @@ module CMDx
|
|
|
331
327
|
# @option return [String] :class The task class name
|
|
332
328
|
# @option return [String] :id The task identifier
|
|
333
329
|
#
|
|
330
|
+
# @return [Hash] A hash representation of the task
|
|
331
|
+
#
|
|
334
332
|
# @example
|
|
335
333
|
# task_hash = task.to_h
|
|
336
334
|
# puts "Task type: #{task_hash[:type]}"
|
|
@@ -344,6 +342,7 @@ module CMDx
|
|
|
344
342
|
type: self.class.include?(Workflow) ? "Workflow" : "Task",
|
|
345
343
|
tags: self.class.settings[:tags],
|
|
346
344
|
class: self.class.name,
|
|
345
|
+
dry_run: dry_run?,
|
|
347
346
|
id:
|
|
348
347
|
}
|
|
349
348
|
end
|
data/lib/cmdx/utils/call.rb
CHANGED
|
@@ -17,7 +17,9 @@ module CMDx
|
|
|
17
17
|
# @param callable [Symbol, Proc, #call] The callable to invoke
|
|
18
18
|
# @param args [Array] Positional arguments to pass to the callable
|
|
19
19
|
# @param kwargs [Hash] Keyword arguments to pass to the callable
|
|
20
|
-
# @
|
|
20
|
+
# @option kwargs [Object] :* Any keyword arguments to pass to the callable
|
|
21
|
+
#
|
|
22
|
+
# @yield [Object] Block to pass to the callable
|
|
21
23
|
#
|
|
22
24
|
# @return [Object] The result of invoking the callable
|
|
23
25
|
#
|
data/lib/cmdx/utils/condition.rb
CHANGED
|
@@ -34,9 +34,6 @@ module CMDx
|
|
|
34
34
|
# @param options [Hash] Conditional options hash
|
|
35
35
|
# @option options [Object] :if Condition that must be true for evaluation to succeed
|
|
36
36
|
# @option options [Object] :unless Condition that must be false for evaluation to succeed
|
|
37
|
-
# @param args [Array] Additional arguments passed to condition evaluation
|
|
38
|
-
# @param kwargs [Hash] Additional keyword arguments passed to condition evaluation
|
|
39
|
-
# @param block [Proc, nil] Optional block passed to condition evaluation
|
|
40
37
|
#
|
|
41
38
|
# @return [Boolean] true if conditions are met, false otherwise
|
|
42
39
|
#
|
data/lib/cmdx/utils/format.rb
CHANGED
|
@@ -32,7 +32,7 @@ module CMDx
|
|
|
32
32
|
#
|
|
33
33
|
# @rbs (untyped message) -> untyped
|
|
34
34
|
def to_log(message)
|
|
35
|
-
if message.respond_to?(:to_h) && message.class.ancestors.any? { |a| a.
|
|
35
|
+
if message.respond_to?(:to_h) && message.class.ancestors.any? { |a| a.name&.start_with?("CMDx::") }
|
|
36
36
|
message.to_h
|
|
37
37
|
else
|
|
38
38
|
message
|
|
@@ -50,6 +50,7 @@ module CMDx
|
|
|
50
50
|
#
|
|
51
51
|
# @param values [Array] The forbidden values that caused the error
|
|
52
52
|
# @param options [Hash] Validation options containing custom messages
|
|
53
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
53
54
|
#
|
|
54
55
|
# @raise [ValidationError] With appropriate error message
|
|
55
56
|
def raise_of_validation_error!(values, options)
|
|
@@ -65,6 +66,7 @@ module CMDx
|
|
|
65
66
|
# @param min [Object] The minimum value of the forbidden range
|
|
66
67
|
# @param max [Object] The maximum value of the forbidden range
|
|
67
68
|
# @param options [Hash] Validation options containing custom messages
|
|
69
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
68
70
|
#
|
|
69
71
|
# @raise [ValidationError] With appropriate error message
|
|
70
72
|
def raise_within_validation_error!(min, max, options)
|
|
@@ -52,6 +52,7 @@ module CMDx
|
|
|
52
52
|
#
|
|
53
53
|
# @param values [Array] The allowed values that caused the error
|
|
54
54
|
# @param options [Hash] Validation options containing custom messages
|
|
55
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
55
56
|
#
|
|
56
57
|
# @raise [ValidationError] With appropriate error message
|
|
57
58
|
def raise_of_validation_error!(values, options)
|
|
@@ -67,6 +68,7 @@ module CMDx
|
|
|
67
68
|
# @param min [Object] The minimum value of the allowed range
|
|
68
69
|
# @param max [Object] The maximum value of the allowed range
|
|
69
70
|
# @param options [Hash] Validation options containing custom messages
|
|
71
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
70
72
|
#
|
|
71
73
|
# @raise [ValidationError] With appropriate error message
|
|
72
74
|
def raise_within_validation_error!(min, max, options)
|
|
@@ -87,6 +87,7 @@ module CMDx
|
|
|
87
87
|
# @param min [Integer] Minimum length value
|
|
88
88
|
# @param max [Integer] Maximum length value
|
|
89
89
|
# @param options [Hash] Validation options containing custom messages
|
|
90
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
90
91
|
#
|
|
91
92
|
# @raise [ValidationError] Always raised with appropriate message
|
|
92
93
|
#
|
|
@@ -103,6 +104,7 @@ module CMDx
|
|
|
103
104
|
# @param min [Integer] Minimum length value
|
|
104
105
|
# @param max [Integer] Maximum length value
|
|
105
106
|
# @param options [Hash] Validation options containing custom messages
|
|
107
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
106
108
|
#
|
|
107
109
|
# @raise [ValidationError] Always raised with appropriate message
|
|
108
110
|
#
|
|
@@ -118,6 +120,7 @@ module CMDx
|
|
|
118
120
|
#
|
|
119
121
|
# @param min [Integer] Minimum required length
|
|
120
122
|
# @param options [Hash] Validation options containing custom messages
|
|
123
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
121
124
|
#
|
|
122
125
|
# @raise [ValidationError] Always raised with appropriate message
|
|
123
126
|
#
|
|
@@ -133,6 +136,7 @@ module CMDx
|
|
|
133
136
|
#
|
|
134
137
|
# @param max [Integer] Maximum allowed length
|
|
135
138
|
# @param options [Hash] Validation options containing custom messages
|
|
139
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
136
140
|
#
|
|
137
141
|
# @raise [ValidationError] Always raised with appropriate message
|
|
138
142
|
#
|
|
@@ -148,6 +152,7 @@ module CMDx
|
|
|
148
152
|
#
|
|
149
153
|
# @param is [Integer] Required exact length
|
|
150
154
|
# @param options [Hash] Validation options containing custom messages
|
|
155
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
151
156
|
#
|
|
152
157
|
# @raise [ValidationError] Always raised with appropriate message
|
|
153
158
|
#
|
|
@@ -163,6 +168,7 @@ module CMDx
|
|
|
163
168
|
#
|
|
164
169
|
# @param is_not [Integer] Length that is not allowed
|
|
165
170
|
# @param options [Hash] Validation options containing custom messages
|
|
171
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
166
172
|
#
|
|
167
173
|
# @raise [ValidationError] Always raised with appropriate message
|
|
168
174
|
#
|
|
@@ -82,6 +82,7 @@ module CMDx
|
|
|
82
82
|
# @param min [Numeric] The minimum value of the allowed range
|
|
83
83
|
# @param max [Numeric] The maximum value of the allowed range
|
|
84
84
|
# @param options [Hash] Validation options containing custom messages
|
|
85
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
85
86
|
#
|
|
86
87
|
# @raise [ValidationError] With appropriate error message
|
|
87
88
|
#
|
|
@@ -98,6 +99,7 @@ module CMDx
|
|
|
98
99
|
# @param min [Numeric] The minimum value of the excluded range
|
|
99
100
|
# @param max [Numeric] The maximum value of the excluded range
|
|
100
101
|
# @param options [Hash] Validation options containing custom messages
|
|
102
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
101
103
|
#
|
|
102
104
|
# @raise [ValidationError] With appropriate error message
|
|
103
105
|
#
|
|
@@ -113,6 +115,7 @@ module CMDx
|
|
|
113
115
|
#
|
|
114
116
|
# @param min [Numeric] The minimum allowed value
|
|
115
117
|
# @param options [Hash] Validation options containing custom messages
|
|
118
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
116
119
|
#
|
|
117
120
|
# @raise [ValidationError] With appropriate error message
|
|
118
121
|
#
|
|
@@ -128,6 +131,7 @@ module CMDx
|
|
|
128
131
|
#
|
|
129
132
|
# @param max [Numeric] The maximum allowed value
|
|
130
133
|
# @param options [Hash] Validation options containing custom messages
|
|
134
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
131
135
|
#
|
|
132
136
|
# @raise [ValidationError] With appropriate error message
|
|
133
137
|
#
|
|
@@ -143,6 +147,7 @@ module CMDx
|
|
|
143
147
|
#
|
|
144
148
|
# @param is [Numeric] The exact value that was expected
|
|
145
149
|
# @param options [Hash] Validation options containing custom messages
|
|
150
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
146
151
|
#
|
|
147
152
|
# @raise [ValidationError] With appropriate error message
|
|
148
153
|
#
|
|
@@ -158,6 +163,7 @@ module CMDx
|
|
|
158
163
|
#
|
|
159
164
|
# @param is_not [Numeric] The value that was not allowed
|
|
160
165
|
# @param options [Hash] Validation options containing custom messages
|
|
166
|
+
# @option options [Object] :* Any validation option key-value pairs
|
|
161
167
|
#
|
|
162
168
|
# @raise [ValidationError] With appropriate error message
|
|
163
169
|
#
|
data/lib/cmdx/version.rb
CHANGED
|
@@ -22,13 +22,14 @@ module Cmdx
|
|
|
22
22
|
#
|
|
23
23
|
# @return [void]
|
|
24
24
|
#
|
|
25
|
-
# @example
|
|
26
|
-
#
|
|
27
|
-
#
|
|
25
|
+
# @example Copy default (English) locale file
|
|
26
|
+
# generator = Cmdx::LocaleGenerator.new(["en"])
|
|
27
|
+
# generator.copy_locale_files
|
|
28
28
|
# # => Creates config/locales/en.yml
|
|
29
29
|
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
30
|
+
# @example Copy Spanish locale file
|
|
31
|
+
# generator = Cmdx::LocaleGenerator.new(["es"])
|
|
32
|
+
# generator.copy_locale_files
|
|
32
33
|
# # => Creates config/locales/es.yml
|
|
33
34
|
def copy_locale_files
|
|
34
35
|
copy_file("#{locale}.yml", "config/locales/#{locale}.yml")
|
data/mkdocs.yml
CHANGED
|
@@ -65,7 +65,11 @@ markdown_extensions:
|
|
|
65
65
|
- attr_list
|
|
66
66
|
- md_in_html
|
|
67
67
|
- pymdownx.details
|
|
68
|
-
- pymdownx.superfences
|
|
68
|
+
- pymdownx.superfences:
|
|
69
|
+
custom_fences:
|
|
70
|
+
- name: mermaid
|
|
71
|
+
class: mermaid
|
|
72
|
+
format: !!python/name:pymdownx.superfences.fence_code_format
|
|
69
73
|
- pymdownx.highlight:
|
|
70
74
|
anchor_linenums: true
|
|
71
75
|
line_spans: __span
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cmdx
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juan Gomez
|
|
@@ -205,6 +205,20 @@ dependencies:
|
|
|
205
205
|
- - ">="
|
|
206
206
|
- !ruby/object:Gem::Version
|
|
207
207
|
version: '0'
|
|
208
|
+
- !ruby/object:Gem::Dependency
|
|
209
|
+
name: yard-lint
|
|
210
|
+
requirement: !ruby/object:Gem::Requirement
|
|
211
|
+
requirements:
|
|
212
|
+
- - ">="
|
|
213
|
+
- !ruby/object:Gem::Version
|
|
214
|
+
version: '0'
|
|
215
|
+
type: :development
|
|
216
|
+
prerelease: false
|
|
217
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
218
|
+
requirements:
|
|
219
|
+
- - ">="
|
|
220
|
+
- !ruby/object:Gem::Version
|
|
221
|
+
version: '0'
|
|
208
222
|
description: CMDx is a framework for building maintainable business processes.
|
|
209
223
|
email:
|
|
210
224
|
- drexed@users.noreply.github.com
|
|
@@ -222,6 +236,7 @@ files:
|
|
|
222
236
|
- ".rspec"
|
|
223
237
|
- ".rubocop.yml"
|
|
224
238
|
- ".ruby-version"
|
|
239
|
+
- ".yard-lint.yml"
|
|
225
240
|
- ".yardopts"
|
|
226
241
|
- CHANGELOG.md
|
|
227
242
|
- CODE_OF_CONDUCT.md
|
|
@@ -259,8 +274,12 @@ files:
|
|
|
259
274
|
- docs/stylesheets/extra.css
|
|
260
275
|
- docs/tips_and_tricks.md
|
|
261
276
|
- docs/workflows.md
|
|
277
|
+
- examples/active_record_database_transaction.md
|
|
262
278
|
- examples/active_record_query_tagging.md
|
|
279
|
+
- examples/flipper_feature_flags.md
|
|
263
280
|
- examples/paper_trail_whatdunnit.md
|
|
281
|
+
- examples/redis_idempotency.md
|
|
282
|
+
- examples/sentry_error_tracking.md
|
|
264
283
|
- examples/sidekiq_async_execution.md
|
|
265
284
|
- examples/stoplight_circuit_breaker.md
|
|
266
285
|
- lib/cmdx.rb
|