servactory 1.8.5 → 1.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -6
- data/config/locales/en.yml +3 -0
- data/lib/servactory/context/workspace/inputs.rb +1 -1
- data/lib/servactory/context/workspace.rb +9 -0
- data/lib/servactory/inputs/input.rb +1 -1
- data/lib/servactory/inputs/validations/inclusion.rb +9 -3
- data/lib/servactory/methods/dsl.rb +8 -0
- data/lib/servactory/methods/stage.rb +2 -1
- data/lib/servactory/methods/tools/runner.rb +6 -7
- data/lib/servactory/outputs/dsl.rb +0 -1
- data/lib/servactory/test_kit/fake_type.rb +1 -1
- data/lib/servactory/version.rb +1 -1
- metadata +2 -4
- data/lib/servactory/outputs/tools/conflicts.rb +0 -38
- data/lib/servactory/outputs/workspace.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1be37829a79065ae8dcecc340fbecb58a1fcd15739221b38cf57474e371f3e5
|
4
|
+
data.tar.gz: beed9c07d4ed8772da258084c320f0f278e5170169971abe4497a3863eb59399
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03a6c5da26c496b0d96a7ae51cbd85e1cc70e318222db1561add7d91fa27f0278c160129735b3e65ac9165eb440a5ec3fe33c4f2390e7e33c95997521c185203
|
7
|
+
data.tar.gz: 73772169c25d6d2eeb45a4032bb47ce0a6f47dad6e05102a2f2512fa33eaf9c13bdcdcc665e84f7e2660c169ba683919921f497708967b2bbd3b5b221a28a7b9
|
data/README.md
CHANGED
@@ -1,9 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<p align="center">
|
2
|
+
<a href="https://servactory.com" target="_blank">
|
3
|
+
<picture>
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/servactory/servactory/main/.github/logo-dark.svg">
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/servactory/servactory/main/.github/logo-light.svg">
|
6
|
+
<img alt="Servactory" src="https://raw.githubusercontent.com/servactory/servactory/main/.github/logo-light.svg" width="350" height="70" style="max-width: 100%;">
|
7
|
+
</picture>
|
8
|
+
</a>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p align="center">
|
12
|
+
A set of tools for building reliable services of any complexity.
|
13
|
+
</p>
|
14
|
+
|
15
|
+
<p align="center">
|
16
|
+
<a href="https://rubygems.org/gems/servactory"><img src="https://img.shields.io/gem/v/servactory?logo=rubygems&logoColor=fff" alt="Gem version"></a>
|
17
|
+
<a href="https://github.com/afuno/servactory/releases"><img src="https://img.shields.io/github/release-date/afuno/servactory" alt="Release Date"></a>
|
18
|
+
</p>
|
7
19
|
|
8
20
|
## Documentation
|
9
21
|
|
data/config/locales/en.yml
CHANGED
@@ -24,7 +24,7 @@ module Servactory
|
|
24
24
|
|
25
25
|
private
|
26
26
|
|
27
|
-
def getter_with(name:, &block) # rubocop:disable Lint/UnusedMethodArgument
|
27
|
+
def getter_with(name:, &block) # rubocop:disable Metrics/MethodLength, Lint/UnusedMethodArgument, Metrics/AbcSize
|
28
28
|
input_name = name.to_s.chomp("?").to_sym
|
29
29
|
input = @collection_of_inputs.find_by(name: input_name)
|
30
30
|
|
@@ -75,6 +75,15 @@ module Servactory
|
|
75
75
|
@collection_of_outputs = collection_of_outputs
|
76
76
|
end
|
77
77
|
|
78
|
+
def call
|
79
|
+
raise Servactory.configuration.failure_class.new(
|
80
|
+
message: I18n.t(
|
81
|
+
"servactory.methods.call.not_used",
|
82
|
+
service_class_name: self.class.name
|
83
|
+
)
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
78
87
|
def service_storage
|
79
88
|
@service_storage ||= { internals: {}, outputs: {} }
|
80
89
|
end
|
@@ -17,13 +17,19 @@ module Servactory
|
|
17
17
|
private_constant :DEFAULT_MESSAGE
|
18
18
|
|
19
19
|
def self.check(context:, input:, value:, check_key:, **)
|
20
|
-
return unless should_be_checked_for?(input, check_key)
|
20
|
+
return unless should_be_checked_for?(input, value, check_key)
|
21
21
|
|
22
22
|
new(context: context, input: input, value: value).check
|
23
23
|
end
|
24
24
|
|
25
|
-
def self.should_be_checked_for?(input, check_key)
|
26
|
-
check_key == :inclusion &&
|
25
|
+
def self.should_be_checked_for?(input, value, check_key)
|
26
|
+
check_key == :inclusion && (
|
27
|
+
input.required? || (
|
28
|
+
input.optional? && !input.default.nil?
|
29
|
+
) || (
|
30
|
+
input.optional? && !value.nil?
|
31
|
+
)
|
32
|
+
)
|
27
33
|
end
|
28
34
|
|
29
35
|
##########################################################################
|
@@ -42,6 +42,14 @@ module Servactory
|
|
42
42
|
def only_if(condition)
|
43
43
|
return if @current_stage.blank?
|
44
44
|
|
45
|
+
@current_stage.is_condition_opposite = false
|
46
|
+
@current_stage.condition = condition
|
47
|
+
end
|
48
|
+
|
49
|
+
def only_unless(condition)
|
50
|
+
return if @current_stage.blank?
|
51
|
+
|
52
|
+
@current_stage.is_condition_opposite = true
|
45
53
|
@current_stage.condition = condition
|
46
54
|
end
|
47
55
|
|
@@ -14,7 +14,7 @@ module Servactory
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def run!
|
17
|
-
return
|
17
|
+
return use_call if @collection_of_stages.empty?
|
18
18
|
|
19
19
|
@collection_of_stages.sorted_by_position.each do |stage|
|
20
20
|
call_stage(stage)
|
@@ -23,8 +23,8 @@ module Servactory
|
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
def
|
27
|
-
@context.
|
26
|
+
def use_call
|
27
|
+
@context.send(:call)
|
28
28
|
end
|
29
29
|
|
30
30
|
def call_stage(stage)
|
@@ -57,12 +57,11 @@ module Servactory
|
|
57
57
|
|
58
58
|
def unnecessary_for_stage?(stage)
|
59
59
|
condition = stage.condition
|
60
|
-
|
60
|
+
is_condition_opposite = stage.is_condition_opposite
|
61
61
|
|
62
|
-
result = prepare_condition_for(condition)
|
62
|
+
result = prepare_condition_for(condition)
|
63
63
|
|
64
|
-
|
65
|
-
result
|
64
|
+
is_condition_opposite ? !result : result
|
66
65
|
end
|
67
66
|
|
68
67
|
def unnecessary_for_make?(make_method)
|
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.8.
|
4
|
+
version: 1.8.7
|
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-
|
11
|
+
date: 2023-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -244,10 +244,8 @@ files:
|
|
244
244
|
- lib/servactory/outputs/collection.rb
|
245
245
|
- lib/servactory/outputs/dsl.rb
|
246
246
|
- lib/servactory/outputs/output.rb
|
247
|
-
- lib/servactory/outputs/tools/conflicts.rb
|
248
247
|
- lib/servactory/outputs/validations/base.rb
|
249
248
|
- lib/servactory/outputs/validations/type.rb
|
250
|
-
- lib/servactory/outputs/workspace.rb
|
251
249
|
- lib/servactory/result.rb
|
252
250
|
- lib/servactory/test_kit/fake_type.rb
|
253
251
|
- lib/servactory/test_kit/result.rb
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Servactory
|
4
|
-
module Outputs
|
5
|
-
module Tools
|
6
|
-
class Conflicts
|
7
|
-
def self.validate!(...)
|
8
|
-
new(...).validate!
|
9
|
-
end
|
10
|
-
|
11
|
-
def initialize(context, collection_of_outputs, collection_of_internals)
|
12
|
-
@context = context
|
13
|
-
@collection_of_outputs = collection_of_outputs
|
14
|
-
@collection_of_internals = collection_of_internals
|
15
|
-
end
|
16
|
-
|
17
|
-
def validate!
|
18
|
-
return if overlapping_attributes.empty?
|
19
|
-
|
20
|
-
message_text = I18n.t(
|
21
|
-
"servactory.outputs.tools.conflicts.error",
|
22
|
-
service_class_name: @context.class.name,
|
23
|
-
overlapping_attributes: overlapping_attributes.join(", ")
|
24
|
-
)
|
25
|
-
|
26
|
-
raise Servactory.configuration.output_error_class.new(message: message_text)
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def overlapping_attributes
|
32
|
-
@overlapping_attributes ||=
|
33
|
-
@collection_of_outputs.names.intersection(@collection_of_internals.names)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Servactory
|
4
|
-
module Outputs
|
5
|
-
module Workspace
|
6
|
-
def call!(collection_of_internals:, collection_of_outputs:, **)
|
7
|
-
super
|
8
|
-
|
9
|
-
Tools::Conflicts.validate!(self, collection_of_outputs, collection_of_internals)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|