servactory 1.6.9 → 1.6.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/servactory/inputs/tools/prepare.rb +0 -4
- data/lib/servactory/internals/tools/prepare.rb +0 -2
- data/lib/servactory/methods/dsl.rb +6 -0
- data/lib/servactory/methods/stage.rb +4 -2
- data/lib/servactory/methods/workbench.rb +14 -2
- data/lib/servactory/outputs/tools/prepare.rb +0 -10
- 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: 2b12f427c8f43d8179f695716ffdc2afc1de1390320ff092b83a70dded92f9a7
|
4
|
+
data.tar.gz: ddd30b3129568ce698291b9cb3a039bd8eec32b200e01cc312d4dab9f8509ec4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92abe4b72caa144a53c54a12d72613277798026a0625695cf1711e725a560befaf67ce4914ef2c6fa675fb27f0a4697360255849c3922803d88457d0134219e9
|
7
|
+
data.tar.gz: 11df004407cbb75c24ad342a508012c3b6bab3034674477fd01d20ccce8c1603712554d09127f01a395b3e658c3464cbd842decb293df9dc41a2a482e42d2da9
|
@@ -78,16 +78,12 @@ module Servactory
|
|
78
78
|
|
79
79
|
# EXAMPLE:
|
80
80
|
#
|
81
|
-
# private
|
82
|
-
#
|
83
81
|
# attr_reader(*[:attr_1])
|
84
82
|
#
|
85
83
|
def context_internal_variables_template
|
86
84
|
return if @internal_variables.blank?
|
87
85
|
|
88
86
|
@context_internal_variables_template ||= <<-RUBY
|
89
|
-
private
|
90
|
-
|
91
87
|
attr_reader(*#{@internal_variables.keys})
|
92
88
|
RUBY
|
93
89
|
end
|
@@ -38,6 +38,12 @@ module Servactory
|
|
38
38
|
@current_stage.rollback = rollback
|
39
39
|
end
|
40
40
|
|
41
|
+
def only_if(condition)
|
42
|
+
return if @current_stage.blank?
|
43
|
+
|
44
|
+
@current_stage.condition = condition
|
45
|
+
end
|
46
|
+
|
41
47
|
def make(name, position: nil, **options)
|
42
48
|
position = position.presence || next_position
|
43
49
|
|
@@ -5,12 +5,14 @@ module Servactory
|
|
5
5
|
class Stage
|
6
6
|
attr_accessor :position,
|
7
7
|
:wrapper,
|
8
|
-
:rollback
|
8
|
+
:rollback,
|
9
|
+
:condition
|
9
10
|
|
10
|
-
def initialize(position:, wrapper: nil, rollback: nil)
|
11
|
+
def initialize(position:, wrapper: nil, rollback: nil, condition: nil)
|
11
12
|
@position = position
|
12
13
|
@wrapper = wrapper
|
13
14
|
@rollback = rollback
|
15
|
+
@condition = condition
|
14
16
|
end
|
15
17
|
|
16
18
|
def next_method_position
|
@@ -33,6 +33,8 @@ module Servactory
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def call_stage(stage)
|
36
|
+
return if unnecessary_for_stage?(stage)
|
37
|
+
|
36
38
|
wrapper = stage.wrapper
|
37
39
|
rollback = stage.rollback
|
38
40
|
methods = stage.methods.sorted_by_position
|
@@ -52,13 +54,23 @@ module Servactory
|
|
52
54
|
|
53
55
|
def call_methods(methods)
|
54
56
|
methods.each do |make_method|
|
55
|
-
next if
|
57
|
+
next if unnecessary_for_make?(make_method)
|
56
58
|
|
57
59
|
context.send(make_method.name)
|
58
60
|
end
|
59
61
|
end
|
60
62
|
|
61
|
-
def
|
63
|
+
def unnecessary_for_stage?(stage)
|
64
|
+
condition = stage.condition
|
65
|
+
# is_condition_opposite = stage.is_condition_opposite
|
66
|
+
|
67
|
+
result = prepare_condition_for(condition) # rubocop:disable Style/RedundantAssignment
|
68
|
+
|
69
|
+
# is_condition_opposite ? !result : result
|
70
|
+
result
|
71
|
+
end
|
72
|
+
|
73
|
+
def unnecessary_for_make?(make_method)
|
62
74
|
condition = make_method.condition
|
63
75
|
is_condition_opposite = make_method.is_condition_opposite
|
64
76
|
|
@@ -22,8 +22,6 @@ module Servactory
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def create_instance_variable_for(output)
|
25
|
-
@context.instance_variable_set(:"@#{output.name}", nil)
|
26
|
-
|
27
25
|
@context.class.class_eval(context_output_template_for(output))
|
28
26
|
end
|
29
27
|
|
@@ -35,10 +33,6 @@ module Servactory
|
|
35
33
|
# instance_variable_set(:@user, value)
|
36
34
|
# end
|
37
35
|
#
|
38
|
-
# private
|
39
|
-
#
|
40
|
-
# attr_reader :user
|
41
|
-
#
|
42
36
|
def context_output_template_for(output)
|
43
37
|
<<-RUBY
|
44
38
|
define_method(:#{output.name}=) do |value|
|
@@ -50,10 +44,6 @@ module Servactory
|
|
50
44
|
|
51
45
|
instance_variable_set(:@#{output.name}, value)
|
52
46
|
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
attr_reader :#{output.name}
|
57
47
|
RUBY
|
58
48
|
end
|
59
49
|
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.6.
|
4
|
+
version: 1.6.11
|
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-06-
|
11
|
+
date: 2023-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|