power_stencil 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/etc/meta_templates/plugin_seed/.gitignore +1 -0
- data/etc/meta_templates/plugin_seed/README.md +1 -1
- data/etc/meta_templates/plugin_seed/etc/plugin_capabilities.yaml +3 -0
- data/etc/templates/plugin_definition/.gitignore +1 -0
- data/etc/templates/plugin_definition/README.md +1 -1
- data/etc/templates/plugin_definition/etc/plugin_capabilities.yaml +3 -0
- data/etc/templates/project/.ps_project/versioned-config.yaml +1 -0
- data/lib/power_stencil/engine/project_engine.rb +1 -1
- data/lib/power_stencil/plugins/base.rb +0 -1
- data/lib/power_stencil/plugins/capabilities.rb +4 -0
- data/lib/power_stencil/plugins/require.rb +6 -6
- data/lib/power_stencil/project/base.rb +2 -0
- data/lib/power_stencil/project/plugins.rb +35 -2
- data/lib/power_stencil/utils/dependency_solver.rb +19 -0
- data/lib/power_stencil/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c36f08f7b3ad9a916e27a18e755af6794084b97f
|
4
|
+
data.tar.gz: 82104cf2bda5b15f57020b57ccf66b1e95ee241c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d1db8dd8989c9299eea8fe869e527f7c86b93db49353962ecf2620a34614fb143a39b02e12480dd02929c57c5adce19ec53b35754e327e79c9620bff0d1708f
|
7
|
+
data.tar.gz: 8e1377704873ca6d8a8eb69c4ba7e41f3e2a9cb0af77b3c7d06ea5bb5fc3174b72dc3df81140dcbd4cb0c286b21bac3ebc7e15fff4ff44d82e4e08acc5925e31
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= plugin_title_name %>
|
3
3
|
<%= '=' * plugin_title_name.size %>
|
4
4
|
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/<%= gem_name %>.svg)](https://rubygems.org/gems/<%= gem_name %>) [![Pipeline status](https://gitlab.com/tools4devops/psplugins/<%=
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/<%= gem_name %>.svg)](https://rubygems.org/gems/<%= gem_name %>) [![Pipeline status](https://gitlab.com/tools4devops/psplugins/<%= plugin_name %>/badges/master/pipeline.svg)](https://gitlab.com/tools4devops/psplugins/<%= gem_name %>/commits/master)
|
6
6
|
|
7
7
|
[PowerStencil] is the Swiss-army knife templating workflow for developers and ops.
|
8
8
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= plugin_title_name %>
|
3
3
|
<%= '=' * plugin_title_name.size %>
|
4
4
|
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/<%= gem_name %>.svg)](https://rubygems.org/gems/<%= gem_name %>) [![Pipeline status](https://gitlab.com/tools4devops/psplugins/<%=
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/<%= gem_name %>.svg)](https://rubygems.org/gems/<%= gem_name %>) [![Pipeline status](https://gitlab.com/tools4devops/psplugins/<%= plugin_name %>/badges/master/pipeline.svg)](https://gitlab.com/tools4devops/psplugins/<%= gem_name %>/commits/master)
|
6
6
|
|
7
7
|
[PowerStencil] is the Swiss-army knife templating workflow for developers and ops.
|
8
8
|
|
@@ -7,12 +7,6 @@ module PowerStencil
|
|
7
7
|
|
8
8
|
include PowerStencil::Utils::SecureRequire
|
9
9
|
|
10
|
-
private
|
11
|
-
|
12
|
-
def module_short_name
|
13
|
-
name.split(/[-_]+/).map(&:capitalize).join.to_sym
|
14
|
-
end
|
15
|
-
|
16
10
|
def require_entry_point
|
17
11
|
@entry_point_path = File.join plugin_path, 'lib', "#{name.underscore}.rb"
|
18
12
|
logger.debug "Plugin '#{name}' entry point: '#{entry_point_path}'"
|
@@ -27,6 +21,12 @@ module PowerStencil
|
|
27
21
|
end
|
28
22
|
end
|
29
23
|
|
24
|
+
private
|
25
|
+
|
26
|
+
def module_short_name
|
27
|
+
name.split(/[-_]+/).map(&:capitalize).join.to_sym
|
28
|
+
end
|
29
|
+
|
30
30
|
def setup_version
|
31
31
|
@version = PowerStencil::Utils::SemanticVersion.new plugin_module::VERSION
|
32
32
|
capabilities[:version] = true
|
@@ -18,13 +18,37 @@ module PowerStencil
|
|
18
18
|
|
19
19
|
end
|
20
20
|
|
21
|
+
def plugins_sorted_by_dependency
|
22
|
+
solver = PowerStencil::Utils::DependencySolver.new
|
23
|
+
plugin_names = plugins.keys
|
24
|
+
|
25
|
+
plugins.each do |_, plugin|
|
26
|
+
unless plugin.dependencies.nil?
|
27
|
+
plugin.dependencies.each do |dependency_name|
|
28
|
+
raise PowerStencil::Error, "Invalid dependency '#{dependency_name}'declared for plugin '#{plugin.name}' !" unless plugin_names.include? dependency_name
|
29
|
+
end
|
30
|
+
end
|
31
|
+
solver[plugin.name] = plugin.dependencies.nil? ? [] : plugin.dependencies
|
32
|
+
end
|
33
|
+
solver.tsort.map { |plugin_name| plugins[plugin_name] }
|
34
|
+
rescue TSort::Cyclic => e
|
35
|
+
PowerStencil::Error.report_error e
|
36
|
+
raise PowerStencil::Error, 'Plugins cyclical dependency error !'
|
37
|
+
end
|
38
|
+
|
39
|
+
|
21
40
|
private
|
22
41
|
|
23
42
|
def bootstrap_plugins
|
24
43
|
@plugins = {}
|
25
44
|
initialize_gem_plugins
|
26
45
|
initialize_local_plugins
|
46
|
+
require_plugins_entry_points
|
27
47
|
command_line_manager.definition_hash_to_commands
|
48
|
+
register_plugins_processors
|
49
|
+
end
|
50
|
+
|
51
|
+
def register_plugins_processors
|
28
52
|
plugins.each do |_, plugin|
|
29
53
|
if plugin.capabilities[:processors]
|
30
54
|
plugin.register_processors
|
@@ -32,6 +56,12 @@ module PowerStencil
|
|
32
56
|
end
|
33
57
|
end
|
34
58
|
|
59
|
+
def require_plugins_entry_points
|
60
|
+
plugins_sorted_by_dependency.each do |plugin|
|
61
|
+
plugin.require_entry_point
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
35
65
|
def initialize_gem_plugins
|
36
66
|
if config[:project_plugins].empty?
|
37
67
|
PowerStencil.logger.info 'No gem plugin found in project'
|
@@ -42,7 +72,8 @@ module PowerStencil
|
|
42
72
|
(gem_name, gem_req) = PowerStencil::Plugins::Base.plugin_definition_to_name_and_req plugin_definition
|
43
73
|
raise PowerStencil::Error, "Plugin '#{gem_name}' already exists !" unless plugins[gem_name].nil?
|
44
74
|
|
45
|
-
|
75
|
+
plugin = PowerStencil::Plugins::Base.new(gem_name, self, type: :gem, gem_req: gem_req)
|
76
|
+
plugins[plugin.name] = plugin
|
46
77
|
end
|
47
78
|
end
|
48
79
|
|
@@ -55,10 +86,12 @@ module PowerStencil
|
|
55
86
|
Dir.entries(project_local_plugins_path)
|
56
87
|
.select { |e| File.directory? File.join(project_local_plugins_path, e) }
|
57
88
|
.reject { |d| %w(. ..).include? d }
|
89
|
+
.sort
|
58
90
|
.each do |candidate|
|
59
91
|
begin
|
60
92
|
raise PowerStencil::Error, "Plugin '#{candidate}' already exists !" unless plugins[candidate].nil?
|
61
|
-
|
93
|
+
plugin = PowerStencil::Plugins::Base.new(candidate, self)
|
94
|
+
plugins[plugin.name] = plugin
|
62
95
|
rescue PowerStencil::Error => pse
|
63
96
|
logger.puts_and_logs pse.message, logs_as: :error
|
64
97
|
logger.puts_and_logs "Discarding invalid plugin '#{candidate}'.", logs_as: :error
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'tsort'
|
2
|
+
|
3
|
+
module PowerStencil
|
4
|
+
module Utils
|
5
|
+
|
6
|
+
class DependencySolver < Hash
|
7
|
+
|
8
|
+
include TSort
|
9
|
+
|
10
|
+
alias tsort_each_node each_key
|
11
|
+
|
12
|
+
def tsort_each_child(node, &block)
|
13
|
+
fetch(node).each(&block)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
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.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent Briais
|
@@ -307,6 +307,7 @@ files:
|
|
307
307
|
- lib/power_stencil/ultra_command_line/providers_manager.rb
|
308
308
|
- lib/power_stencil/ultra_command_line/sub_command.rb
|
309
309
|
- lib/power_stencil/utils/completion.rb
|
310
|
+
- lib/power_stencil/utils/dependency_solver.rb
|
310
311
|
- lib/power_stencil/utils/directory_processor.rb
|
311
312
|
- lib/power_stencil/utils/file_edit.rb
|
312
313
|
- lib/power_stencil/utils/file_helper.rb
|
@@ -326,7 +327,7 @@ metadata:
|
|
326
327
|
documentation_uri: https://gitlab.com/tools4devops/power_stencil/blob/master/README.md
|
327
328
|
source_code_uri: https://gitlab.com/tools4devops/power_stencil
|
328
329
|
homepage_uri: https://powerstencil.brizone.org/
|
329
|
-
post_install_message: "\nThank you for installing PowerStencil 0.9.
|
330
|
+
post_install_message: "\nThank you for installing PowerStencil 0.9.3 !\nFrom the command
|
330
331
|
line you can run `power_stencil --help`\nIf your shell is not completing the command:\n
|
331
332
|
\ If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nOfficial Website
|
332
333
|
\ : https://powerstencil.brizone.org/\nFull documentation here : https://gitlab.com/tools4devops/power_stencil/blob/master/README.md\nFeel
|