power_stencil 0.9.0 → 0.9.1
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/etc/meta_templates/plugin_seed/README.md +19 -4
- data/etc/meta_templates/plugin_seed/spec/project_helper.rb +50 -0
- data/etc/meta_templates/plugin_seed/spec/spec_helper.rb +2 -1
- data/etc/meta_templates/plugin_seed/spec/{entity}_spec.rb +21 -1
- data/etc/templates/plugin_definition/README.md +19 -4
- data/etc/templates/plugin_definition/spec/project_helper.rb +50 -0
- data/etc/templates/plugin_definition/spec/spec_helper.rb +2 -1
- data/etc/templates/plugin_definition/spec/{entity}_spec.rb +21 -1
- data/lib/power_stencil/command_processors/create.rb +1 -1
- data/lib/power_stencil/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8ef665f1ce87e962192d7725c2dbd851759bc00
|
4
|
+
data.tar.gz: 65d6b440a419dddc9a3f0c46c2b7c80db9d78d90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e39368e94c8710dba97db574916017d9a30ce45468d5674787daef4f2ad915af8dba03235d60988a2f887a96020f151dabccd160b32baef0d4421a576339284
|
7
|
+
data.tar.gz: 7a7ba9f93020d3d92954ef997d46d5724ff11e79deec6270e1a283009faf00df56762435532aa8762dbad93ea062af4931b21fb76941fa04ec59cc0b141de69d
|
@@ -16,6 +16,9 @@ See [official website][PowerStencil site].
|
|
16
16
|
- [What is a PowerStencil plugin ?](#what-is-a-powerstencil-plugin-)
|
17
17
|
- [Using this plugin in your `PowerStencil` projects](#using-this-plugin-in-your-powerstencil-projects)
|
18
18
|
- [Goal of this plugin](#goal-of-this-plugin)
|
19
|
+
- [Plugin dependencies](#plugin-dependencies)
|
20
|
+
- [Standard gems dependencies](#standard-gems-dependencies)
|
21
|
+
- [Dependency to other plugins](#dependency-to-other-plugins)
|
19
22
|
- [Plugin capabilities](#plugin-capabilities)
|
20
23
|
- [Config](#config)
|
21
24
|
- [Subcommands and options](#subcommands-and-options)
|
@@ -66,9 +69,22 @@ And then you may see information about the plugin by running:
|
|
66
69
|
* `power_stencil info` in the plugins section.
|
67
70
|
* `power_stencil plugin --list -v`
|
68
71
|
|
69
|
-
#
|
72
|
+
# Goal of this plugin
|
70
73
|
|
71
|
-
#
|
74
|
+
# Plugin dependencies
|
75
|
+
|
76
|
+
## Standard gems dependencies
|
77
|
+
|
78
|
+
Standard dependencies are declared normally in the _gemspec file_. They are automatically installed when installing the plugin with `power_stencil plugin --install`.
|
79
|
+
|
80
|
+
## Dependency to other plugins
|
81
|
+
|
82
|
+
For development purpose, dependency to other plugins are declared in the _gemspec file_ as _development dependency_.
|
83
|
+
|
84
|
+
But within a project, dependencies have to be added to the `:project_plugins` array in the project configuration file (`.ps_project/versioned-config.yaml`).
|
85
|
+
|
86
|
+
|
87
|
+
# Plugin capabilities
|
72
88
|
|
73
89
|
This plugin provides the following features:
|
74
90
|
|
@@ -78,13 +94,12 @@ This plugin provides the following features:
|
|
78
94
|
|
79
95
|
## Post-build actions
|
80
96
|
|
81
|
-
##
|
97
|
+
## DSL in templates and in `power_stencil shell`
|
82
98
|
|
83
99
|
## Entity types
|
84
100
|
|
85
101
|
## Templates-templates
|
86
102
|
|
87
|
-
|
88
103
|
# Contributing
|
89
104
|
|
90
105
|
Bug reports and pull requests are welcome on Gitlab at https://gitlab.com/tools4devops/psplugins/<%= plugin_name %>/issues. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module PowerStencilTests
|
2
|
+
|
3
|
+
module Project
|
4
|
+
|
5
|
+
TEMP_DIR_PREFIX = 'PS_TESTS_'
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
|
9
|
+
|
10
|
+
def temporary_project(project_name, with_git_support: false, scope: :all)
|
11
|
+
self.instance_eval do
|
12
|
+
puts scope
|
13
|
+
around(scope) do |execution|
|
14
|
+
Dir.mktmpdir(TEMP_DIR_PREFIX) do |tests_root_dir|
|
15
|
+
tmp_project_path = File.join tests_root_dir, project_name
|
16
|
+
create_project_including_this_plugin tmp_project_path, with_git_support: with_git_support
|
17
|
+
execution.run
|
18
|
+
@tmp_project_path = nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def plugin_path
|
25
|
+
File.expand_path File.join('..', '..'), __FILE__
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
attr_reader :tmp_project_path
|
31
|
+
|
32
|
+
def self.included(base)
|
33
|
+
base.extend(ClassMethods)
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_project_including_this_plugin(project_path, with_git_support: false)
|
37
|
+
cmd = "power_stencil init --project-path '#{project_path}'"
|
38
|
+
cmd << ' --no-git' unless with_git_support
|
39
|
+
`#{cmd}`
|
40
|
+
project_plugin_path = File.join project_path, '.ps_project', 'plugins'
|
41
|
+
`ln -s '#{self.class.plugin_path}' '#{project_plugin_path}'`
|
42
|
+
@tmp_project_path = project_path
|
43
|
+
end
|
44
|
+
|
45
|
+
def temporary_project_cmd(params)
|
46
|
+
"power_stencil #{params} --project-path '#{tmp_project_path}'"
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -1,10 +1,30 @@
|
|
1
1
|
RSpec.describe <%= plugin_module_name %> do
|
2
|
+
|
3
|
+
include PowerStencilTests::Project
|
4
|
+
temporary_project 'test_project', scope: :all
|
5
|
+
|
6
|
+
let(:plugin_list) { 'plugin --list' }
|
7
|
+
let(:test_entity) { '<%= plugin_name %>_entity/test_<%= plugin_name %>' }
|
8
|
+
let(:create_<%= plugin_name %>) { "create #{test_entity}" }
|
9
|
+
let(:get_<%= plugin_name %>) { "get #{test_entity}" }
|
10
|
+
|
2
11
|
it 'has a version number' do
|
3
12
|
expect(<%= plugin_module_name %>::VERSION).not_to be nil
|
4
13
|
end
|
5
14
|
|
6
|
-
it '
|
15
|
+
it 'should add a "<%= plugin_name %>" sub-command' do
|
16
|
+
expect(`#{temporary_project_cmd plugin_list}`).to match '- <%= plugin_name %>'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should be possible to create a "<%= plugin_name %>_entity"' do
|
20
|
+
`#{temporary_project_cmd create_<%= plugin_name %>}`
|
21
|
+
expect($?.success?).to be_truthy
|
22
|
+
expect(`#{temporary_project_cmd get_<%= plugin_name %>}`).not_to be_empty
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should do something useful' do
|
7
26
|
pending 'Tests implementation'
|
8
27
|
RSpec.fail
|
9
28
|
end
|
29
|
+
|
10
30
|
end
|
@@ -16,6 +16,9 @@ See [official website][PowerStencil site].
|
|
16
16
|
- [What is a PowerStencil plugin ?](#what-is-a-powerstencil-plugin-)
|
17
17
|
- [Using this plugin in your `PowerStencil` projects](#using-this-plugin-in-your-powerstencil-projects)
|
18
18
|
- [Goal of this plugin](#goal-of-this-plugin)
|
19
|
+
- [Plugin dependencies](#plugin-dependencies)
|
20
|
+
- [Standard gems dependencies](#standard-gems-dependencies)
|
21
|
+
- [Dependency to other plugins](#dependency-to-other-plugins)
|
19
22
|
- [Plugin capabilities](#plugin-capabilities)
|
20
23
|
- [Config](#config)
|
21
24
|
- [Subcommands and options](#subcommands-and-options)
|
@@ -66,9 +69,22 @@ And then you may see information about the plugin by running:
|
|
66
69
|
* `power_stencil info` in the plugins section.
|
67
70
|
* `power_stencil plugin --list -v`
|
68
71
|
|
69
|
-
#
|
72
|
+
# Goal of this plugin
|
70
73
|
|
71
|
-
#
|
74
|
+
# Plugin dependencies
|
75
|
+
|
76
|
+
## Standard gems dependencies
|
77
|
+
|
78
|
+
Standard dependencies are declared normally in the _gemspec file_. They are automatically installed when installing the plugin with `power_stencil plugin --install`.
|
79
|
+
|
80
|
+
## Dependency to other plugins
|
81
|
+
|
82
|
+
For development purpose, dependency to other plugins are declared in the _gemspec file_ as _development dependency_.
|
83
|
+
|
84
|
+
But within a project, dependencies have to be added to the `:project_plugins` array in the project configuration file (`.ps_project/versioned-config.yaml`).
|
85
|
+
|
86
|
+
|
87
|
+
# Plugin capabilities
|
72
88
|
|
73
89
|
This plugin provides the following features:
|
74
90
|
|
@@ -78,13 +94,12 @@ This plugin provides the following features:
|
|
78
94
|
|
79
95
|
## Post-build actions
|
80
96
|
|
81
|
-
##
|
97
|
+
## DSL in templates and in `power_stencil shell`
|
82
98
|
|
83
99
|
## Entity types
|
84
100
|
|
85
101
|
## Templates-templates
|
86
102
|
|
87
|
-
|
88
103
|
# Contributing
|
89
104
|
|
90
105
|
Bug reports and pull requests are welcome on Gitlab at https://gitlab.com/tools4devops/psplugins/<%= plugin_name %>/issues. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module PowerStencilTests
|
2
|
+
|
3
|
+
module Project
|
4
|
+
|
5
|
+
TEMP_DIR_PREFIX = 'PS_TESTS_'
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
|
9
|
+
|
10
|
+
def temporary_project(project_name, with_git_support: false, scope: :all)
|
11
|
+
self.instance_eval do
|
12
|
+
puts scope
|
13
|
+
around(scope) do |execution|
|
14
|
+
Dir.mktmpdir(TEMP_DIR_PREFIX) do |tests_root_dir|
|
15
|
+
tmp_project_path = File.join tests_root_dir, project_name
|
16
|
+
create_project_including_this_plugin tmp_project_path, with_git_support: with_git_support
|
17
|
+
execution.run
|
18
|
+
@tmp_project_path = nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def plugin_path
|
25
|
+
File.expand_path File.join('..', '..'), __FILE__
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
attr_reader :tmp_project_path
|
31
|
+
|
32
|
+
def self.included(base)
|
33
|
+
base.extend(ClassMethods)
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_project_including_this_plugin(project_path, with_git_support: false)
|
37
|
+
cmd = "power_stencil init --project-path '#{project_path}'"
|
38
|
+
cmd << ' --no-git' unless with_git_support
|
39
|
+
`#{cmd}`
|
40
|
+
project_plugin_path = File.join project_path, '.ps_project', 'plugins'
|
41
|
+
`ln -s '#{self.class.plugin_path}' '#{project_plugin_path}'`
|
42
|
+
@tmp_project_path = project_path
|
43
|
+
end
|
44
|
+
|
45
|
+
def temporary_project_cmd(params)
|
46
|
+
"power_stencil #{params} --project-path '#{tmp_project_path}'"
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -1,10 +1,30 @@
|
|
1
1
|
RSpec.describe <%= plugin_module_name %> do
|
2
|
+
|
3
|
+
include PowerStencilTests::Project
|
4
|
+
temporary_project 'test_project', scope: :all
|
5
|
+
|
6
|
+
let(:plugin_list) { 'plugin --list' }
|
7
|
+
let(:test_entity) { '<%= plugin_name %>_entity/test_<%= plugin_name %>' }
|
8
|
+
let(:create_<%= plugin_name %>) { "create #{test_entity}" }
|
9
|
+
let(:get_<%= plugin_name %>) { "get #{test_entity}" }
|
10
|
+
|
2
11
|
it 'has a version number' do
|
3
12
|
expect(<%= plugin_module_name %>::VERSION).not_to be nil
|
4
13
|
end
|
5
14
|
|
6
|
-
it '
|
15
|
+
it 'should add a "<%= plugin_name %>" sub-command' do
|
16
|
+
expect(`#{temporary_project_cmd plugin_list}`).to match '- <%= plugin_name %>'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should be possible to create a "<%= plugin_name %>_entity"' do
|
20
|
+
`#{temporary_project_cmd create_<%= plugin_name %>}`
|
21
|
+
expect($?.success?).to be_truthy
|
22
|
+
expect(`#{temporary_project_cmd get_<%= plugin_name %>}`).not_to be_empty
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should do something useful' do
|
7
26
|
pending 'Tests implementation'
|
8
27
|
RSpec.fail
|
9
28
|
end
|
29
|
+
|
10
30
|
end
|
@@ -41,8 +41,8 @@ module PowerStencil
|
|
41
41
|
end
|
42
42
|
puts_and_logs "Generated templates in '#{new_entity.templates_path}'.", check_verbose: false if new_entity.buildable?
|
43
43
|
rescue => e
|
44
|
-
puts_and_logs "Failed to create '#{search_criterion.as_path}' with message '#{e.message}'.", logs_as: :error, check_verbose: false
|
45
44
|
logger.debug PowerStencil::Error.report_error(e)
|
45
|
+
raise PowerStencil::Error, "Failed to create '#{search_criterion.as_path}' with message '#{e.message}'."
|
46
46
|
end
|
47
47
|
end
|
48
48
|
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.9.
|
4
|
+
version: 0.9.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-11-
|
11
|
+
date: 2019-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -183,6 +183,7 @@ files:
|
|
183
183
|
- etc/meta_templates/plugin_seed/lib/{entity}/version.rb.erb
|
184
184
|
- etc/meta_templates/plugin_seed/lib/{entity}/{entity}_processor.rb.erb
|
185
185
|
- etc/meta_templates/plugin_seed/psplugin_{entity}.gemspec
|
186
|
+
- etc/meta_templates/plugin_seed/spec/project_helper.rb
|
186
187
|
- etc/meta_templates/plugin_seed/spec/spec_helper.rb
|
187
188
|
- etc/meta_templates/plugin_seed/spec/{entity}_spec.rb
|
188
189
|
- etc/power_stencil.yaml
|
@@ -210,6 +211,7 @@ files:
|
|
210
211
|
- etc/templates/plugin_definition/lib/{entity}/version.rb.erb
|
211
212
|
- etc/templates/plugin_definition/lib/{entity}/{entity}_processor.rb.erb
|
212
213
|
- etc/templates/plugin_definition/psplugin_{entity}.gemspec
|
214
|
+
- etc/templates/plugin_definition/spec/project_helper.rb
|
213
215
|
- etc/templates/plugin_definition/spec/spec_helper.rb
|
214
216
|
- etc/templates/plugin_definition/spec/{entity}_spec.rb
|
215
217
|
- etc/templates/project/.copy_ignore
|
@@ -321,7 +323,7 @@ metadata:
|
|
321
323
|
documentation_uri: https://gitlab.com/tools4devops/power_stencil/blob/master/README.md
|
322
324
|
source_code_uri: https://gitlab.com/tools4devops/power_stencil
|
323
325
|
homepage_uri: https://powerstencil.brizone.org/
|
324
|
-
post_install_message: "\nThank you for installing PowerStencil 0.9.
|
326
|
+
post_install_message: "\nThank you for installing PowerStencil 0.9.1 !\nFrom the command
|
325
327
|
line you can run `power_stencil --help`\nIf your shell is not completing the command:\n
|
326
328
|
\ If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nOfficial Website
|
327
329
|
\ : https://powerstencil.brizone.org/\nFull documentation here : https://gitlab.com/tools4devops/power_stencil/blob/master/README.md\nFeel
|