power_stencil 0.9.8 → 0.10.0
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 +5 -5
- data/.gitlab-ci.yml +1 -1
- data/README.md +4 -4
- data/doc/plugins.md +11 -0
- data/etc/templates/project/.ps_project/entity_definitions/README.md +13 -2
- data/lib/power_stencil/command_processors/init.rb +2 -2
- data/lib/power_stencil/engine/build_handling.rb +6 -1
- data/lib/power_stencil/engine/renderers/erb.rb +1 -1
- data/lib/power_stencil/initializer.rb +2 -2
- data/lib/power_stencil/system_entity_definitions/buildable.rb +4 -0
- data/lib/power_stencil/ultra_command_line/command_line_manager.rb +18 -1
- data/lib/power_stencil/version.rb +1 -1
- data/power_stencil.gemspec +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fc4f20ce02555b3700fc39255dea0343e85964afebe0b3658be510294252b5f3
|
4
|
+
data.tar.gz: 18cbb67c91884f9d18ed2570c763e6f883ce1553fa7cd5ae02af2955288b471f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de64a256d395c0dc7501da6e62b469d78b5f96e798c32b2801ddefce232df93745874c4d6614af46d4727150a0ffaab589c94a7ff033ae1f215ff745d770771e
|
7
|
+
data.tar.gz: 073ef7a1c0043972b3d1ca9358926bac0ee871e1a42147e709989d138860d9207fa9a2f09603f4aca295fb0c77ce32a5b0dca8ec698769af861f11ed27bb3311
|
data/.gitlab-ci.yml
CHANGED
data/README.md
CHANGED
@@ -72,14 +72,14 @@ So `PowerStencil` is definitely not a templating engine, it is actually much mor
|
|
72
72
|
|
73
73
|
# Installation
|
74
74
|
|
75
|
-
You need a working install of the [Ruby] language (>= 2.3).
|
75
|
+
You need a working install of the [Ruby] language (>= 2.3). You should have `bundler` installed (`gem install bundler`). This is not added as an automatic dependency as updating `bundler` may not be what you want. Yet any working install of Ruby should consider having `bundler` installed.
|
76
|
+
|
77
|
+
:hand: It is **strongly** advised to have `git` installed on your system, as `PowerStencil` is integrated with `git` to provide a better user experience.
|
76
78
|
|
77
79
|
Then you can install the `PowerStencil` gem by issuing the usual:
|
78
80
|
|
79
81
|
$ gem install power_stencil
|
80
82
|
|
81
|
-
:hand: It is **strongly** advised to have `git` installed on your system, as `PowerStencil` is integrated with `git` to provide a better user experience.
|
82
|
-
|
83
83
|
If you want to create [Graphviz] graphs, you probably may want to install it for your system. If you are using an _apt-based_ system like Ubuntu or Debian it may probably be as simple as:
|
84
84
|
|
85
85
|
$ sudo apt install graphviz
|
@@ -205,7 +205,7 @@ It provides a very useful auto-completion for sub-commands, options as well as o
|
|
205
205
|
|
206
206
|
* Project independent completion is generated in `~/.zsh/completion/_power_stencil`, whereas completion related to new commands or options, coming from plugins used in a project, is generated (and versioned) within the project itself, in `.ps_project/.zsh_project_completion`.
|
207
207
|
|
208
|
-
* Meaning that if you want to benefit from the "_full_" completion from within a project you may have to re-run `power_stencil add --zsh-completion` from within any project where you use extra plugins, in order to generate
|
208
|
+
* Meaning that if you want to benefit from the "_full_" completion from within a project (ie including extra command line options brought by the project itself), you may have to re-run `power_stencil add --zsh-completion` from within any project where you use extra plugins, in order to (re)generate the `.ps_project/.zsh_project_completion` file. If you don't, it is not a big deal, but then you will only have access to the "_generic_" completion, ie completion not taking in account any of the extra commands or options you are using in this project brought by plugins you may use...
|
209
209
|
|
210
210
|
### Entities
|
211
211
|
|
data/doc/plugins.md
CHANGED
@@ -12,6 +12,7 @@ Plugins
|
|
12
12
|
- [Creating plugin local to the project](#creating-plugin-local-to-the-project)
|
13
13
|
- [Plugin creation](#plugin-creation)
|
14
14
|
- [Adding new subcommands to `PowerStencil`](#adding-new-subcommands-to-powerstencil)
|
15
|
+
- [Updating zsh auto-completion](#updating-zsh-auto-completion)
|
15
16
|
- [Providing entity types and templates](#providing-entity-types-and-templates)
|
16
17
|
- [Providing custom build process](#providing-custom-build-process)
|
17
18
|
- [Plugin capabilities and structure](#plugin-capabilities-and-structure)
|
@@ -183,6 +184,15 @@ MYPLUGIN PLUGIN WAZ HERE !!
|
|
183
184
|
|
184
185
|
Wow it worked ! Useless, but worked ! But it's a good demo on how to create your own subcommands in `PowerStencil`.
|
185
186
|
|
187
|
+
## Updating zsh auto-completion
|
188
|
+
|
189
|
+
When you add a plugin to a project, be it local or from a separated gem, you may want to update the command-line auto-completion for that project as new plugins may add extra command-line options and sub-commands.
|
190
|
+
|
191
|
+
You do that as you probably already [dit it initially][completion].
|
192
|
+
|
193
|
+
$ power_stencil adm --zsh-completion
|
194
|
+
|
195
|
+
|
186
196
|
## Providing entity types and templates
|
187
197
|
|
188
198
|
Of course you can provide new entity types and templates templates within plugin. The plugin created contains a demo entity type which brings its own template template (and even a custom build, but we will see that in next paragraph).
|
@@ -507,6 +517,7 @@ The documentation for plugins is not fully complete, so you are encouraged to re
|
|
507
517
|
[builds]: builds.md "Builds in PowerStencil"
|
508
518
|
[templates]: templates.md "Templates in PowerStencil"
|
509
519
|
[post-process]: builds.md#post-process-actions "post-process actions in builds"
|
520
|
+
[completion]: ../README.md#command-line-auto-completion "how to setup zsh command-line auto-completion"
|
510
521
|
|
511
522
|
<!-- Code links -->
|
512
523
|
|
@@ -5,11 +5,22 @@ PowerStencil entity definitions
|
|
5
5
|
In this directory, you can define project specific entity definitions
|
6
6
|
which basically are plain ruby files processed in alphabetical order.
|
7
7
|
|
8
|
-
You can create classes that are inheriting from `PowerStencil::
|
8
|
+
You can create classes that are inheriting from `PowerStencil::SystemEntityDefinitions::ProjectEntity`
|
9
9
|
To express relations between entities you should use the ActiveRecord-like
|
10
10
|
syntax provided by the `universe_compiler` gem.
|
11
11
|
|
12
12
|
|
13
13
|
__It is strongly advised to keep this directory under source control__
|
14
14
|
|
15
|
-
This should be the PowerStencil default behaviour.
|
15
|
+
This should be the PowerStencil default behaviour.
|
16
|
+
|
17
|
+
example class:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
class ExampleEntity < PowerStencil::SystemEntityDefinitions::ProjectEntity
|
21
|
+
entity_type :example
|
22
|
+
|
23
|
+
[...]
|
24
|
+
|
25
|
+
end
|
26
|
+
```
|
@@ -14,7 +14,7 @@ module PowerStencil
|
|
14
14
|
|
15
15
|
def execute
|
16
16
|
setup_project_path
|
17
|
-
#
|
17
|
+
# log_startup_context
|
18
18
|
puts_and_logs "Creating new project structure in '#{config[:'project-path']}'", check_verbose: false
|
19
19
|
PowerStencil::Project::Base.create_project_tree config[:'project-path']
|
20
20
|
puts_and_logs 'Done.', check_verbose: false
|
@@ -44,4 +44,4 @@ module PowerStencil
|
|
44
44
|
end
|
45
45
|
|
46
46
|
end
|
47
|
-
end
|
47
|
+
end
|
@@ -55,10 +55,15 @@ module PowerStencil
|
|
55
55
|
def generate_build_files(entity_to_build, target_path)
|
56
56
|
logger.info "Rendering '#{entity_to_build.as_path}' templates in '#{target_path}'"
|
57
57
|
render_source entity_to_build.templates_path, target_path, main_entry_point: entity_to_build.as_path
|
58
|
+
render_entity entity_to_build, target_path if entity_to_build.class.provides_own_build?
|
58
59
|
logger.info "Detemplatized files generated in '#{target_path}'"
|
59
60
|
manage_build_links target_path
|
60
61
|
end
|
61
62
|
|
63
|
+
def render_entity(entity_to_build, target_path)
|
64
|
+
entity_to_build.class.entity_build entity_to_build, target_path
|
65
|
+
end
|
66
|
+
|
62
67
|
def post_build_hook(entity_to_build, files_path)
|
63
68
|
case entity_to_build.type
|
64
69
|
when :simple_exec
|
@@ -127,7 +132,7 @@ module PowerStencil
|
|
127
132
|
target_plugin = project.plugins[target_plugin_name]
|
128
133
|
raise PowerStencil::Error, "Could not find plugin '#{target_plugin_name}' !" if target_plugin.nil?
|
129
134
|
if target_plugin.capabilities[:generate_build_files]
|
130
|
-
target_plugin.generate_build_files entity_to_build, target_path
|
135
|
+
target_plugin.generate_build_files entity_to_build, target_path, &:generate_build_files
|
131
136
|
else
|
132
137
|
logger.info 'Falling back to PowerStencil core build files generation process...'
|
133
138
|
generate_build_files entity_to_build, target_path
|
@@ -8,7 +8,7 @@ module PowerStencil
|
|
8
8
|
|
9
9
|
def render_erb_template(source, context)
|
10
10
|
logger.debug "Using ERB to render file '#{source}'"
|
11
|
-
ERB.new(File.read(source),
|
11
|
+
ERB.new(File.read(source), trim_mode: '-').result(context)
|
12
12
|
rescue => e
|
13
13
|
logger.debug PowerStencil::Error.report_error(e)
|
14
14
|
raise PowerStencil::Error, "Error rendering '#{source}': '#{e.message}'"
|
@@ -15,7 +15,7 @@ module PowerStencil
|
|
15
15
|
def bootstrap(cmd_line_args = ARGV.dup)
|
16
16
|
setup_climatic cmd_line_args
|
17
17
|
logger.debug 'Starting PowerStencil initialization...'
|
18
|
-
|
18
|
+
register_system_processors
|
19
19
|
setup_universe_compiler_logger
|
20
20
|
project fail_on_error: false
|
21
21
|
logger.debug 'PowerStencil initialization complete'
|
@@ -38,7 +38,7 @@ module PowerStencil
|
|
38
38
|
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
41
|
+
def register_system_processors
|
42
42
|
logger.debug 'Registering system processors'
|
43
43
|
{
|
44
44
|
'' => PowerStencil::CommandProcessors::Root,
|
@@ -24,7 +24,6 @@ class UltraCommandLine::Manager::Base
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
# private
|
28
27
|
|
29
28
|
def internal_provider_mapping
|
30
29
|
@internal_provider_mapping ||= {}
|
@@ -32,4 +31,22 @@ class UltraCommandLine::Manager::Base
|
|
32
31
|
|
33
32
|
end
|
34
33
|
|
34
|
+
# def contribute_to_definition(hash, layer_name: :unknown_layer)
|
35
|
+
# super
|
36
|
+
# end
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
def processor
|
41
|
+
processor_candidates = processors_hash.fetch(command(cmd_line_args).name, []) .select do |processor|
|
42
|
+
processor.check_params command.cmd_line_args
|
43
|
+
end
|
44
|
+
raise UltraCommandLine::Error, 'No processor found for this command line' if processor_candidates.empty?
|
45
|
+
return processor_candidates.first if processor_candidates.size == 1
|
46
|
+
|
47
|
+
|
48
|
+
raise UltraCommandLine::Error, 'Too many possible processors' unless processor_candidates.size == 1
|
49
|
+
processor_candidates.first
|
50
|
+
end
|
51
|
+
|
35
52
|
end
|
data/power_stencil.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
26
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
27
|
|
28
|
-
spec.add_dependency 'climatic', '~> 0.2.
|
28
|
+
spec.add_dependency 'climatic', '~> 0.2.40'
|
29
29
|
spec.add_dependency 'dir_glob_ignore', '~> 0.3'
|
30
30
|
spec.add_dependency 'universe_compiler', '~> 0.5.6'
|
31
31
|
spec.add_dependency 'pry'
|
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
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent Briais
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.2.
|
61
|
+
version: 0.2.40
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.2.
|
68
|
+
version: 0.2.40
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: dir_glob_ignore
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -329,12 +329,13 @@ metadata:
|
|
329
329
|
documentation_uri: https://gitlab.com/tools4devops/power_stencil/blob/master/README.md
|
330
330
|
source_code_uri: https://gitlab.com/tools4devops/power_stencil
|
331
331
|
homepage_uri: https://powerstencil.brizone.org/
|
332
|
-
post_install_message: "\nThank you for installing PowerStencil 0.
|
333
|
-
line you can run `power_stencil --help`\nIf your shell is not completing
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
332
|
+
post_install_message: "\nThank you for installing PowerStencil 0.10.0 !\nFrom the
|
333
|
+
command line you can run `power_stencil --help`\nIf your shell is not completing
|
334
|
+
the command:\n If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nOfficial
|
335
|
+
Website : https://powerstencil.brizone.org/\nFull documentation here :
|
336
|
+
https://gitlab.com/tools4devops/power_stencil/blob/master/README.md\nFeel free to
|
337
|
+
report issues: https://gitlab.com/tools4devops/power_stencil/issues\n\nType 'power_stencil
|
338
|
+
adm --zsh-completion' to install auto-completion for zsh.\n\n "
|
338
339
|
rdoc_options: []
|
339
340
|
require_paths:
|
340
341
|
- lib
|
@@ -349,8 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
349
350
|
- !ruby/object:Gem::Version
|
350
351
|
version: '0'
|
351
352
|
requirements: []
|
352
|
-
|
353
|
-
rubygems_version: 2.5.1
|
353
|
+
rubygems_version: 3.3.26
|
354
354
|
signing_key:
|
355
355
|
specification_version: 4
|
356
356
|
summary: PowerStencil is the Swiss-army knife templating workflow for developers and
|