power_stencil 0.4.17 → 0.4.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/doc/plugins.md +31 -3
- data/etc/base_commands_definition.yml +14 -4
- data/etc/power_stencil.yaml +4 -5
- data/etc/templates/project/.ps_project/plugins/README.md +1 -1
- data/lib/power_stencil.rb +1 -1
- data/lib/power_stencil/command_processors/plugin.rb +56 -0
- data/lib/power_stencil/initializer.rb +1 -1
- data/lib/power_stencil/version.rb +1 -1
- metadata +3 -3
- data/lib/power_stencil/command_processors/new_plugin.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80af1c57689a2ba89246da59fb373577dd48a31b
|
4
|
+
data.tar.gz: 1c91918d21e15a9730929db9d58309b415c6098d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4ee7f37502473381418bc6184c6436f5ab05d159ed819d4bfbd4cc39554130cddd9a2d0742db82db7f7103738d7b7614df3cd1753e0d29a9713fc98608d5999
|
7
|
+
data.tar.gz: bd212747f02e36cc2d3d93f37246152c34ba7552af969757cada09122063ca1633e05b47a549abd9d703bb7bff3e9a8f8bc380f53b767475b0477cc4a745e5e5
|
data/README.md
CHANGED
@@ -112,7 +112,7 @@ PowerStencil is the Swiss-army knife templating workflow for developers and ops.
|
|
112
112
|
--------------------------------------------------------------------------------
|
113
113
|
* init: Initializes a PowerStencil repository ...
|
114
114
|
* info: Generic information about the repository ...
|
115
|
-
*
|
115
|
+
* plugin: Manipulates plugins ...
|
116
116
|
* get: Query entities from repository ...
|
117
117
|
* shell: Opens a shell to interact with entities ...
|
118
118
|
* check: Check repository entities consistency ...
|
data/doc/plugins.md
CHANGED
@@ -52,7 +52,7 @@ The normal process would be to begin with a plugin within the project and once y
|
|
52
52
|
The is a command provided for that, that will create a whole plugin skeleton.
|
53
53
|
|
54
54
|
```shell
|
55
|
-
$ power_stencil
|
55
|
+
$ power_stencil plugin --create myplugin
|
56
56
|
Generated new plugin 'myplugin'
|
57
57
|
|
58
58
|
$ ll .ps_project/plugins/myplugin
|
@@ -96,7 +96,35 @@ If you do a `power_stencil info` you see a new part appeared in the report
|
|
96
96
|
```
|
97
97
|
Each of the lines correspond to what is called a _plugin capability_.
|
98
98
|
|
99
|
-
|
99
|
+
You can get the same information by issuing:
|
100
|
+
|
101
|
+
$ power_stencil plugin --list
|
102
|
+
|
103
|
+
```
|
104
|
+
1 plugin found to be used in this project.
|
105
|
+
- myplugin (in '/tmp/tst project/.ps_project/plugins/myplugin/lib/myplugin.rb')
|
106
|
+
```
|
107
|
+
|
108
|
+
Or with the capabilities information:
|
109
|
+
|
110
|
+
$ power_stencil plugin --list -v
|
111
|
+
|
112
|
+
```
|
113
|
+
1 plugin found to be used in this project.
|
114
|
+
- myplugin (in '/tmp/tst project/.ps_project/plugins/myplugin/lib/myplugin.rb')
|
115
|
+
command_line: true
|
116
|
+
local_config: true
|
117
|
+
processors: true
|
118
|
+
build: false
|
119
|
+
dsl: false
|
120
|
+
entity_definitions: true
|
121
|
+
code: true
|
122
|
+
version: true
|
123
|
+
templates: true
|
124
|
+
```
|
125
|
+
|
126
|
+
|
127
|
+
Obviously by default the plugin does nothing useful, yet it defined some placeholders. For example in the output here above it says `command_line: true`. What could it mean ?
|
100
128
|
|
101
129
|
Let's try to see to help:
|
102
130
|
|
@@ -122,7 +150,7 @@ PowerStencil is the Swiss-army knife templating workflow for developers and ops.
|
|
122
150
|
--------------------------------------------------------------------------------
|
123
151
|
* init: Initializes a PowerStencil repository ...
|
124
152
|
* info: Generic information about the repository ...
|
125
|
-
*
|
153
|
+
* plugin: Manipulates plugins ...
|
126
154
|
* get: Query entities from repository ...
|
127
155
|
* shell: Opens a shell to interact with entities ...
|
128
156
|
* check: Check repository entities consistency ...
|
@@ -93,14 +93,24 @@
|
|
93
93
|
info [options]
|
94
94
|
|
95
95
|
Displays information about the repository.
|
96
|
-
|
96
|
+
plugin:
|
97
97
|
:banner: |
|
98
|
-
|
98
|
+
Manipulates plugins.
|
99
99
|
|
100
100
|
Usage:
|
101
|
-
|
101
|
+
plugin [options]
|
102
102
|
|
103
|
-
|
103
|
+
Manipulates plugins.
|
104
|
+
:options:
|
105
|
+
create:
|
106
|
+
:type: bool
|
107
|
+
:summary: Generates a fully working although useless plugin skeleton.
|
108
|
+
:long_aliases:
|
109
|
+
- new
|
110
|
+
- scaffold
|
111
|
+
list:
|
112
|
+
:type: bool
|
113
|
+
:summary: List currently used plugins in this project.
|
104
114
|
get:
|
105
115
|
:banner: |
|
106
116
|
Query entities from repository.
|
data/etc/power_stencil.yaml
CHANGED
@@ -46,11 +46,11 @@
|
|
46
46
|
:shell_dsl:
|
47
47
|
:prompt_level_1: 'PowerStencil DSL> '
|
48
48
|
:prompt_level_2: 'PowerStencil DSL --> '
|
49
|
-
:session_greetings:
|
49
|
+
:session_greetings: |+
|
50
50
|
-------------------------------------------------------------------------------
|
51
51
|
Welcome to the PowerStencil shell session
|
52
52
|
In this shell you have access to anything the templating engine has access to.
|
53
|
-
|
53
|
+
On top of this, you can view, edit, save and delete entities.
|
54
54
|
|
55
55
|
- Retrieve and manipulate entities using the `entities` hash.
|
56
56
|
- Persist your changes using the `save` method on each entity.
|
@@ -63,8 +63,6 @@
|
|
63
63
|
Type `exit` to end your session.
|
64
64
|
-------------------------------------------------------------------------------
|
65
65
|
|
66
|
-
|
67
|
-
|
68
66
|
# TEMPLATING ENGINE
|
69
67
|
|
70
68
|
# Map to define which kind of template engine for which type of file. Be careful if you
|
@@ -75,7 +73,8 @@
|
|
75
73
|
|
76
74
|
# Files matching particular patterns can be changed on the fly
|
77
75
|
:file_renaming_patterns:
|
78
|
-
# Specific .gitignore
|
76
|
+
# Specific .gitignore hack for `power_stencil init` as .gitignore should be processed
|
77
|
+
# *after* .ps_project
|
79
78
|
^(.+)\.zzzgitignore\.erb$: '\1.gitignore'
|
80
79
|
# Erb files
|
81
80
|
^(.+)\.erb$: '\1'
|
@@ -5,7 +5,7 @@ PowerStencil plugins
|
|
5
5
|
In this directory, you can define project specific local plugins.
|
6
6
|
You should create them using the `PowerStencil` command-line.
|
7
7
|
|
8
|
-
$ power_stencil
|
8
|
+
$ power_stencil plugin --create myplugin
|
9
9
|
|
10
10
|
__It is strongly advised to keep this directory under source control__
|
11
11
|
|
data/lib/power_stencil.rb
CHANGED
@@ -30,7 +30,7 @@ require 'power_stencil/command_processors/create'
|
|
30
30
|
require 'power_stencil/command_processors/edit'
|
31
31
|
require 'power_stencil/command_processors/delete'
|
32
32
|
require 'power_stencil/command_processors/shell'
|
33
|
-
require 'power_stencil/command_processors/
|
33
|
+
require 'power_stencil/command_processors/plugin'
|
34
34
|
require 'power_stencil/command_processors/build'
|
35
35
|
|
36
36
|
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module PowerStencil
|
2
|
+
module CommandProcessors
|
3
|
+
|
4
|
+
class Plugin
|
5
|
+
|
6
|
+
include Climatic::Script::UnimplementedProcessor
|
7
|
+
include Climatic::Proxy
|
8
|
+
include PowerStencil::Project::Proxy
|
9
|
+
|
10
|
+
def execute
|
11
|
+
|
12
|
+
if config[:list]
|
13
|
+
if project.plugins.empty?
|
14
|
+
puts 'No plugin used in this project.'
|
15
|
+
else
|
16
|
+
puts "#{project.plugins.size} plugin#{project.plugins.size == 1 ? '' : 's'} found to be used in this project."
|
17
|
+
end
|
18
|
+
project.plugins.each do |plugin_name, plugin_def|
|
19
|
+
puts " - #{plugin_name} (in '#{plugin_def.entry_point_path}')"
|
20
|
+
if config[:verbose]
|
21
|
+
plugin_def.capabilities.each do |name, value|
|
22
|
+
puts " #{name}: #{value}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
return
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
if config[:create]
|
31
|
+
if config.command_line_layer.extra_parameters.empty?
|
32
|
+
raise PowerStencil::Error, 'Please specify at least one plugin name !'
|
33
|
+
end
|
34
|
+
config.command_line_layer.extra_parameters.each do |plugin_name|
|
35
|
+
begin
|
36
|
+
target_path = File.join project.project_plugin_path(plugin_name)
|
37
|
+
project.create_plugin_tree plugin_name, target_path
|
38
|
+
puts "Generated new plugin '#{plugin_name}'"
|
39
|
+
rescue => e
|
40
|
+
msg = "Could not create plugin '#{plugin_name}' because '#{e.message}'"
|
41
|
+
puts msg
|
42
|
+
logger.error "Could not create plugin '#{plugin_name}' because '#{e.message}'"
|
43
|
+
logger.debug PowerStencil::Error.report_error(e)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
return
|
47
|
+
end
|
48
|
+
|
49
|
+
raise PowerStencil::Error, 'You should specify an option'
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -47,7 +47,7 @@ module PowerStencil
|
|
47
47
|
edit: PowerStencil::CommandProcessors::Edit,
|
48
48
|
delete: PowerStencil::CommandProcessors::Delete,
|
49
49
|
shell: PowerStencil::CommandProcessors::Shell,
|
50
|
-
:
|
50
|
+
plugin: PowerStencil::CommandProcessors::Plugin,
|
51
51
|
build: PowerStencil::CommandProcessors::Build
|
52
52
|
}.each do |command_name, processor|
|
53
53
|
command_line_manager.register_processor command_line_manager.command_by_alias(command_name),
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent Briais
|
@@ -196,7 +196,7 @@ files:
|
|
196
196
|
- lib/power_stencil/command_processors/get.rb
|
197
197
|
- lib/power_stencil/command_processors/info.rb
|
198
198
|
- lib/power_stencil/command_processors/init.rb
|
199
|
-
- lib/power_stencil/command_processors/
|
199
|
+
- lib/power_stencil/command_processors/plugin.rb
|
200
200
|
- lib/power_stencil/command_processors/root.rb
|
201
201
|
- lib/power_stencil/command_processors/shell.rb
|
202
202
|
- lib/power_stencil/command_processors/trace_helper.rb
|
@@ -260,7 +260,7 @@ metadata:
|
|
260
260
|
documentation_uri: https://gitlab.com/tools4devops/power_stencil/blob/master/README.md
|
261
261
|
source_code_uri: https://gitlab.com/tools4devops/power_stencil
|
262
262
|
homepage_uri: https://powerstencil.brizone.org/
|
263
|
-
post_install_message: "\nThank you for installing PowerStencil 0.4.
|
263
|
+
post_install_message: "\nThank you for installing PowerStencil 0.4.18 !\nFrom the
|
264
264
|
command line you can run `power_stencil --help`\nIf your shell is not completing
|
265
265
|
the command:\n If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nOfficial
|
266
266
|
Website : https://powerstencil.brizone.org/\nFull documentation here :
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module PowerStencil
|
2
|
-
module CommandProcessors
|
3
|
-
|
4
|
-
class NewPlugin
|
5
|
-
|
6
|
-
include Climatic::Script::UnimplementedProcessor
|
7
|
-
include Climatic::Proxy
|
8
|
-
include PowerStencil::Project::Proxy
|
9
|
-
|
10
|
-
def execute
|
11
|
-
if config.command_line_layer.extra_parameters.empty?
|
12
|
-
raise PowerStencil::Error, 'Please specify a plugin name!'
|
13
|
-
end
|
14
|
-
config.command_line_layer.extra_parameters.each do |plugin_name|
|
15
|
-
begin
|
16
|
-
target_path = File.join project.project_plugin_path(plugin_name)
|
17
|
-
project.create_plugin_tree plugin_name, target_path
|
18
|
-
puts "Generated new plugin '#{plugin_name}'"
|
19
|
-
rescue => e
|
20
|
-
msg = "Could not create plugin '#{plugin_name}' because '#{e.message}'"
|
21
|
-
puts msg
|
22
|
-
logger.error "Could not create plugin '#{plugin_name}' because '#{e.message}'"
|
23
|
-
logger.debug PowerStencil::Error.report_error(e)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|