power_stencil 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/plugins.md +10 -5
- data/etc/meta_templates/plugin_seed/etc/plugin_capabilities.yaml +2 -1
- data/etc/templates/plugin_definition/etc/plugin_capabilities.yaml +2 -1
- data/lib/power_stencil/engine/project_engine.rb +11 -4
- data/lib/power_stencil/plugins/base.rb +1 -0
- data/lib/power_stencil/plugins/dsl.rb +24 -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: cc9ed77abcf4685805caa1819d0692724a94dbc4
|
4
|
+
data.tar.gz: f40cf20d9083d1c83f75167750be7986f79353ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0484e39c8be5b21407f7223536a8f9295b484414d413e904cee70c0580ac2b716875eaa9cd2ffa8ddca8a3db17b421ff2f1b7ac0f7fae0672c71826f11d29339
|
7
|
+
data.tar.gz: ad786d9773577cf4a9f90e724b06eb5ba8b4687b7fa2f0dc52acdcce18f8913006b30d407aa05ccb06ec7fc65f4c8e5cabe51c29756951e71367bb4e28dd72ab
|
data/doc/plugins.md
CHANGED
@@ -97,7 +97,7 @@ If you do a `power_stencil info` you see a new part appeared in the report
|
|
97
97
|
- command_line: true
|
98
98
|
- processors: true
|
99
99
|
- build: true
|
100
|
-
- dsl:
|
100
|
+
- dsl: true
|
101
101
|
- entity_definitions: true
|
102
102
|
- templates: true
|
103
103
|
```
|
@@ -123,7 +123,7 @@ Or with the capabilities information:
|
|
123
123
|
command_line: true
|
124
124
|
processors: true
|
125
125
|
build: true
|
126
|
-
dsl:
|
126
|
+
dsl: true
|
127
127
|
entity_definitions: true
|
128
128
|
templates: true
|
129
129
|
```
|
@@ -336,7 +336,8 @@ But this is not mandatory. Actually the only mandatory file for a plugin to be v
|
|
336
336
|
:build: post_build_hook
|
337
337
|
|
338
338
|
# If a dsl module is declared it will be injected in the DSL available in the shell or templates
|
339
|
-
:dsl:
|
339
|
+
:dsl:
|
340
|
+
- Myplugin::Dsl::MypluginDsl
|
340
341
|
|
341
342
|
# These are the files (array) defining entity types. These files should not be already
|
342
343
|
# required by the plugin as they will be required by the framework when needed.
|
@@ -349,7 +350,11 @@ But this is not mandatory. Actually the only mandatory file for a plugin to be v
|
|
349
350
|
- etc/templates
|
350
351
|
```
|
351
352
|
|
352
|
-
As it is quite self-documented, I won't too much elaborate on the meaning of each of the fields.
|
353
|
+
As it is quite self-documented, I won't too much elaborate on the meaning of each of the fields.
|
354
|
+
|
355
|
+
So you see that the plugin generated by the `power_stencil plugin --create` command is actually fully featured, providing all possible extras, in order to demonstrate the possibilities as well as ease your job, as you just have to fill the blanks or remove things you don't wan't.create
|
356
|
+
|
357
|
+
But a plugin could also actually provide ... nothing.
|
353
358
|
|
354
359
|
Let's create a plugin fully manually instead of using the `power_stencil plugin --create`. From the root of the project, let's create the directory:
|
355
360
|
|
@@ -375,7 +380,7 @@ Bam ! We just created a more than useless yet valid plugin ! You can check that
|
|
375
380
|
- command_line: false
|
376
381
|
- processors: false
|
377
382
|
- build: false
|
378
|
-
- dsl:
|
383
|
+
- dsl: true
|
379
384
|
- entity_definitions: false
|
380
385
|
- templates: false
|
381
386
|
```
|
@@ -19,7 +19,8 @@
|
|
19
19
|
:build: post_build_hook
|
20
20
|
|
21
21
|
# If a dsl module is declared it will be injected in the DSL available in the shell or templates
|
22
|
-
:dsl:
|
22
|
+
:dsl:
|
23
|
+
- <%= plugin_module_name %>::Dsl::<%= plugin_module_name %>Dsl
|
23
24
|
|
24
25
|
# These are the files (array) defining entity types. These files should not be already
|
25
26
|
# required by the plugin as they will be required by the framework when needed.
|
@@ -19,7 +19,8 @@
|
|
19
19
|
:build: post_build_hook
|
20
20
|
|
21
21
|
# If a dsl module is declared it will be injected in the DSL available in the shell or templates
|
22
|
-
:dsl:
|
22
|
+
:dsl:
|
23
|
+
- <%= plugin_module_name %>::Dsl::<%= plugin_module_name %>Dsl
|
23
24
|
|
24
25
|
# These are the files (array) defining entity types. These files should not be already
|
25
26
|
# required by the plugin as they will be required by the framework when needed.
|
@@ -17,11 +17,18 @@ module PowerStencil
|
|
17
17
|
@project = project
|
18
18
|
load_system_entities_definition
|
19
19
|
load_plugins_entities_definition
|
20
|
-
load_plugins_dsl_definition
|
21
20
|
load_project_entities_definition
|
22
21
|
load_entities
|
23
22
|
end
|
24
23
|
|
24
|
+
def running_context(universe = root_universe, main_entry_point: nil)
|
25
|
+
context = dsl.new universe
|
26
|
+
apply_plugins_dsl_definition context
|
27
|
+
context.main_entry_point = main_entry_point
|
28
|
+
context.instance_eval do
|
29
|
+
binding
|
30
|
+
end
|
31
|
+
end
|
25
32
|
protected
|
26
33
|
|
27
34
|
def load_project_entities_definition
|
@@ -44,13 +51,13 @@ module PowerStencil
|
|
44
51
|
|
45
52
|
def load_plugins_entities_definition
|
46
53
|
project.plugins.each do |_, plugin|
|
47
|
-
plugin.require_plugin_entity_definitions
|
54
|
+
plugin.require_plugin_entity_definitions
|
48
55
|
end
|
49
56
|
end
|
50
57
|
|
51
|
-
def
|
58
|
+
def apply_plugins_dsl_definition(context)
|
52
59
|
project.plugins.each do |_, plugin|
|
53
|
-
plugin.
|
60
|
+
plugin.apply_extra_dsl context
|
54
61
|
end
|
55
62
|
end
|
56
63
|
|
@@ -3,13 +3,32 @@ module PowerStencil
|
|
3
3
|
|
4
4
|
module Dsl
|
5
5
|
|
6
|
-
def
|
7
|
-
return
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
def dsl_modules_names
|
7
|
+
return [] if plugin_definition[:dsl].nil?
|
8
|
+
case plugin_definition[:dsl]
|
9
|
+
when String
|
10
|
+
[plugin_definition[:dsl]]
|
11
|
+
when Array
|
12
|
+
plugin_definition[:dsl]
|
13
|
+
else
|
14
|
+
raise PowerStencil::Error, "Invalid DSL definition for plugin '#{self.name}' !"
|
11
15
|
end
|
12
16
|
end
|
17
|
+
|
18
|
+
def dsl_modules
|
19
|
+
dsl_modules_names.map { |dsl_module_name| Object.const_get dsl_module_name }
|
20
|
+
end
|
21
|
+
|
22
|
+
def apply_extra_dsl(dsl_base)
|
23
|
+
dsl_modules.each do |dsl_module|
|
24
|
+
logger.debug "Applying extra DSL '#{dsl_module.name}' to base DSL..."
|
25
|
+
dsl_base.extend dsl_module
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
|
13
32
|
end
|
14
33
|
|
15
34
|
end
|
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.5.
|
4
|
+
version: 0.5.1
|
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-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -274,7 +274,7 @@ metadata:
|
|
274
274
|
documentation_uri: https://gitlab.com/tools4devops/power_stencil/blob/master/README.md
|
275
275
|
source_code_uri: https://gitlab.com/tools4devops/power_stencil
|
276
276
|
homepage_uri: https://powerstencil.brizone.org/
|
277
|
-
post_install_message: "\nThank you for installing PowerStencil 0.5.
|
277
|
+
post_install_message: "\nThank you for installing PowerStencil 0.5.1 !\nFrom the command
|
278
278
|
line you can run `power_stencil --help`\nIf your shell is not completing the command:\n
|
279
279
|
\ If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nOfficial Website
|
280
280
|
\ : https://powerstencil.brizone.org/\nFull documentation here : https://gitlab.com/tools4devops/power_stencil/blob/master/README.md\nFeel
|