servactory 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +87 -50
- data/config/locales/en.yml +5 -5
- data/lib/servactory/base.rb +4 -4
- data/lib/servactory/configuration/factory.rb +6 -6
- data/lib/servactory/configuration/setup.rb +6 -6
- data/lib/servactory/context/callable.rb +21 -22
- data/lib/servactory/context/configuration.rb +6 -6
- data/lib/servactory/context/workspace/inputs.rb +13 -0
- data/lib/servactory/context/workspace.rb +9 -7
- data/lib/servactory/errors/base.rb +2 -1
- data/lib/servactory/errors/collection.rb +25 -0
- data/lib/servactory/errors/failure.rb +11 -1
- data/lib/servactory/errors/input_error.rb +17 -0
- data/lib/servactory/errors/internal_error.rb +15 -0
- data/lib/servactory/errors/output_error.rb +15 -0
- data/lib/servactory/{input_arguments → inputs}/checks/base.rb +3 -3
- data/lib/servactory/{input_arguments → inputs}/checks/errors.rb +1 -1
- data/lib/servactory/{input_arguments → inputs}/checks/inclusion.rb +7 -4
- data/lib/servactory/{input_arguments → inputs}/checks/must.rb +3 -3
- data/lib/servactory/{input_arguments → inputs}/checks/required.rb +2 -2
- data/lib/servactory/{input_arguments → inputs}/checks/type.rb +3 -3
- data/lib/servactory/{input_arguments → inputs}/collection.rb +1 -1
- data/lib/servactory/{input_arguments → inputs}/define_input_conflict.rb +1 -1
- data/lib/servactory/{input_arguments → inputs}/define_input_method.rb +1 -1
- data/lib/servactory/inputs/dsl.rb +36 -0
- data/lib/servactory/{input_arguments/input_argument.rb → inputs/input.rb} +13 -12
- data/lib/servactory/{input_arguments → inputs}/option.rb +5 -3
- data/lib/servactory/{input_arguments → inputs}/options_collection.rb +1 -1
- data/lib/servactory/{input_arguments → inputs}/tools/check.rb +5 -5
- data/lib/servactory/{input_arguments → inputs}/tools/check_errors.rb +1 -1
- data/lib/servactory/{input_arguments → inputs}/tools/find_unnecessary.rb +6 -6
- data/lib/servactory/{input_arguments → inputs}/tools/prepare.rb +5 -5
- data/lib/servactory/inputs/tools/rules.rb +46 -0
- data/lib/servactory/{input_arguments → inputs}/workbench.rb +8 -8
- data/lib/servactory/internals/checks/base.rb +17 -0
- data/lib/servactory/{internal_arguments → internals}/checks/type.rb +8 -8
- data/lib/servactory/{output_arguments → internals}/collection.rb +1 -1
- data/lib/servactory/internals/dsl.rb +33 -0
- data/lib/servactory/{internal_arguments/internal_argument.rb → internals/internal.rb} +2 -2
- data/lib/servactory/internals/tools/prepare.rb +60 -0
- data/lib/servactory/{internal_arguments → internals}/workbench.rb +5 -5
- data/lib/servactory/{make_methods → methods}/collection.rb +1 -1
- data/lib/servactory/methods/dsl.rb +33 -0
- data/lib/servactory/{make_methods/make_method.rb → methods/method.rb} +2 -2
- data/lib/servactory/{make_methods → methods}/workbench.rb +5 -5
- data/lib/servactory/outputs/checks/base.rb +17 -0
- data/lib/servactory/{output_arguments → outputs}/checks/type.rb +8 -8
- data/lib/servactory/{internal_arguments → outputs}/collection.rb +1 -1
- data/lib/servactory/outputs/dsl.rb +33 -0
- data/lib/servactory/{output_arguments/output_argument.rb → outputs/output.rb} +2 -2
- data/lib/servactory/{output_arguments → outputs}/tools/conflicts.rb +7 -7
- data/lib/servactory/outputs/tools/prepare.rb +62 -0
- data/lib/servactory/outputs/workbench.rb +31 -0
- data/lib/servactory/result.rb +4 -4
- data/lib/servactory/utils.rb +2 -0
- data/lib/servactory/version.rb +2 -2
- metadata +59 -46
- data/lib/servactory/context/workspace/error.rb +0 -19
- data/lib/servactory/context/workspace/errors.rb +0 -33
- data/lib/servactory/errors/input_argument_error.rb +0 -7
- data/lib/servactory/errors/internal_argument_error.rb +0 -7
- data/lib/servactory/errors/output_argument_error.rb +0 -7
- data/lib/servactory/input_arguments/dsl.rb +0 -36
- data/lib/servactory/input_arguments/tools/rules.rb +0 -43
- data/lib/servactory/inputs.rb +0 -9
- data/lib/servactory/internal_arguments/checks/base.rb +0 -17
- data/lib/servactory/internal_arguments/dsl.rb +0 -33
- data/lib/servactory/internal_arguments/tools/prepare.rb +0 -60
- data/lib/servactory/make_methods/dsl.rb +0 -33
- data/lib/servactory/output_arguments/checks/base.rb +0 -17
- data/lib/servactory/output_arguments/dsl.rb +0 -33
- data/lib/servactory/output_arguments/tools/prepare.rb +0 -62
- data/lib/servactory/output_arguments/workbench.rb +0 -31
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Servactory
|
4
|
-
module
|
4
|
+
module Internals
|
5
5
|
class Workbench
|
6
6
|
def self.work_with(...)
|
7
7
|
new(...)
|
8
8
|
end
|
9
9
|
|
10
|
-
def initialize(
|
11
|
-
@
|
10
|
+
def initialize(collection_of_internals)
|
11
|
+
@collection_of_internals = collection_of_internals
|
12
12
|
end
|
13
13
|
|
14
14
|
def assign(context:)
|
@@ -16,13 +16,13 @@ module Servactory
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def prepare
|
19
|
-
Tools::Prepare.prepare(context,
|
19
|
+
Tools::Prepare.prepare(context, collection_of_internals)
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
24
|
attr_reader :context,
|
25
|
-
:
|
25
|
+
:collection_of_internals
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Servactory
|
4
|
+
module Methods
|
5
|
+
module DSL
|
6
|
+
def self.included(base)
|
7
|
+
base.extend(ClassMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def inherited(child)
|
12
|
+
super
|
13
|
+
|
14
|
+
child.send(:collection_of_methods).merge(collection_of_methods)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def make(name, **options)
|
20
|
+
collection_of_methods << Method.new(name, **options)
|
21
|
+
end
|
22
|
+
|
23
|
+
def collection_of_methods
|
24
|
+
@collection_of_methods ||= Collection.new
|
25
|
+
end
|
26
|
+
|
27
|
+
def methods_workbench
|
28
|
+
@methods_workbench ||= Workbench.work_with(collection_of_methods)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Servactory
|
4
|
-
module
|
4
|
+
module Methods
|
5
5
|
class Workbench
|
6
6
|
def self.work_with(...)
|
7
7
|
new(...)
|
8
8
|
end
|
9
9
|
|
10
|
-
def initialize(
|
11
|
-
@
|
10
|
+
def initialize(collection_of_methods)
|
11
|
+
@collection_of_methods = collection_of_methods
|
12
12
|
end
|
13
13
|
|
14
14
|
def assign(context:)
|
@@ -16,7 +16,7 @@ module Servactory
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def run!
|
19
|
-
|
19
|
+
collection_of_methods.each do |make_method|
|
20
20
|
next if unnecessary_for?(make_method)
|
21
21
|
|
22
22
|
context.send(make_method.name)
|
@@ -26,7 +26,7 @@ module Servactory
|
|
26
26
|
private
|
27
27
|
|
28
28
|
attr_reader :context,
|
29
|
-
:
|
29
|
+
:collection_of_methods
|
30
30
|
|
31
31
|
def unnecessary_for?(make_method)
|
32
32
|
condition = make_method.condition
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Servactory
|
4
|
+
module Outputs
|
5
|
+
module Checks
|
6
|
+
class Base
|
7
|
+
protected
|
8
|
+
|
9
|
+
def raise_error_with(message, **attributes)
|
10
|
+
message = message.call(**attributes) if message.is_a?(Proc)
|
11
|
+
|
12
|
+
raise Servactory.configuration.output_error_class.new(message: message)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Servactory
|
4
|
-
module
|
4
|
+
module Outputs
|
5
5
|
module Checks
|
6
6
|
class Type < Base
|
7
|
-
DEFAULT_MESSAGE = lambda do |service_class_name:,
|
7
|
+
DEFAULT_MESSAGE = lambda do |service_class_name:, output:, expected_type:, given_type:|
|
8
8
|
I18n.t(
|
9
|
-
"servactory.
|
9
|
+
"servactory.outputs.checks.type.default_error",
|
10
10
|
service_class_name: service_class_name,
|
11
|
-
|
11
|
+
output_name: output.name,
|
12
12
|
expected_type: expected_type,
|
13
13
|
given_type: given_type
|
14
14
|
)
|
@@ -22,11 +22,11 @@ module Servactory
|
|
22
22
|
|
23
23
|
##########################################################################
|
24
24
|
|
25
|
-
def initialize(context:,
|
25
|
+
def initialize(context:, output:, value:)
|
26
26
|
super()
|
27
27
|
|
28
28
|
@context = context
|
29
|
-
@
|
29
|
+
@output = output
|
30
30
|
@value = value
|
31
31
|
end
|
32
32
|
|
@@ -36,7 +36,7 @@ module Servactory
|
|
36
36
|
raise_error_with(
|
37
37
|
DEFAULT_MESSAGE,
|
38
38
|
service_class_name: @context.class.name,
|
39
|
-
|
39
|
+
output: @output,
|
40
40
|
expected_type: prepared_types.join(", "),
|
41
41
|
given_type: @value.class.name
|
42
42
|
)
|
@@ -46,7 +46,7 @@ module Servactory
|
|
46
46
|
|
47
47
|
def prepared_types
|
48
48
|
@prepared_types ||=
|
49
|
-
Array(@
|
49
|
+
Array(@output.types).map do |type|
|
50
50
|
if type.is_a?(String)
|
51
51
|
Object.const_get(type)
|
52
52
|
else
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Servactory
|
4
|
+
module Outputs
|
5
|
+
module DSL
|
6
|
+
def self.included(base)
|
7
|
+
base.extend(ClassMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def inherited(child)
|
12
|
+
super
|
13
|
+
|
14
|
+
child.send(:collection_of_outputs).merge(collection_of_outputs)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def output(name, **options)
|
20
|
+
collection_of_outputs << Output.new(name, **options)
|
21
|
+
end
|
22
|
+
|
23
|
+
def collection_of_outputs
|
24
|
+
@collection_of_outputs ||= Collection.new
|
25
|
+
end
|
26
|
+
|
27
|
+
def outputs_workbench
|
28
|
+
@outputs_workbench ||= Workbench.work_with(collection_of_outputs)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,36 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Servactory
|
4
|
-
module
|
4
|
+
module Outputs
|
5
5
|
module Tools
|
6
6
|
class Conflicts
|
7
7
|
def self.check!(...)
|
8
8
|
new(...).check!
|
9
9
|
end
|
10
10
|
|
11
|
-
def initialize(context,
|
11
|
+
def initialize(context, collection_of_outputs, collection_of_internals)
|
12
12
|
@context = context
|
13
|
-
@
|
14
|
-
@
|
13
|
+
@collection_of_outputs = collection_of_outputs
|
14
|
+
@collection_of_internals = collection_of_internals
|
15
15
|
end
|
16
16
|
|
17
17
|
def check!
|
18
18
|
return if overlapping_attributes.empty?
|
19
19
|
|
20
20
|
message_text = I18n.t(
|
21
|
-
"servactory.
|
21
|
+
"servactory.outputs.tools.conflicts.error",
|
22
22
|
service_class_name: @context.class.name,
|
23
23
|
overlapping_attributes: overlapping_attributes.join(", ")
|
24
24
|
)
|
25
25
|
|
26
|
-
raise Servactory.configuration.
|
26
|
+
raise Servactory.configuration.output_error_class.new(message: message_text)
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def overlapping_attributes
|
32
32
|
@overlapping_attributes ||=
|
33
|
-
@
|
33
|
+
@collection_of_outputs.names.intersection(@collection_of_internals.names)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Servactory
|
4
|
+
module Outputs
|
5
|
+
module Tools
|
6
|
+
class Prepare
|
7
|
+
def self.prepare(...)
|
8
|
+
new(...).prepare
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(context, collection_of_outputs)
|
12
|
+
@context = context
|
13
|
+
@collection_of_outputs = collection_of_outputs
|
14
|
+
end
|
15
|
+
|
16
|
+
def prepare
|
17
|
+
@collection_of_outputs.each do |output|
|
18
|
+
create_instance_variable_for(output)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def create_instance_variable_for(output)
|
25
|
+
@context.instance_variable_set(:"@#{output.name}", nil)
|
26
|
+
|
27
|
+
@context.class.class_eval(context_output_template_for(output))
|
28
|
+
end
|
29
|
+
|
30
|
+
# EXAMPLE:
|
31
|
+
#
|
32
|
+
# define_method(:user=) do |value|
|
33
|
+
# Servactory::Internals::Checks::Type.check!( context: self, output:, value: )
|
34
|
+
#
|
35
|
+
# instance_variable_set(:@user, value)
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# private
|
39
|
+
#
|
40
|
+
# attr_reader :user
|
41
|
+
#
|
42
|
+
def context_output_template_for(output)
|
43
|
+
<<-RUBY
|
44
|
+
define_method(:#{output.name}=) do |value|
|
45
|
+
Servactory::Outputs::Checks::Type.check!(
|
46
|
+
context: self,
|
47
|
+
output: output,
|
48
|
+
value: value
|
49
|
+
)
|
50
|
+
|
51
|
+
instance_variable_set(:@#{output.name}, value)
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
attr_reader :#{output.name}
|
57
|
+
RUBY
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Servactory
|
4
|
+
module Outputs
|
5
|
+
class Workbench
|
6
|
+
def self.work_with(...)
|
7
|
+
new(...)
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(collection_of_outputs)
|
11
|
+
@collection_of_outputs = collection_of_outputs
|
12
|
+
end
|
13
|
+
|
14
|
+
def assign(context:)
|
15
|
+
@context = context
|
16
|
+
end
|
17
|
+
|
18
|
+
def find_conflicts_in!(collection_of_internals:)
|
19
|
+
Tools::Conflicts.check!(context, collection_of_outputs, collection_of_internals)
|
20
|
+
end
|
21
|
+
|
22
|
+
def prepare
|
23
|
+
Tools::Prepare.prepare(context, collection_of_outputs)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :context, :collection_of_outputs
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/servactory/result.rb
CHANGED
@@ -8,15 +8,15 @@ module Servactory
|
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
|
-
def prepare_for(context:,
|
12
|
-
prepare_outputs_with(context: context,
|
11
|
+
def prepare_for(context:, collection_of_outputs:)
|
12
|
+
prepare_outputs_with(context: context, collection_of_outputs: collection_of_outputs)
|
13
13
|
prepare_statuses_with(context: context)
|
14
14
|
|
15
15
|
self
|
16
16
|
end
|
17
17
|
|
18
|
-
def prepare_outputs_with(context:,
|
19
|
-
|
18
|
+
def prepare_outputs_with(context:, collection_of_outputs:)
|
19
|
+
collection_of_outputs.each do |output|
|
20
20
|
self.class.attr_reader(:"#{output.name}")
|
21
21
|
|
22
22
|
instance_variable_set(:"@#{output.name}", context.instance_variable_get(:"@#{output.name}"))
|
data/lib/servactory/utils.rb
CHANGED
data/lib/servactory/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: servactory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Sokolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '2.19'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: yard
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0.9'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0.9'
|
167
181
|
description: A set of tools for building reliable services of any complexity
|
168
182
|
email:
|
169
183
|
- profox.rus@gmail.com
|
@@ -184,53 +198,52 @@ files:
|
|
184
198
|
- lib/servactory/context/dsl.rb
|
185
199
|
- lib/servactory/context/store.rb
|
186
200
|
- lib/servactory/context/workspace.rb
|
187
|
-
- lib/servactory/context/workspace/
|
188
|
-
- lib/servactory/context/workspace/errors.rb
|
201
|
+
- lib/servactory/context/workspace/inputs.rb
|
189
202
|
- lib/servactory/engine.rb
|
190
203
|
- lib/servactory/errors/base.rb
|
204
|
+
- lib/servactory/errors/collection.rb
|
191
205
|
- lib/servactory/errors/failure.rb
|
192
|
-
- lib/servactory/errors/
|
193
|
-
- lib/servactory/errors/
|
194
|
-
- lib/servactory/errors/
|
195
|
-
- lib/servactory/
|
196
|
-
- lib/servactory/
|
197
|
-
- lib/servactory/
|
198
|
-
- lib/servactory/
|
199
|
-
- lib/servactory/
|
200
|
-
- lib/servactory/
|
201
|
-
- lib/servactory/
|
202
|
-
- lib/servactory/
|
203
|
-
- lib/servactory/
|
204
|
-
- lib/servactory/
|
205
|
-
- lib/servactory/
|
206
|
-
- lib/servactory/
|
207
|
-
- lib/servactory/
|
208
|
-
- lib/servactory/
|
209
|
-
- lib/servactory/
|
210
|
-
- lib/servactory/
|
211
|
-
- lib/servactory/
|
212
|
-
- lib/servactory/
|
213
|
-
- lib/servactory/
|
214
|
-
- lib/servactory/
|
215
|
-
- lib/servactory/
|
216
|
-
- lib/servactory/
|
217
|
-
- lib/servactory/
|
218
|
-
- lib/servactory/
|
219
|
-
- lib/servactory/
|
220
|
-
- lib/servactory/
|
221
|
-
- lib/servactory/
|
222
|
-
- lib/servactory/
|
223
|
-
- lib/servactory/
|
224
|
-
- lib/servactory/
|
225
|
-
- lib/servactory/
|
226
|
-
- lib/servactory/
|
227
|
-
- lib/servactory/
|
228
|
-
- lib/servactory/
|
229
|
-
- lib/servactory/
|
230
|
-
- lib/servactory/
|
231
|
-
- lib/servactory/
|
232
|
-
- lib/servactory/
|
233
|
-
- lib/servactory/output_arguments/workbench.rb
|
206
|
+
- lib/servactory/errors/input_error.rb
|
207
|
+
- lib/servactory/errors/internal_error.rb
|
208
|
+
- lib/servactory/errors/output_error.rb
|
209
|
+
- lib/servactory/inputs/checks/base.rb
|
210
|
+
- lib/servactory/inputs/checks/errors.rb
|
211
|
+
- lib/servactory/inputs/checks/inclusion.rb
|
212
|
+
- lib/servactory/inputs/checks/must.rb
|
213
|
+
- lib/servactory/inputs/checks/required.rb
|
214
|
+
- lib/servactory/inputs/checks/type.rb
|
215
|
+
- lib/servactory/inputs/collection.rb
|
216
|
+
- lib/servactory/inputs/define_input_conflict.rb
|
217
|
+
- lib/servactory/inputs/define_input_method.rb
|
218
|
+
- lib/servactory/inputs/dsl.rb
|
219
|
+
- lib/servactory/inputs/input.rb
|
220
|
+
- lib/servactory/inputs/option.rb
|
221
|
+
- lib/servactory/inputs/options_collection.rb
|
222
|
+
- lib/servactory/inputs/tools/check.rb
|
223
|
+
- lib/servactory/inputs/tools/check_errors.rb
|
224
|
+
- lib/servactory/inputs/tools/find_unnecessary.rb
|
225
|
+
- lib/servactory/inputs/tools/prepare.rb
|
226
|
+
- lib/servactory/inputs/tools/rules.rb
|
227
|
+
- lib/servactory/inputs/workbench.rb
|
228
|
+
- lib/servactory/internals/checks/base.rb
|
229
|
+
- lib/servactory/internals/checks/type.rb
|
230
|
+
- lib/servactory/internals/collection.rb
|
231
|
+
- lib/servactory/internals/dsl.rb
|
232
|
+
- lib/servactory/internals/internal.rb
|
233
|
+
- lib/servactory/internals/tools/prepare.rb
|
234
|
+
- lib/servactory/internals/workbench.rb
|
235
|
+
- lib/servactory/methods/collection.rb
|
236
|
+
- lib/servactory/methods/dsl.rb
|
237
|
+
- lib/servactory/methods/method.rb
|
238
|
+
- lib/servactory/methods/workbench.rb
|
239
|
+
- lib/servactory/outputs/checks/base.rb
|
240
|
+
- lib/servactory/outputs/checks/type.rb
|
241
|
+
- lib/servactory/outputs/collection.rb
|
242
|
+
- lib/servactory/outputs/dsl.rb
|
243
|
+
- lib/servactory/outputs/output.rb
|
244
|
+
- lib/servactory/outputs/tools/conflicts.rb
|
245
|
+
- lib/servactory/outputs/tools/prepare.rb
|
246
|
+
- lib/servactory/outputs/workbench.rb
|
234
247
|
- lib/servactory/result.rb
|
235
248
|
- lib/servactory/utils.rb
|
236
249
|
- lib/servactory/version.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Servactory
|
4
|
-
module Context
|
5
|
-
module Workspace
|
6
|
-
class Error
|
7
|
-
attr_reader :type,
|
8
|
-
:message,
|
9
|
-
:attribute_name
|
10
|
-
|
11
|
-
def initialize(type:, message:, attribute_name: nil)
|
12
|
-
@type = type
|
13
|
-
@message = message
|
14
|
-
@attribute_name = attribute_name
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Servactory
|
4
|
-
module Context
|
5
|
-
module Workspace
|
6
|
-
class Errors
|
7
|
-
# NOTE: http://words.steveklabnik.com/beware-subclassing-ruby-core-classes
|
8
|
-
extend Forwardable
|
9
|
-
def_delegators :@collection, :<<, :to_a, :filter, :reject, :empty?, :first
|
10
|
-
|
11
|
-
def initialize(collection = Set.new)
|
12
|
-
@collection = collection
|
13
|
-
end
|
14
|
-
|
15
|
-
def not_blank
|
16
|
-
Errors.new(reject(&:blank?))
|
17
|
-
end
|
18
|
-
|
19
|
-
def for_fails
|
20
|
-
filtered = filter { |error| error.type == :fail }
|
21
|
-
|
22
|
-
Errors.new(filtered)
|
23
|
-
end
|
24
|
-
|
25
|
-
def for_inputs
|
26
|
-
filtered = filter { |error| error.type == :inputs }
|
27
|
-
|
28
|
-
Errors.new(filtered)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|