power_stencil 0.4.20 → 0.4.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/builds.md +6 -18
- data/doc/entities.md +3 -9
- data/lib/power_stencil/command_processors/entity_helper.rb +6 -5
- data/lib/power_stencil/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9f2fd5c456d432325027c834c89091d95e9010d
|
4
|
+
data.tar.gz: 168702ae58d531eea9ae233dfabd1e65b5b66c3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 539b17316440f605b8a9771f67ad6c8bd8cfc631cf6e2c262b9a617165fc0b7db408974f46fd301375e76160bd559ef77a72dc411dd3d1297fd671c4bc96f1a1
|
7
|
+
data.tar.gz: d44a86392462feefda32b5d1dd19c45c402aff8056dd937540856f5084c0a5e364b7cf8ed59513b34f13cbb85e0fc870e7f08a67cace890a733b403dd1d58f84
|
data/doc/builds.md
CHANGED
@@ -68,9 +68,7 @@ And define its content as:
|
|
68
68
|
--- !ruby/object:PowerStencil::SystemEntityDefinitions::ProjectEntity
|
69
69
|
:name: inherited_entity
|
70
70
|
:a_specific_property: This one only exists in inherited entity
|
71
|
-
:extends: !
|
72
|
-
type: :base_entity
|
73
|
-
name: root_entity
|
71
|
+
:extends: !entity base_entity/root_entity
|
74
72
|
:array_root:
|
75
73
|
- value from inherited_entity
|
76
74
|
:hash_root:
|
@@ -97,9 +95,7 @@ This is what you get:
|
|
97
95
|
item1: value 1
|
98
96
|
item2: value2 but from inherited
|
99
97
|
item3: value3
|
100
|
-
:extends: !
|
101
|
-
type: :base_entity
|
102
|
-
name: root_entity
|
98
|
+
:extends: !entity base_entity/root_entity
|
103
99
|
```
|
104
100
|
|
105
101
|
You can notice that this second object looks now like a merged entity. Here are the rules of the merge:
|
@@ -127,9 +123,7 @@ And define its content:
|
|
127
123
|
```yaml
|
128
124
|
--- !ruby/object:UniverseCompiler::Entity::Override
|
129
125
|
:overrides:
|
130
|
-
- !
|
131
|
-
type: :base_entity
|
132
|
-
name: inherited_entity
|
126
|
+
- !entity base_entity/inherited_entity
|
133
127
|
:name: test_override
|
134
128
|
:property_from_overide: foo
|
135
129
|
:scenario: dev_tests
|
@@ -161,9 +155,7 @@ As expected, without specifying a build scenario nothing changes
|
|
161
155
|
item2: value2 but from inherited
|
162
156
|
item3: value3
|
163
157
|
:a_specific_property: This one only exists in inherited entity
|
164
|
-
:extends: !
|
165
|
-
type: :base_entity
|
166
|
-
name: root_entity
|
158
|
+
:extends: !entity base_entity/root_entity
|
167
159
|
```
|
168
160
|
But if you specify the dev_tests scenario:
|
169
161
|
|
@@ -179,9 +171,7 @@ But if you specify the dev_tests scenario:
|
|
179
171
|
item2: value2 but from inherited
|
180
172
|
item3: overridden value
|
181
173
|
:a_specific_property: This one only exists in inherited entity
|
182
|
-
:extends: !
|
183
|
-
type: :base_entity
|
184
|
-
name: root_entity
|
174
|
+
:extends: !entity base_entity/root_entity
|
185
175
|
:property_from_overide: foo
|
186
176
|
```
|
187
177
|
|
@@ -230,9 +220,7 @@ PowerStencil::SystemEntityDefinitions::SimpleExec:
|
|
230
220
|
:type: :simple_exec
|
231
221
|
:fields:
|
232
222
|
:name: example
|
233
|
-
:post_process: !
|
234
|
-
type: :process_descriptor
|
235
|
-
name: simple_exec_example.process
|
223
|
+
:post_process: !entity process_descriptor/simple_exec_example.process
|
236
224
|
|
237
225
|
---
|
238
226
|
PowerStencil::SystemEntityDefinitions::ProcessDescriptor:
|
data/doc/entities.md
CHANGED
@@ -850,9 +850,7 @@ Which translates at persistence level as:
|
|
850
850
|
$ power_stencil get custom_entity/test_entity --raw
|
851
851
|
--- !ruby/object:MyCustomEntity
|
852
852
|
:name: test_entity
|
853
|
-
:parent: !
|
854
|
-
type: :custom_entity
|
855
|
-
name: foo
|
853
|
+
:parent: !entity custom_entity/foo
|
856
854
|
```
|
857
855
|
Here we are referencing an entity of the same type, but of course you can reference any type of entity. Using `has_one` will enforce the type of data you reference. Let's try to mess-up:
|
858
856
|
|
@@ -914,12 +912,8 @@ Which translates at persistence level as:
|
|
914
912
|
```shell
|
915
913
|
--- !ruby/object:MyCustomEntity
|
916
914
|
:sub_properties:
|
917
|
-
- !
|
918
|
-
|
919
|
-
name: prop1
|
920
|
-
- !psref
|
921
|
-
type: :base_entity
|
922
|
-
name: prop2
|
915
|
+
- !entity base_entity/prop1
|
916
|
+
- !entity base_entity/prop2
|
923
917
|
:name: test_entity
|
924
918
|
```
|
925
919
|
Nice !
|
@@ -62,19 +62,20 @@ module PowerStencil
|
|
62
62
|
else
|
63
63
|
# Display entity including data coming from reverse methods
|
64
64
|
h = entity.to_hash
|
65
|
-
entity.class.fields_constraints.each do |
|
65
|
+
entity.class.fields_constraints.each do |_, constraints|
|
66
66
|
next unless constraints[:reverse_method]
|
67
67
|
|
68
68
|
reverse_method_conf = constraints[:reverse_method]
|
69
69
|
val = entity.send(reverse_method_conf[:actual_method])
|
70
|
-
node = h[entity.class.name][:dynamic_data] ||= {}
|
71
70
|
next if val.nil?
|
72
71
|
next if val.is_a? Array and val.empty?
|
73
72
|
|
74
|
-
node[
|
75
|
-
|
73
|
+
node = h[entity.class.name][:dynamic_data] ||= {}
|
74
|
+
node[reverse_method_conf[:actual_method]] = case val
|
75
|
+
when Array
|
76
|
+
val.map &:to_reference
|
76
77
|
else
|
77
|
-
val.
|
78
|
+
val.to_reference
|
78
79
|
end
|
79
80
|
end
|
80
81
|
puts h.to_yaml
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: power_stencil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent Briais
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -261,7 +261,7 @@ metadata:
|
|
261
261
|
documentation_uri: https://gitlab.com/tools4devops/power_stencil/blob/master/README.md
|
262
262
|
source_code_uri: https://gitlab.com/tools4devops/power_stencil
|
263
263
|
homepage_uri: https://powerstencil.brizone.org/
|
264
|
-
post_install_message: "\nThank you for installing PowerStencil 0.4.
|
264
|
+
post_install_message: "\nThank you for installing PowerStencil 0.4.21 !\nFrom the
|
265
265
|
command line you can run `power_stencil --help`\nIf your shell is not completing
|
266
266
|
the command:\n If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nOfficial
|
267
267
|
Website : https://powerstencil.brizone.org/\nFull documentation here :
|