cmdx 1.20.0 → 2.0.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/CHANGELOG.md +131 -1
- data/README.md +37 -24
- data/lib/cmdx/.DS_Store +0 -0
- data/lib/cmdx/callbacks.rb +179 -0
- data/lib/cmdx/chain.rb +78 -175
- data/lib/cmdx/coercions/array.rb +19 -33
- data/lib/cmdx/coercions/big_decimal.rb +12 -29
- data/lib/cmdx/coercions/boolean.rb +25 -45
- data/lib/cmdx/coercions/coerce.rb +32 -0
- data/lib/cmdx/coercions/complex.rb +12 -27
- data/lib/cmdx/coercions/date.rb +29 -33
- data/lib/cmdx/coercions/date_time.rb +29 -33
- data/lib/cmdx/coercions/float.rb +8 -29
- data/lib/cmdx/coercions/hash.rb +17 -43
- data/lib/cmdx/coercions/integer.rb +8 -32
- data/lib/cmdx/coercions/rational.rb +12 -33
- data/lib/cmdx/coercions/string.rb +6 -24
- data/lib/cmdx/coercions/symbol.rb +12 -26
- data/lib/cmdx/coercions/time.rb +31 -35
- data/lib/cmdx/coercions.rb +174 -0
- data/lib/cmdx/configuration.rb +45 -225
- data/lib/cmdx/context.rb +263 -242
- data/lib/cmdx/deprecation.rb +67 -0
- data/lib/cmdx/deprecators/error.rb +22 -0
- data/lib/cmdx/deprecators/log.rb +22 -0
- data/lib/cmdx/deprecators/warn.rb +21 -0
- data/lib/cmdx/deprecators.rb +101 -0
- data/lib/cmdx/errors.rb +145 -79
- data/lib/cmdx/executors/fiber.rb +42 -0
- data/lib/cmdx/executors/thread.rb +36 -0
- data/lib/cmdx/executors.rb +95 -0
- data/lib/cmdx/fault.rb +85 -78
- data/lib/cmdx/i18n_proxy.rb +104 -0
- data/lib/cmdx/input.rb +294 -0
- data/lib/cmdx/inputs.rb +218 -0
- data/lib/cmdx/log_formatters/json.rb +9 -20
- data/lib/cmdx/log_formatters/key_value.rb +10 -21
- data/lib/cmdx/log_formatters/line.rb +7 -19
- data/lib/cmdx/log_formatters/logstash.rb +8 -21
- data/lib/cmdx/log_formatters/raw.rb +8 -20
- data/lib/cmdx/logger_proxy.rb +30 -0
- data/lib/cmdx/mergers/deep_merge.rb +23 -0
- data/lib/cmdx/mergers/last_write_wins.rb +23 -0
- data/lib/cmdx/mergers/no_merge.rb +20 -0
- data/lib/cmdx/mergers.rb +95 -0
- data/lib/cmdx/middlewares.rb +128 -0
- data/lib/cmdx/output.rb +115 -0
- data/lib/cmdx/outputs.rb +66 -0
- data/lib/cmdx/pipeline.rb +144 -131
- data/lib/cmdx/railtie.rb +10 -36
- data/lib/cmdx/result.rb +252 -473
- data/lib/cmdx/retriers/bounded_random.rb +24 -0
- data/lib/cmdx/retriers/decorrelated_jitter.rb +28 -0
- data/lib/cmdx/retriers/exponential.rb +23 -0
- data/lib/cmdx/retriers/fibonacci.rb +39 -0
- data/lib/cmdx/retriers/full_random.rb +23 -0
- data/lib/cmdx/retriers/half_random.rb +24 -0
- data/lib/cmdx/retriers/linear.rb +23 -0
- data/lib/cmdx/retriers.rb +106 -0
- data/lib/cmdx/retry.rb +117 -138
- data/lib/cmdx/runtime.rb +251 -0
- data/lib/cmdx/settings.rb +68 -196
- data/lib/cmdx/signal.rb +165 -0
- data/lib/cmdx/task.rb +443 -336
- data/lib/cmdx/telemetry.rb +108 -0
- data/lib/cmdx/util.rb +73 -0
- data/lib/cmdx/validators/absence.rb +10 -39
- data/lib/cmdx/validators/exclusion.rb +33 -52
- data/lib/cmdx/validators/format.rb +19 -49
- data/lib/cmdx/validators/inclusion.rb +33 -54
- data/lib/cmdx/validators/length.rb +125 -127
- data/lib/cmdx/validators/numeric.rb +123 -123
- data/lib/cmdx/validators/presence.rb +10 -39
- data/lib/cmdx/validators/validate.rb +31 -0
- data/lib/cmdx/validators.rb +161 -0
- data/lib/cmdx/version.rb +2 -4
- data/lib/cmdx/workflow.rb +74 -82
- data/lib/cmdx.rb +111 -42
- data/lib/generators/cmdx/install_generator.rb +7 -17
- data/lib/generators/cmdx/task_generator.rb +12 -29
- data/lib/generators/cmdx/templates/install.rb +128 -52
- data/lib/generators/cmdx/templates/task.rb.tt +1 -1
- data/lib/generators/cmdx/templates/workflow.rb.tt +1 -2
- data/lib/generators/cmdx/workflow_generator.rb +12 -29
- data/lib/locales/en.yml +9 -6
- data/mkdocs.yml +25 -23
- metadata +39 -138
- data/lib/cmdx/attribute.rb +0 -440
- data/lib/cmdx/attribute_registry.rb +0 -185
- data/lib/cmdx/attribute_value.rb +0 -252
- data/lib/cmdx/callback_registry.rb +0 -169
- data/lib/cmdx/coercion_registry.rb +0 -138
- data/lib/cmdx/deprecator.rb +0 -77
- data/lib/cmdx/exception.rb +0 -46
- data/lib/cmdx/executor.rb +0 -374
- data/lib/cmdx/identifier.rb +0 -30
- data/lib/cmdx/locale.rb +0 -78
- data/lib/cmdx/middleware_registry.rb +0 -148
- data/lib/cmdx/middlewares/correlate.rb +0 -140
- data/lib/cmdx/middlewares/runtime.rb +0 -62
- data/lib/cmdx/middlewares/timeout.rb +0 -78
- data/lib/cmdx/parallelizer.rb +0 -100
- data/lib/cmdx/utils/call.rb +0 -53
- data/lib/cmdx/utils/condition.rb +0 -71
- data/lib/cmdx/utils/format.rb +0 -82
- data/lib/cmdx/utils/normalize.rb +0 -52
- data/lib/cmdx/utils/wrap.rb +0 -38
- data/lib/cmdx/validator_registry.rb +0 -143
- data/lib/generators/cmdx/locale_generator.rb +0 -39
- data/lib/locales/af.yml +0 -53
- data/lib/locales/ar.yml +0 -53
- data/lib/locales/az.yml +0 -53
- data/lib/locales/be.yml +0 -53
- data/lib/locales/bg.yml +0 -53
- data/lib/locales/bn.yml +0 -53
- data/lib/locales/bs.yml +0 -53
- data/lib/locales/ca.yml +0 -53
- data/lib/locales/cnr.yml +0 -53
- data/lib/locales/cs.yml +0 -53
- data/lib/locales/cy.yml +0 -53
- data/lib/locales/da.yml +0 -53
- data/lib/locales/de.yml +0 -53
- data/lib/locales/dz.yml +0 -53
- data/lib/locales/el.yml +0 -53
- data/lib/locales/eo.yml +0 -53
- data/lib/locales/es.yml +0 -53
- data/lib/locales/et.yml +0 -53
- data/lib/locales/eu.yml +0 -53
- data/lib/locales/fa.yml +0 -53
- data/lib/locales/fi.yml +0 -53
- data/lib/locales/fr.yml +0 -53
- data/lib/locales/fy.yml +0 -53
- data/lib/locales/gd.yml +0 -53
- data/lib/locales/gl.yml +0 -53
- data/lib/locales/he.yml +0 -53
- data/lib/locales/hi.yml +0 -53
- data/lib/locales/hr.yml +0 -53
- data/lib/locales/hu.yml +0 -53
- data/lib/locales/hy.yml +0 -53
- data/lib/locales/id.yml +0 -53
- data/lib/locales/is.yml +0 -53
- data/lib/locales/it.yml +0 -53
- data/lib/locales/ja.yml +0 -53
- data/lib/locales/ka.yml +0 -53
- data/lib/locales/kk.yml +0 -53
- data/lib/locales/km.yml +0 -53
- data/lib/locales/kn.yml +0 -53
- data/lib/locales/ko.yml +0 -53
- data/lib/locales/lb.yml +0 -53
- data/lib/locales/lo.yml +0 -53
- data/lib/locales/lt.yml +0 -53
- data/lib/locales/lv.yml +0 -53
- data/lib/locales/mg.yml +0 -53
- data/lib/locales/mk.yml +0 -53
- data/lib/locales/ml.yml +0 -53
- data/lib/locales/mn.yml +0 -53
- data/lib/locales/mr-IN.yml +0 -53
- data/lib/locales/ms.yml +0 -53
- data/lib/locales/nb.yml +0 -53
- data/lib/locales/ne.yml +0 -53
- data/lib/locales/nl.yml +0 -53
- data/lib/locales/nn.yml +0 -53
- data/lib/locales/oc.yml +0 -53
- data/lib/locales/or.yml +0 -53
- data/lib/locales/pa.yml +0 -53
- data/lib/locales/pl.yml +0 -53
- data/lib/locales/pt.yml +0 -53
- data/lib/locales/rm.yml +0 -53
- data/lib/locales/ro.yml +0 -53
- data/lib/locales/ru.yml +0 -53
- data/lib/locales/sc.yml +0 -53
- data/lib/locales/sk.yml +0 -53
- data/lib/locales/sl.yml +0 -53
- data/lib/locales/sq.yml +0 -53
- data/lib/locales/sr.yml +0 -53
- data/lib/locales/st.yml +0 -53
- data/lib/locales/sv.yml +0 -53
- data/lib/locales/sw.yml +0 -53
- data/lib/locales/ta.yml +0 -53
- data/lib/locales/te.yml +0 -53
- data/lib/locales/th.yml +0 -53
- data/lib/locales/tl.yml +0 -53
- data/lib/locales/tr.yml +0 -53
- data/lib/locales/tt.yml +0 -53
- data/lib/locales/ug.yml +0 -53
- data/lib/locales/uk.yml +0 -53
- data/lib/locales/ur.yml +0 -53
- data/lib/locales/uz.yml +0 -53
- data/lib/locales/vi.yml +0 -53
- data/lib/locales/wo.yml +0 -53
- data/lib/locales/zh-CN.yml +0 -53
- data/lib/locales/zh-HK.yml +0 -53
- data/lib/locales/zh-TW.yml +0 -53
- data/lib/locales/zh-YUE.yml +0 -53
data/lib/cmdx/configuration.rb
CHANGED
|
@@ -2,177 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
module CMDx
|
|
4
4
|
|
|
5
|
-
#
|
|
6
|
-
#
|
|
5
|
+
# Global defaults used by every task unless the task overrides via
|
|
6
|
+
# `Task.settings`/register DSL. A fresh `Task` subclass inherits the current
|
|
7
|
+
# configuration's registries (via `#dup`) at the time its accessor is first
|
|
8
|
+
# called, so changes to configuration only apply to tasks that haven't
|
|
9
|
+
# cached their copy yet.
|
|
7
10
|
class Configuration
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
attr_accessor :middlewares, :callbacks, :coercions, :validators, :executors,
|
|
13
|
+
:mergers, :retriers, :deprecators, :telemetry, :correlation_id, :default_locale,
|
|
14
|
+
:strict_context, :backtrace_cleaner, :log_exclusions, :log_formatter,
|
|
15
|
+
:log_level, :logger
|
|
11
16
|
|
|
12
|
-
# @rbs DEFAULT_ROLLPOINTS: Array[String]
|
|
13
|
-
DEFAULT_ROLLPOINTS = %w[failed].freeze
|
|
14
|
-
|
|
15
|
-
# Returns the middleware registry for task execution.
|
|
16
|
-
#
|
|
17
|
-
# @return [MiddlewareRegistry] The middleware registry
|
|
18
|
-
#
|
|
19
|
-
# @example
|
|
20
|
-
# config.middlewares.register(CustomMiddleware)
|
|
21
|
-
#
|
|
22
|
-
# @rbs @middlewares: MiddlewareRegistry
|
|
23
|
-
attr_accessor :middlewares
|
|
24
|
-
|
|
25
|
-
# Returns the callback registry for task lifecycle hooks.
|
|
26
|
-
#
|
|
27
|
-
# @return [CallbackRegistry] The callback registry
|
|
28
|
-
#
|
|
29
|
-
# @example
|
|
30
|
-
# config.callbacks.register(:before_execution, :log_start)
|
|
31
|
-
#
|
|
32
|
-
# @rbs @callbacks: CallbackRegistry
|
|
33
|
-
attr_accessor :callbacks
|
|
34
|
-
|
|
35
|
-
# Returns the coercion registry for type conversions.
|
|
36
|
-
#
|
|
37
|
-
# @return [CoercionRegistry] The coercion registry
|
|
38
|
-
#
|
|
39
|
-
# @example
|
|
40
|
-
# config.coercions.register(:custom, CustomCoercion)
|
|
41
|
-
#
|
|
42
|
-
# @rbs @coercions: CoercionRegistry
|
|
43
|
-
attr_accessor :coercions
|
|
44
|
-
|
|
45
|
-
# Returns the validator registry for attribute validation.
|
|
46
|
-
#
|
|
47
|
-
# @return [ValidatorRegistry] The validator registry
|
|
48
|
-
#
|
|
49
|
-
# @example
|
|
50
|
-
# config.validators.register(:email, EmailValidator)
|
|
51
|
-
#
|
|
52
|
-
# @rbs @validators: ValidatorRegistry
|
|
53
|
-
attr_accessor :validators
|
|
54
|
-
|
|
55
|
-
# Returns the breakpoint statuses for task execution interruption.
|
|
56
|
-
#
|
|
57
|
-
# @return [Array<String>] Array of status names that trigger breakpoints
|
|
58
|
-
#
|
|
59
|
-
# @example
|
|
60
|
-
# config.task_breakpoints = ["failed", "skipped"]
|
|
61
|
-
#
|
|
62
|
-
# @rbs @task_breakpoints: Array[String]
|
|
63
|
-
attr_accessor :task_breakpoints
|
|
64
|
-
|
|
65
|
-
# Returns the breakpoint statuses for workflow execution interruption.
|
|
66
|
-
#
|
|
67
|
-
# @return [Array<String>] Array of status names that trigger breakpoints
|
|
68
|
-
#
|
|
69
|
-
# @example
|
|
70
|
-
# config.workflow_breakpoints = ["failed", "skipped"]
|
|
71
|
-
#
|
|
72
|
-
# @rbs @task_breakpoints: Array[String]
|
|
73
|
-
# @rbs @workflow_breakpoints: Array[String]
|
|
74
|
-
attr_accessor :workflow_breakpoints
|
|
75
|
-
|
|
76
|
-
# Returns the logger instance for CMDx operations.
|
|
77
|
-
#
|
|
78
|
-
# @return [Logger] The logger instance
|
|
79
|
-
#
|
|
80
|
-
# @example
|
|
81
|
-
# config.logger.level = Logger::DEBUG
|
|
82
|
-
#
|
|
83
|
-
# @rbs @logger: Logger
|
|
84
|
-
attr_accessor :logger
|
|
85
|
-
|
|
86
|
-
# Returns whether to log backtraces for failed tasks.
|
|
87
|
-
#
|
|
88
|
-
# @return [Boolean] true if backtraces should be logged
|
|
89
|
-
#
|
|
90
|
-
# @example
|
|
91
|
-
# config.backtrace = true
|
|
92
|
-
#
|
|
93
|
-
# @rbs @backtrace: bool
|
|
94
|
-
attr_accessor :backtrace
|
|
95
|
-
|
|
96
|
-
# Returns the proc used to clean backtraces before logging.
|
|
97
|
-
#
|
|
98
|
-
# @return [Proc, nil] The backtrace cleaner proc, or nil if not set
|
|
99
|
-
#
|
|
100
|
-
# @example
|
|
101
|
-
# config.backtrace_cleaner = ->(bt) { bt.first(5) }
|
|
102
|
-
#
|
|
103
|
-
# @rbs @backtrace_cleaner: (Proc | nil)
|
|
104
|
-
attr_accessor :backtrace_cleaner
|
|
105
|
-
|
|
106
|
-
# Returns the proc called when exceptions occur during execution.
|
|
107
|
-
#
|
|
108
|
-
# @return [Proc, nil] The exception handler proc, or nil if not set
|
|
109
|
-
#
|
|
110
|
-
# @example
|
|
111
|
-
# config.exception_handler = ->(task, error) { Sentry.capture_exception(error) }
|
|
112
|
-
#
|
|
113
|
-
# @rbs @exception_handler: (Proc | nil)
|
|
114
|
-
attr_accessor :exception_handler
|
|
115
|
-
|
|
116
|
-
# Returns the statuses that trigger a task execution rollback.
|
|
117
|
-
#
|
|
118
|
-
# @return [Array<String>] Array of status names that trigger rollback
|
|
119
|
-
#
|
|
120
|
-
# @example
|
|
121
|
-
# config.rollback_on = ["failed", "skipped"]
|
|
122
|
-
#
|
|
123
|
-
# @rbs @rollback_on: Array[String]
|
|
124
|
-
attr_accessor :rollback_on
|
|
125
|
-
|
|
126
|
-
# Returns whether to freeze task results after execution.
|
|
127
|
-
# Set to false in test environments to allow stubbing on result objects.
|
|
128
|
-
#
|
|
129
|
-
# @return [Boolean] true if results should be frozen (default: true)
|
|
130
|
-
#
|
|
131
|
-
# @example
|
|
132
|
-
# config.freeze_results = false
|
|
133
|
-
#
|
|
134
|
-
# @rbs @freeze_results: bool
|
|
135
|
-
attr_accessor :freeze_results
|
|
136
|
-
|
|
137
|
-
# Returns the default locale used for built-in translation lookups.
|
|
138
|
-
# Must match the basename of a YAML file in lib/locales/ (e.g. "en", "es", "ja").
|
|
139
|
-
#
|
|
140
|
-
# @return [String] The locale identifier (default: "en")
|
|
141
|
-
#
|
|
142
|
-
# @example
|
|
143
|
-
# config.default_locale = "es"
|
|
144
|
-
#
|
|
145
|
-
# @rbs @locale: String
|
|
146
|
-
attr_accessor :default_locale
|
|
147
|
-
|
|
148
|
-
# Initializes a new Configuration instance with default values.
|
|
149
|
-
#
|
|
150
|
-
# Creates new registry instances for middlewares, callbacks, coercions, and
|
|
151
|
-
# validators. Sets default breakpoints and configures a basic logger.
|
|
152
|
-
#
|
|
153
|
-
# @return [Configuration] a new Configuration instance
|
|
154
|
-
#
|
|
155
|
-
# @example
|
|
156
|
-
# config = Configuration.new
|
|
157
|
-
# config.middlewares.class # => MiddlewareRegistry
|
|
158
|
-
# config.task_breakpoints # => ["failed"]
|
|
159
|
-
#
|
|
160
|
-
# @rbs () -> void
|
|
161
17
|
def initialize
|
|
162
|
-
@middlewares =
|
|
163
|
-
@callbacks
|
|
164
|
-
@coercions
|
|
165
|
-
@validators
|
|
166
|
-
|
|
167
|
-
@
|
|
168
|
-
@
|
|
169
|
-
@
|
|
170
|
-
@
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
@
|
|
18
|
+
@middlewares = Middlewares.new
|
|
19
|
+
@callbacks = Callbacks.new
|
|
20
|
+
@coercions = Coercions.new
|
|
21
|
+
@validators = Validators.new
|
|
22
|
+
@executors = Executors.new
|
|
23
|
+
@mergers = Mergers.new
|
|
24
|
+
@retriers = Retriers.new
|
|
25
|
+
@deprecators = Deprecators.new
|
|
26
|
+
@telemetry = Telemetry.new
|
|
27
|
+
|
|
28
|
+
@correlation_id = nil
|
|
29
|
+
@default_locale = "en"
|
|
30
|
+
@strict_context = false
|
|
174
31
|
@backtrace_cleaner = nil
|
|
175
|
-
@
|
|
32
|
+
@log_exclusions = EMPTY_ARRAY
|
|
33
|
+
@log_formatter = nil
|
|
34
|
+
@log_level = nil
|
|
176
35
|
|
|
177
36
|
@logger = Logger.new(
|
|
178
37
|
$stdout,
|
|
@@ -182,68 +41,22 @@ module CMDx
|
|
|
182
41
|
)
|
|
183
42
|
end
|
|
184
43
|
|
|
185
|
-
# Converts the configuration to a hash representation.
|
|
186
|
-
#
|
|
187
|
-
# @return [Hash{Symbol => Object}] hash containing all configuration values
|
|
188
|
-
#
|
|
189
|
-
# @example
|
|
190
|
-
# config = Configuration.new
|
|
191
|
-
# config.to_h
|
|
192
|
-
# # => { middlewares: #<MiddlewareRegistry>, callbacks: #<CallbackRegistry>, ... }
|
|
193
|
-
#
|
|
194
|
-
# @rbs () -> Hash[Symbol, untyped]
|
|
195
|
-
def to_h
|
|
196
|
-
{
|
|
197
|
-
middlewares: @middlewares,
|
|
198
|
-
callbacks: @callbacks,
|
|
199
|
-
coercions: @coercions,
|
|
200
|
-
validators: @validators,
|
|
201
|
-
task_breakpoints: @task_breakpoints,
|
|
202
|
-
workflow_breakpoints: @workflow_breakpoints,
|
|
203
|
-
rollback_on: @rollback_on,
|
|
204
|
-
freeze_results: @freeze_results,
|
|
205
|
-
default_locale: @default_locale,
|
|
206
|
-
backtrace: @backtrace,
|
|
207
|
-
backtrace_cleaner: @backtrace_cleaner,
|
|
208
|
-
exception_handler: @exception_handler,
|
|
209
|
-
logger: @logger
|
|
210
|
-
}
|
|
211
|
-
end
|
|
212
|
-
|
|
213
44
|
end
|
|
214
45
|
|
|
215
46
|
extend self
|
|
216
47
|
|
|
217
|
-
#
|
|
218
|
-
#
|
|
219
|
-
# @return [Configuration] the global configuration instance
|
|
220
|
-
#
|
|
221
|
-
# @example
|
|
222
|
-
# config = CMDx.configuration
|
|
223
|
-
# config.middlewares # => #<MiddlewareRegistry>
|
|
224
|
-
#
|
|
225
|
-
# @rbs () -> Configuration
|
|
48
|
+
# @return [Configuration] the lazily-initialized global configuration
|
|
226
49
|
def configuration
|
|
227
50
|
return @configuration if @configuration
|
|
228
51
|
|
|
229
52
|
@configuration ||= Configuration.new
|
|
230
53
|
end
|
|
231
54
|
|
|
232
|
-
#
|
|
55
|
+
# Yields the global configuration for mutation.
|
|
233
56
|
#
|
|
234
|
-
# @yield [Configuration]
|
|
235
|
-
#
|
|
236
|
-
# @
|
|
237
|
-
#
|
|
238
|
-
# @raise [ArgumentError] when no block is provided
|
|
239
|
-
#
|
|
240
|
-
# @example
|
|
241
|
-
# CMDx.configure do |config|
|
|
242
|
-
# config.task_breakpoints = ["failed", "skipped"]
|
|
243
|
-
# config.logger.level = Logger::DEBUG
|
|
244
|
-
# end
|
|
245
|
-
#
|
|
246
|
-
# @rbs () { (Configuration) -> void } -> Configuration
|
|
57
|
+
# @yield [Configuration]
|
|
58
|
+
# @return [Configuration]
|
|
59
|
+
# @raise [ArgumentError] when no block is given
|
|
247
60
|
def configure
|
|
248
61
|
raise ArgumentError, "block required" unless block_given?
|
|
249
62
|
|
|
@@ -252,17 +65,24 @@ module CMDx
|
|
|
252
65
|
config
|
|
253
66
|
end
|
|
254
67
|
|
|
255
|
-
#
|
|
256
|
-
#
|
|
257
|
-
#
|
|
258
|
-
#
|
|
259
|
-
# @example
|
|
260
|
-
# CMDx.reset_configuration!
|
|
261
|
-
# # Configuration is now reset to defaults
|
|
68
|
+
# Replaces the global configuration with a fresh instance and invalidates
|
|
69
|
+
# the cached registries on `Task` so new lookups rebuild from the new config.
|
|
70
|
+
# Intended for test setup/teardown.
|
|
262
71
|
#
|
|
263
|
-
# @
|
|
72
|
+
# @return [void]
|
|
264
73
|
def reset_configuration!
|
|
265
74
|
@configuration = Configuration.new
|
|
75
|
+
return unless defined?(Task)
|
|
76
|
+
|
|
77
|
+
Task.instance_variable_set(:@middlewares, nil)
|
|
78
|
+
Task.instance_variable_set(:@callbacks, nil)
|
|
79
|
+
Task.instance_variable_set(:@coercions, nil)
|
|
80
|
+
Task.instance_variable_set(:@validators, nil)
|
|
81
|
+
Task.instance_variable_set(:@executors, nil)
|
|
82
|
+
Task.instance_variable_set(:@mergers, nil)
|
|
83
|
+
Task.instance_variable_set(:@retriers, nil)
|
|
84
|
+
Task.instance_variable_set(:@deprecators, nil)
|
|
85
|
+
Task.instance_variable_set(:@telemetry, nil)
|
|
266
86
|
end
|
|
267
87
|
|
|
268
88
|
end
|