servactory 1.9.3 → 1.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/servactory/context/workspace/inputs.rb +14 -2
- data/lib/servactory/context/workspace/internals.rb +17 -5
- data/lib/servactory/context/workspace/outputs.rb +17 -5
- data/lib/servactory/context/workspace.rb +10 -10
- data/lib/servactory/inputs/collection.rb +11 -4
- data/lib/servactory/inputs/dsl.rb +1 -1
- data/lib/servactory/inputs/input.rb +4 -4
- data/lib/servactory/inputs/option_helpers_collection.rb +0 -1
- data/lib/servactory/inputs/options_collection.rb +0 -1
- data/lib/servactory/inputs/tools/check_errors.rb +0 -1
- data/lib/servactory/inputs/validations/errors.rb +0 -1
- data/lib/servactory/internals/collection.rb +11 -4
- data/lib/servactory/methods/aliases_for_make/collection.rb +0 -1
- data/lib/servactory/methods/method_collection.rb +0 -1
- data/lib/servactory/methods/shortcuts_for_make/collection.rb +0 -1
- data/lib/servactory/methods/stage_collection.rb +0 -1
- data/lib/servactory/methods/tools/runner.rb +1 -1
- data/lib/servactory/outputs/collection.rb +11 -4
- data/lib/servactory/result.rb +1 -1
- data/lib/servactory/test_kit/result.rb +3 -3
- data/lib/servactory/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 160e4621b678dca239c604c460984aa15cbc79ffceac023357097560a06b51bd
|
4
|
+
data.tar.gz: 3dcb288a82252259d88ec0ce2f54f6c35ad9c74237acc0f6f61fa6c10794df39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20ced1c8f1d44e0e95ed8860f2e02e55c36a7c52148929ba6d726de4f7667503cb55b57e9e13e110247a8ae7a19673d01526196e2e21891a6bbff6fb4e7807c3
|
7
|
+
data.tar.gz: 1852aa185591e50ccff9c46be4384b4e91fc7ace9c2ecb7e526bfaa4025aec8a9030484d6a5297a3957333b20a8e484e5b23e86b7a3c9c148d1c4f9952656f5e
|
@@ -10,10 +10,22 @@ module Servactory
|
|
10
10
|
@collection_of_inputs = collection_of_inputs
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def only(*names)
|
14
|
+
@collection_of_inputs
|
15
|
+
.only(*names)
|
16
|
+
.to_h { |input| [input.internal_name, send(input.internal_name)] }
|
17
|
+
end
|
18
|
+
|
19
|
+
def except(*names)
|
20
|
+
@collection_of_inputs
|
21
|
+
.except(*names)
|
22
|
+
.to_h { |input| [input.internal_name, send(input.internal_name)] }
|
23
|
+
end
|
15
24
|
|
25
|
+
def method_missing(name, *_args)
|
16
26
|
if name.to_s.end_with?("=")
|
27
|
+
prepared_name = name.to_s.delete("=").to_sym
|
28
|
+
|
17
29
|
raise_error_for(:setter, prepared_name)
|
18
30
|
else
|
19
31
|
getter_with(name: name) { raise_error_for(:getter, name) }
|
@@ -9,13 +9,25 @@ module Servactory
|
|
9
9
|
@collection_of_internals = collection_of_internals
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
|
12
|
+
def only(*names)
|
13
|
+
@collection_of_internals
|
14
|
+
.only(*names)
|
15
|
+
.to_h { |internal| [internal.name, send(internal.name)] }
|
16
|
+
end
|
17
|
+
|
18
|
+
def except(*names)
|
19
|
+
@collection_of_internals
|
20
|
+
.except(*names)
|
21
|
+
.to_h { |internal| [internal.name, send(internal.name)] }
|
22
|
+
end
|
14
23
|
|
24
|
+
def method_missing(name, *args)
|
15
25
|
if name.to_s.end_with?("=")
|
26
|
+
prepared_name = name.to_s.delete("=").to_sym
|
27
|
+
|
16
28
|
setter_with(prepared_name: prepared_name, value: args.pop) { raise_error_for(:setter, prepared_name) }
|
17
29
|
else
|
18
|
-
getter_with(name: name) { raise_error_for(:getter,
|
30
|
+
getter_with(name: name) { raise_error_for(:getter, name) }
|
19
31
|
end
|
20
32
|
end
|
21
33
|
|
@@ -38,7 +50,7 @@ module Servactory
|
|
38
50
|
value: value
|
39
51
|
)
|
40
52
|
|
41
|
-
@context.send(:
|
53
|
+
@context.send(:assign_servactory_service_storage_internal, internal.name, value)
|
42
54
|
end
|
43
55
|
|
44
56
|
def getter_with(name:, &block) # rubocop:disable Lint/UnusedMethodArgument
|
@@ -47,7 +59,7 @@ module Servactory
|
|
47
59
|
|
48
60
|
return yield if internal.nil?
|
49
61
|
|
50
|
-
internal_value = @context.send(:
|
62
|
+
internal_value = @context.send(:fetch_servactory_service_storage_internal, internal.name)
|
51
63
|
|
52
64
|
if name.to_s.end_with?("?")
|
53
65
|
Servactory::Utils.query_attribute(internal_value)
|
@@ -9,13 +9,25 @@ module Servactory
|
|
9
9
|
@collection_of_outputs = collection_of_outputs
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
|
12
|
+
def only(*names)
|
13
|
+
@collection_of_outputs
|
14
|
+
.only(*names)
|
15
|
+
.to_h { |output| [output.name, send(output.name)] }
|
16
|
+
end
|
17
|
+
|
18
|
+
def except(*names)
|
19
|
+
@collection_of_outputs
|
20
|
+
.except(*names)
|
21
|
+
.to_h { |output| [output.name, send(output.name)] }
|
22
|
+
end
|
14
23
|
|
24
|
+
def method_missing(name, *args)
|
15
25
|
if name.to_s.end_with?("=")
|
26
|
+
prepared_name = name.to_s.delete("=").to_sym
|
27
|
+
|
16
28
|
setter_with(prepared_name: prepared_name, value: args.pop) { raise_error_for(:setter, prepared_name) }
|
17
29
|
else
|
18
|
-
getter_with(name: name) { raise_error_for(:getter,
|
30
|
+
getter_with(name: name) { raise_error_for(:getter, name) }
|
19
31
|
end
|
20
32
|
end
|
21
33
|
|
@@ -38,7 +50,7 @@ module Servactory
|
|
38
50
|
value: value
|
39
51
|
)
|
40
52
|
|
41
|
-
@context.send(:
|
53
|
+
@context.send(:assign_servactory_service_storage_output, output.name, value)
|
42
54
|
end
|
43
55
|
|
44
56
|
def getter_with(name:, &block) # rubocop:disable Lint/UnusedMethodArgument
|
@@ -47,7 +59,7 @@ module Servactory
|
|
47
59
|
|
48
60
|
return yield if output.nil?
|
49
61
|
|
50
|
-
output_value = @context.send(:
|
62
|
+
output_value = @context.send(:fetch_servactory_service_storage_output, output.name)
|
51
63
|
|
52
64
|
if name.to_s.end_with?("?")
|
53
65
|
Servactory::Utils.query_attribute(output_value)
|
@@ -84,24 +84,24 @@ module Servactory
|
|
84
84
|
)
|
85
85
|
end
|
86
86
|
|
87
|
-
def
|
88
|
-
@
|
87
|
+
def servactory_service_storage
|
88
|
+
@servactory_service_storage ||= { internals: {}, outputs: {} }
|
89
89
|
end
|
90
90
|
|
91
|
-
def
|
92
|
-
|
91
|
+
def assign_servactory_service_storage_internal(key, value)
|
92
|
+
servactory_service_storage[:internals].merge!({ key => value })
|
93
93
|
end
|
94
94
|
|
95
|
-
def
|
96
|
-
|
95
|
+
def fetch_servactory_service_storage_internal(key)
|
96
|
+
servactory_service_storage.fetch(:internals).fetch(key, nil)
|
97
97
|
end
|
98
98
|
|
99
|
-
def
|
100
|
-
|
99
|
+
def assign_servactory_service_storage_output(key, value)
|
100
|
+
servactory_service_storage[:outputs].merge!({ key => value })
|
101
101
|
end
|
102
102
|
|
103
|
-
def
|
104
|
-
|
103
|
+
def fetch_servactory_service_storage_output(key)
|
104
|
+
servactory_service_storage.fetch(:outputs).fetch(key, nil)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
@@ -3,12 +3,19 @@
|
|
3
3
|
module Servactory
|
4
4
|
module Inputs
|
5
5
|
class Collection
|
6
|
-
# NOTE: http://words.steveklabnik.com/beware-subclassing-ruby-core-classes
|
7
6
|
extend Forwardable
|
8
|
-
def_delegators :@collection, :<<, :each, :map, :merge, :find
|
7
|
+
def_delegators :@collection, :<<, :filter, :each, :map, :to_h, :merge, :find
|
9
8
|
|
10
|
-
def initialize(
|
11
|
-
@collection =
|
9
|
+
def initialize(collection = Set.new)
|
10
|
+
@collection = collection
|
11
|
+
end
|
12
|
+
|
13
|
+
def only(*names)
|
14
|
+
Collection.new(filter { |input| names.include?(input.internal_name) })
|
15
|
+
end
|
16
|
+
|
17
|
+
def except(*names)
|
18
|
+
Collection.new(filter { |input| !names.include?(input.internal_name) })
|
12
19
|
end
|
13
20
|
|
14
21
|
def names
|
@@ -9,7 +9,7 @@ module Servactory
|
|
9
9
|
|
10
10
|
attr_reader :name,
|
11
11
|
:internal_name,
|
12
|
-
:
|
12
|
+
:option_helpers
|
13
13
|
|
14
14
|
# rubocop:disable Style/KeywordParametersOrder
|
15
15
|
def initialize(
|
@@ -17,12 +17,12 @@ module Servactory
|
|
17
17
|
*helpers,
|
18
18
|
as: nil,
|
19
19
|
type:,
|
20
|
-
|
20
|
+
option_helpers:,
|
21
21
|
**options
|
22
22
|
)
|
23
23
|
@name = name
|
24
24
|
@internal_name = as.present? ? as : name
|
25
|
-
@
|
25
|
+
@option_helpers = option_helpers
|
26
26
|
|
27
27
|
options = apply_helpers_for_options(helpers: helpers, options: options) if helpers.present?
|
28
28
|
|
@@ -46,7 +46,7 @@ module Servactory
|
|
46
46
|
prepared_options = {}
|
47
47
|
|
48
48
|
helpers.each do |helper|
|
49
|
-
found_helper =
|
49
|
+
found_helper = option_helpers.find_by(name: helper)
|
50
50
|
|
51
51
|
next if found_helper.blank?
|
52
52
|
|
@@ -3,12 +3,19 @@
|
|
3
3
|
module Servactory
|
4
4
|
module Internals
|
5
5
|
class Collection
|
6
|
-
# NOTE: http://words.steveklabnik.com/beware-subclassing-ruby-core-classes
|
7
6
|
extend Forwardable
|
8
|
-
def_delegators :@collection, :<<, :each, :map, :merge, :find
|
7
|
+
def_delegators :@collection, :<<, :filter, :each, :map, :to_h, :merge, :find
|
9
8
|
|
10
|
-
def initialize(
|
11
|
-
@collection =
|
9
|
+
def initialize(collection = Set.new)
|
10
|
+
@collection = collection
|
11
|
+
end
|
12
|
+
|
13
|
+
def only(*names)
|
14
|
+
Collection.new(filter { |internal| names.include?(internal.name) })
|
15
|
+
end
|
16
|
+
|
17
|
+
def except(*names)
|
18
|
+
Collection.new(filter { |internal| !names.include?(internal.name) })
|
12
19
|
end
|
13
20
|
|
14
21
|
def names
|
@@ -42,7 +42,7 @@ module Servactory
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def call_wrapper_with_methods(wrapper, rollback, methods)
|
45
|
-
wrapper.call(methods: -> { call_methods(methods) })
|
45
|
+
wrapper.call(methods: -> { call_methods(methods) }, context: @context)
|
46
46
|
rescue StandardError => e
|
47
47
|
@context.send(rollback, e) if rollback.present?
|
48
48
|
end
|
@@ -3,12 +3,19 @@
|
|
3
3
|
module Servactory
|
4
4
|
module Outputs
|
5
5
|
class Collection
|
6
|
-
# NOTE: http://words.steveklabnik.com/beware-subclassing-ruby-core-classes
|
7
6
|
extend Forwardable
|
8
|
-
def_delegators :@collection, :<<, :each, :map, :merge, :find
|
7
|
+
def_delegators :@collection, :<<, :filter, :each, :map, :to_h, :merge, :find
|
9
8
|
|
10
|
-
def initialize(
|
11
|
-
@collection =
|
9
|
+
def initialize(collection = Set.new)
|
10
|
+
@collection = collection
|
11
|
+
end
|
12
|
+
|
13
|
+
def only(*names)
|
14
|
+
Collection.new(filter { |internal| names.include?(internal.name) })
|
15
|
+
end
|
16
|
+
|
17
|
+
def except(*names)
|
18
|
+
Collection.new(filter { |internal| !names.include?(internal.name) })
|
12
19
|
end
|
13
20
|
|
14
21
|
def names
|
data/lib/servactory/result.rb
CHANGED
@@ -25,7 +25,7 @@ module Servactory
|
|
25
25
|
define_singleton_method(:success?) { true }
|
26
26
|
define_singleton_method(:failure?) { false }
|
27
27
|
|
28
|
-
@context.send(:
|
28
|
+
@context.send(:servactory_service_storage).fetch(:outputs).each_pair do |key, value|
|
29
29
|
define_singleton_method(:"#{key}?") { Servactory::Utils.query_attribute(value) }
|
30
30
|
define_singleton_method(key) { value }
|
31
31
|
end
|
@@ -13,7 +13,7 @@ module Servactory
|
|
13
13
|
|
14
14
|
def initialize(attributes = {})
|
15
15
|
attributes.each_pair do |name, value|
|
16
|
-
|
16
|
+
servactory_service_storage[:outputs].merge!({ name => value })
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -21,8 +21,8 @@ module Servactory
|
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
-
def
|
25
|
-
@
|
24
|
+
def servactory_service_storage
|
25
|
+
@servactory_service_storage ||= { outputs: {} }
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
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.9.
|
4
|
+
version: 1.9.5
|
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-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|