power_stencil 0.6.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +2 -0
- data/README.md +3 -7
- data/doc/builds.md +10 -1
- data/doc/entities.md +59 -50
- data/doc/images/power-stencil-entity-creation.svg +247 -114
- data/doc/plugins.md +1 -0
- data/doc/templates.md +23 -18
- data/etc/base_commands_definition.yml +14 -0
- data/etc/power_stencil.yaml +7 -1
- data/etc/templates/project/.zzzgitignore.erb +8 -3
- data/lib/power_stencil.rb +1 -0
- data/lib/power_stencil/command_processors/build.rb +15 -2
- data/lib/power_stencil/command_processors/check.rb +12 -0
- data/lib/power_stencil/command_processors/create.rb +6 -5
- data/lib/power_stencil/command_processors/delete.rb +23 -15
- data/lib/power_stencil/command_processors/edit.rb +4 -2
- data/lib/power_stencil/command_processors/plugin.rb +21 -6
- data/lib/power_stencil/command_processors/shell.rb +10 -3
- data/lib/power_stencil/dsl/entities.rb +0 -16
- data/lib/power_stencil/engine/entities_definitions.rb +16 -7
- data/lib/power_stencil/engine/entities_handling.rb +1 -1
- data/lib/power_stencil/engine/project_engine.rb +6 -10
- data/lib/power_stencil/initializer.rb +4 -7
- data/lib/power_stencil/plugins/entity_definitions.rb +15 -0
- data/lib/power_stencil/plugins/require.rb +1 -0
- data/lib/power_stencil/plugins/templates.rb +3 -3
- data/lib/power_stencil/project/base.rb +24 -9
- data/lib/power_stencil/project/create.rb +23 -2
- data/lib/power_stencil/project/git.rb +75 -0
- data/lib/power_stencil/project/info.rb +14 -1
- data/lib/power_stencil/project/paths.rb +22 -6
- data/lib/power_stencil/project/plugins.rb +1 -1
- data/lib/power_stencil/project/templates.rb +15 -22
- data/lib/power_stencil/system_entity_definitions/all.rb +2 -1
- data/lib/power_stencil/system_entity_definitions/buildable.rb +1 -1
- data/lib/power_stencil/system_entity_definitions/entity_override.rb +6 -0
- data/lib/power_stencil/system_entity_definitions/entity_project_common.rb +13 -5
- data/lib/power_stencil/system_entity_definitions/{has_associated_files.rb → entity_templates.rb} +2 -2
- data/lib/power_stencil/system_entity_definitions/project_config.rb +1 -1
- data/lib/power_stencil/system_entity_definitions/project_entity.rb +7 -0
- data/lib/power_stencil/system_entity_definitions/simple_exec.rb +3 -3
- data/lib/power_stencil/system_entity_definitions/source_provider.rb +15 -0
- data/lib/power_stencil/version.rb +1 -1
- data/power_stencil.gemspec +1 -0
- metadata +20 -4
data/doc/plugins.md
CHANGED
@@ -206,6 +206,7 @@ we can check using `power_stencil check myplugin_entity/test`:
|
|
206
206
|
$ power_stencil check myplugin_entity/test
|
207
207
|
'myplugin_entity/test':
|
208
208
|
- Storage path : '/tmp/demo/.ps_project/entities/myplugin_entity/test.yaml'
|
209
|
+
- Provided by : plugin 'myplugin'
|
209
210
|
- Templates path : '/tmp/demo/myplugin_entity/test'
|
210
211
|
- Status : Valid
|
211
212
|
- Buildable : true
|
data/doc/templates.md
CHANGED
@@ -27,7 +27,7 @@ The default templating engine being [ERB], your templates should be written usin
|
|
27
27
|
|
28
28
|
Templates are always associated to some [buildable entities][buildable].
|
29
29
|
|
30
|
-
When a [buildable entity][buildable] has some templates associated, they will be
|
30
|
+
When a [buildable entity][buildable] has some templates associated, they will be initially generated in a directory `templates/<entity_type>/<entity_name>/` (unless they are [unversioned]). For some entity types, when you will create a new entity of this type, some default templates will be created in that directory (this is the case of the `simple_exec` entity type as you will see in the next paragraph) from some kind of "_meta-templates_". This is what is called `templates-templates` in `PowerStencil`.
|
31
31
|
|
32
32
|
In this document, you will learn how to create your own templates, as well as your own templates-templates.
|
33
33
|
|
@@ -37,19 +37,21 @@ In the basic entity types, the only one providing default templates is the `simp
|
|
37
37
|
|
38
38
|
```shell
|
39
39
|
$ power_stencil create simple_exec/demo_templates
|
40
|
-
|
40
|
+
Creating 'simple_exec/demo_templates'...
|
41
|
+
Generated templates in '/tmp/tst3/templates/simple_exec/demo_templates'.
|
41
42
|
|
42
43
|
$ power_stencil check simple_exec/demo_templates
|
43
44
|
RAW ENTITIES
|
44
45
|
'simple_exec/demo_templates':
|
45
46
|
- Storage path : '/tmp/tst3/.ps_project/entities/simple_exec/demo_templates.yaml'
|
46
|
-
-
|
47
|
+
- Provided by : 'PowerStencil core'
|
48
|
+
- Templates path : '/tmp/tst3/templates/simple_exec/demo_templates'
|
47
49
|
- Status : Valid
|
48
50
|
- Buildable : true
|
49
51
|
```
|
50
52
|
As you can see the output of `power_stencil check` shows more information than entities we created so far. First we see that this entity is `buildable`, and we'll detail that in the [builds] document, but for the moment what we will focus on the `Templates path` information.
|
51
53
|
|
52
|
-
And it's true if we have a look in the `simple_exec/demo_templates/` directory from the root of the project, a file appeared there:
|
54
|
+
And it's true if we have a look in the `templates/simple_exec/demo_templates/` directory from the root of the project, a file appeared there:
|
53
55
|
|
54
56
|
```shell
|
55
57
|
$ ls -l simple_exec/demo_templates
|
@@ -78,14 +80,14 @@ End of process 15572
|
|
78
80
|
|
79
81
|
What can we see there ?
|
80
82
|
|
81
|
-
The first line is the most interesting one for us. It says "De-templating ... into ...", and it's true that a brand new directory named `build` appeared at the root of the project. Again we won't focus too much on the name of the sub-directory as we will see that in the [builds], but if we have a look in the generated directory we see the same content as what we had in `simple_exec/demo_templates`...
|
83
|
+
The first line is the most interesting one for us. It says "De-templating ... into ...", and it's true that a brand new directory named `build` appeared at the root of the project. Again we won't focus too much on the name of the sub-directory as we will see that in the [builds], but if we have a look in the generated directory we see the same content as what we had in `templates/simple_exec/demo_templates`...
|
82
84
|
And by the way the generated script seems to have been run, as we can see in the output.
|
83
85
|
|
84
86
|
:warning: If bash is not installed on your system, the output will obviously be different as `PowerStencil` won't be able to run the script, yet all the files should have been generated correctly.
|
85
87
|
|
86
|
-
Ok is it possible, that everything inside `simple_exec/demo_templates` is actually considered as templates ? **The answer is yes !!**
|
88
|
+
Ok is it possible, that everything inside `templates/simple_exec/demo_templates` is actually considered as templates ? **The answer is yes !!**
|
87
89
|
|
88
|
-
Let prove it and replace the content of `simple_exec/demo_templates/main.sh` by the following:
|
90
|
+
Let prove it and replace the content of `templates/simple_exec/demo_templates/main.sh` by the following:
|
89
91
|
|
90
92
|
```shell
|
91
93
|
#!/usr/bin/env bash
|
@@ -122,7 +124,7 @@ echo "It was done in the scope of 'demo_templates' (which is of the type 'simple
|
|
122
124
|
|
123
125
|
The content has been "de-templated"... :+1: sooo cool !
|
124
126
|
|
125
|
-
:information_source: Here the template directory of the `simple_exec/demo_templates` was containing only on file (the bash script), but **any file in any sub-directory of that directory would have been considered as a template** (yet there are some mechanism to control and limit which files have to be processed, like for example imagine there would be images, or zip files, probably you don't want them to be processed. All of this will be covered in the [builds] document).
|
127
|
+
:information_source: Here the template directory of the `simple_exec/demo_templates` entity was containing only on file (the bash script), but **any file in any sub-directory of that directory would have been considered as a template** (yet there are some mechanism to control and limit which files have to be processed, like for example imagine there would be images, or zip files, probably you don't want them to be processed. All of this will be covered in the [builds] document).
|
126
128
|
|
127
129
|
# What can I do within templates ?
|
128
130
|
|
@@ -175,7 +177,7 @@ This should be self explanatory, there is another part that could be displayed i
|
|
175
177
|
|
176
178
|
# Where do I create templates ?
|
177
179
|
|
178
|
-
**When an entity is [buildable] you can find its templates in the
|
180
|
+
**When an entity is [buildable] you can find its templates in the `templates/<entity_type>/<entity_name>` from the root of the project.**
|
179
181
|
|
180
182
|
But by default, that directory is not created, and if no templates is created at this place for a [buildable] entity, the build will fail saying it didn't find any template...
|
181
183
|
|
@@ -188,7 +190,7 @@ $ power_stencil info
|
|
188
190
|
.
|
189
191
|
.
|
190
192
|
.
|
191
|
-
- Type 'simple_exec' --> PowerStencil::SystemEntityDefinitions::SimpleExec (template-template path: '/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/power_stencil-0.
|
193
|
+
- Type 'simple_exec' --> PowerStencil::SystemEntityDefinitions::SimpleExec (provided by 'PowerStencil core') template-template path: '/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/power_stencil-0.6.3/etc/templates/simple_exec'
|
192
194
|
```
|
193
195
|
|
194
196
|
`simple_exec` is an entity type coming with `PowerStencil`, and you can see that it takes its _template-template_ from within the `PowerStencil` gem itself !
|
@@ -199,7 +201,7 @@ To summarize about templates and _templates-templates_:
|
|
199
201
|
|
200
202
|
![entity-creation-flow]
|
201
203
|
|
202
|
-
:information_source:
|
204
|
+
:information_source: As you can see, there is actually a third place where you could find entity types and _templates-templates_, this is within [plugins], but we will cover that in the [plugins] part...
|
203
205
|
|
204
206
|
# Creating templates-templates of your own
|
205
207
|
|
@@ -230,20 +232,21 @@ Let's now create an entity of this type:
|
|
230
232
|
|
231
233
|
```shell
|
232
234
|
$ power_stencil create custom_buildable_entity/test1
|
233
|
-
|
235
|
+
Creating 'custom_buildable_entity/test1'...
|
236
|
+
Generated templates in '/tmp/tst3/templates/custom_buildable_entity/test1'.
|
234
237
|
|
235
|
-
$ ll custom_buildable_entity/test1
|
238
|
+
$ ll templates/custom_buildable_entity/test1
|
236
239
|
total 12
|
237
240
|
drwxrwxr-x 2 laurent laurent 4096 août 26 13:40 ./
|
238
241
|
drwxrwxr-x 3 laurent laurent 4096 août 26 13:40 ../
|
239
242
|
-rw-rw-r-- 1 laurent laurent 26 août 26 13:40 a_useless_text_file.txt
|
240
243
|
```
|
241
|
-
Everything, seems ok. The entity `custom_buildable_entity/test1` has been created and there is now a new folder
|
244
|
+
Everything, seems ok. The entity `custom_buildable_entity/test1` has been created and there is now a new folder named `templates/custom_buildable_entity/test1` and which content is a text file named `a_useless_text_file.txt`... So far so good.
|
242
245
|
|
243
246
|
And what is the content of this file ?
|
244
247
|
|
245
248
|
```shell
|
246
|
-
$ cat custom_buildable_entity/test1/a_useless_text_file.txt
|
249
|
+
$ cat templates/custom_buildable_entity/test1/a_useless_text_file.txt
|
247
250
|
This text has been generated on the 2019-08-26 13:50:35 +0200
|
248
251
|
|
249
252
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
|
@@ -308,15 +311,16 @@ Et voilà, let's verify:
|
|
308
311
|
|
309
312
|
```shell
|
310
313
|
$ power_stencil create custom_buildable_entity/test2
|
311
|
-
|
314
|
+
Creating 'custom_buildable_entity/test2'...
|
315
|
+
Generated templates in '/tmp/tst3/templates/custom_buildable_entity/test2'.
|
312
316
|
|
313
|
-
$ ls -la custom_buildable_entity/test2
|
317
|
+
$ ls -la templates/custom_buildable_entity/test2
|
314
318
|
total 12
|
315
319
|
drwxrwxr-x 2 laurent laurent 4096 août 26 18:37 .
|
316
320
|
drwxrwxr-x 4 laurent laurent 4096 août 26 18:37 ..
|
317
321
|
-rw-rw-r-- 1 laurent laurent 148 août 26 18:37 a_useless_text_file.txt
|
318
322
|
|
319
|
-
$ cat custom_buildable_entity/test2/a_useless_text_file.txt
|
323
|
+
$ cat templates/custom_buildable_entity/test2/a_useless_text_file.txt
|
320
324
|
This text has been generated on the <%= Time.now %>
|
321
325
|
|
322
326
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
|
@@ -351,6 +355,7 @@ Flawless victory !!
|
|
351
355
|
[buildable]: entities.md#buildable-and-buildable_by "How to make an entity buildable ?"
|
352
356
|
[entity field]: entities.md#field "How to access basic entity data"
|
353
357
|
[reverse methods]: entities.md#has_one "Check reverse methods"
|
358
|
+
[unversioned]: entities.md#local-unversioned-entities "Unversioned/developer entities"
|
354
359
|
<!-- Code links -->
|
355
360
|
|
356
361
|
|
@@ -85,6 +85,12 @@
|
|
85
85
|
:summary: Forces creation in an already existing directory.
|
86
86
|
:short_aliases:
|
87
87
|
- f
|
88
|
+
no-git:
|
89
|
+
:type: bool
|
90
|
+
:summary: Do not initiate a git repo when creating a new project.
|
91
|
+
:long_aliases:
|
92
|
+
- ng
|
93
|
+
- nogit
|
88
94
|
info:
|
89
95
|
:banner: |
|
90
96
|
Generic information about the repository.
|
@@ -123,6 +129,14 @@
|
|
123
129
|
:incompatibilities:
|
124
130
|
- create
|
125
131
|
- list
|
132
|
+
no-git:
|
133
|
+
:type: bool
|
134
|
+
:summary: Do not include the newly created plugin into the repository.
|
135
|
+
:long_aliases:
|
136
|
+
- ng
|
137
|
+
- nogit
|
138
|
+
:dependencies:
|
139
|
+
- create
|
126
140
|
|
127
141
|
get:
|
128
142
|
:banner: |
|
data/etc/power_stencil.yaml
CHANGED
@@ -23,7 +23,7 @@
|
|
23
23
|
:unversioned_user_project_config_file_name: personal-config.yaml
|
24
24
|
# Entity definitions specific to the project
|
25
25
|
:project_entity_definitions_directory_name: entity_definitions
|
26
|
-
# Templates specific to the project
|
26
|
+
# Templates templates specific to the project
|
27
27
|
:project_templates_directory_name: templates-templates
|
28
28
|
# Directory name where entities are stored
|
29
29
|
:project_entities_directory_name: entities
|
@@ -33,6 +33,10 @@
|
|
33
33
|
:project_plugins_directory_name: plugins
|
34
34
|
# Root directory where builds are generated
|
35
35
|
:project_build_root_directory_name: build
|
36
|
+
# Versioned entities templates directory
|
37
|
+
:versioned_entities_templates_directory_name: templates
|
38
|
+
# Unversioned entities templates directory
|
39
|
+
:unversioned_user_entities_templates_directory_name: unversioned-templates
|
36
40
|
# Last build link name
|
37
41
|
:project_build_last_stable_path: last_build
|
38
42
|
# Previous build link name
|
@@ -108,4 +112,6 @@
|
|
108
112
|
:log-level: 2
|
109
113
|
# Maximum number of retries when editing a file
|
110
114
|
:max_file_edit_retry_times: 3
|
115
|
+
# Integration with git
|
116
|
+
:no-git: false
|
111
117
|
|
@@ -1,6 +1,11 @@
|
|
1
1
|
# Ignore power stencil generated files
|
2
|
-
<%= File.join '', project_config[:project_build_root_directory_name]
|
2
|
+
<%= File.join '', project_config[:project_build_root_directory_name] %>
|
3
|
+
|
3
4
|
# Ignore power stencil local entities created by developer
|
4
|
-
<%= File.join '', project_config[:default_config_directory_name], project_config[:user_entities_directory_name]
|
5
|
+
<%= File.join '', project_config[:default_config_directory_name], project_config[:user_entities_directory_name] %>
|
6
|
+
|
7
|
+
# Ignore power stencil local entities templates created by developer
|
8
|
+
<%= File.join '', project_config[:unversioned_user_entities_templates_directory_name] %>
|
9
|
+
|
5
10
|
# Ignore power stencil local developer's config
|
6
|
-
<%= File.join '', project_config[:default_config_directory_name], project_config[:unversioned_user_project_config_file_name]
|
11
|
+
<%= File.join '', project_config[:default_config_directory_name], project_config[:unversioned_user_project_config_file_name] %>
|
data/lib/power_stencil.rb
CHANGED
@@ -15,8 +15,21 @@ module PowerStencil
|
|
15
15
|
if config[:'supported-builds']
|
16
16
|
project.engine.available_entities_hash.select do |_, klass|
|
17
17
|
klass.respond_to?(:buildable?) and klass.buildable?
|
18
|
-
end .each do |entity_type,
|
19
|
-
|
18
|
+
end .each do |entity_type, entity_class|
|
19
|
+
builder = entity_class.buildable_by.empty? ? "'#{PowerStencil.name}'" : "plugin '#{entity_class.buildable_by}'"
|
20
|
+
|
21
|
+
source_provider = entity_class.entity_type_source_provider
|
22
|
+
source_provider_display = if source_provider == PowerStencil
|
23
|
+
"'#{source_provider.name}'"
|
24
|
+
elsif source_provider == project
|
25
|
+
"project '#{source_provider.name}'"
|
26
|
+
elsif source_provider.is_a? PowerStencil::Plugins::Base
|
27
|
+
"plugin '#{source_provider.name}'"
|
28
|
+
else
|
29
|
+
raise PowerStencil::Error, "Unidentified source provider for #{entity_class} !"
|
30
|
+
end
|
31
|
+
|
32
|
+
puts " - '#{entity_type}' (buildable by #{builder} and provided by #{source_provider_display})."
|
20
33
|
end
|
21
34
|
return
|
22
35
|
end
|
@@ -23,6 +23,18 @@ module PowerStencil
|
|
23
23
|
sorted_targets.map do |entity|
|
24
24
|
entity_info = [" '#{entity.as_path}':"]
|
25
25
|
entity_info << " - Storage path : '#{entity.source_uri}'"
|
26
|
+
|
27
|
+
source_provider = entity.class.entity_type_source_provider
|
28
|
+
source_provider_display = if source_provider == PowerStencil
|
29
|
+
"'#{source_provider.name}'"
|
30
|
+
elsif source_provider == project
|
31
|
+
"project '#{source_provider.name}'"
|
32
|
+
elsif source_provider.is_a? PowerStencil::Plugins::Base
|
33
|
+
"plugin '#{source_provider.name}'"
|
34
|
+
else
|
35
|
+
raise PowerStencil::Error, "Unidentified source provider for #{entity.class} !"
|
36
|
+
end
|
37
|
+
entity_info << " - Provided by : #{source_provider_display}"
|
26
38
|
entity_info << " - Templates path : '#{entity.templates_path}'" if entity.respond_to? :templates_path
|
27
39
|
entity_info << " - Status : #{entity.valid? ? 'Valid' : 'INVALID !'} "
|
28
40
|
entity_info << " - Buildable : #{entity.buildable?}"
|
@@ -12,7 +12,7 @@ module PowerStencil
|
|
12
12
|
def execute
|
13
13
|
analyse_extra_params.each do |search_criterion|
|
14
14
|
begin
|
15
|
-
puts_and_logs "Creating new entity '#{search_criterion.as_path}'", check_verbose: false
|
15
|
+
puts_and_logs "Creating new entity '#{search_criterion.as_path}'...", check_verbose: false
|
16
16
|
entity_as_hash = {name: search_criterion.name}
|
17
17
|
unless config[:property].nil?
|
18
18
|
config[:property].each do |property_def|
|
@@ -36,11 +36,12 @@ module PowerStencil
|
|
36
36
|
end
|
37
37
|
|
38
38
|
new_entity.valid? raise_error: true
|
39
|
-
new_entity.
|
40
|
-
|
41
|
-
|
39
|
+
project.track_action_with_git("Created '#{new_entity.as_path}' (and potential dependencies).") do
|
40
|
+
new_entity.save
|
41
|
+
end
|
42
|
+
puts_and_logs "Generated templates in '#{new_entity.templates_path}'.", check_verbose: false if new_entity.buildable?
|
42
43
|
rescue => e
|
43
|
-
|
44
|
+
puts_and_logs "Failed to create '#{search_criterion.as_path}' with message '#{e.message}'.", logs_as: :error, check_verbose: false
|
44
45
|
logger.debug PowerStencil::Error.report_error(e)
|
45
46
|
end
|
46
47
|
end
|
@@ -9,24 +9,32 @@ module PowerStencil
|
|
9
9
|
include PowerStencil::CommandProcessors::EntityHelper
|
10
10
|
|
11
11
|
def execute
|
12
|
-
analyse_extra_params.
|
12
|
+
targets = targets_from_criteria analyse_extra_params, project.engine.root_universe
|
13
|
+
targets.each do |target|
|
13
14
|
begin
|
14
|
-
unless project.engine.entity *
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
puts_and_logs "Deleting entity '#{
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
15
|
+
# unless project.engine.entity *target.to_a, project.engine.root_universe
|
16
|
+
# puts_and_logs "Skipping '#{target.as_path}'. Entity not found.", check_verbose: false
|
17
|
+
# next
|
18
|
+
# end
|
19
|
+
puts_and_logs "Deleting entity '#{target.as_path}'", check_verbose: false
|
20
|
+
|
21
|
+
msg = "Deleted entity '#{target.as_path}' (and potential dependencies)"
|
22
|
+
msg << ' including templates.' if config[:'delete-files']
|
23
|
+
msg << '.'
|
24
|
+
project.track_action_with_git(msg) do
|
25
|
+
if project.engine.delete_entity project.engine.root_universe,
|
26
|
+
target.type,
|
27
|
+
target.name,
|
28
|
+
delete_files: config[:'delete-files']
|
29
|
+
msg = "Deleted '#{target.as_path}'"
|
30
|
+
msg << ' and template files.' if config[:'delete-files']
|
31
|
+
puts_and_logs msg, check_verbose: false
|
32
|
+
else
|
33
|
+
puts_and_logs 'Cancelled by user input.', check_verbose: false
|
34
|
+
end
|
27
35
|
end
|
28
36
|
rescue => e
|
29
|
-
puts_and_logs "Failed to delete '#{
|
37
|
+
puts_and_logs "Failed to delete '#{target.as_path}' with message '#{e.message}'.", logs_as: :error, check_verbose: false
|
30
38
|
logger.debug PowerStencil::Error.report_error(e)
|
31
39
|
end
|
32
40
|
end
|
@@ -12,8 +12,10 @@ module PowerStencil
|
|
12
12
|
def execute
|
13
13
|
targets = targets_from_criteria analyse_extra_params, project.engine.root_universe
|
14
14
|
targets.each do |target|
|
15
|
-
|
16
|
-
|
15
|
+
project.track_action_with_git("Edited entity '#{target.as_path}'.") do
|
16
|
+
securely_edit_file target.source_uri do |modified_path, _|
|
17
|
+
modifications_valid? modified_path, target
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -10,11 +10,22 @@ module PowerStencil
|
|
10
10
|
def execute
|
11
11
|
|
12
12
|
if config[:install]
|
13
|
+
begin
|
14
|
+
project
|
15
|
+
rescue
|
16
|
+
# Do not check errors. This is just to load project config...
|
17
|
+
logger.debug "Project config loaded"
|
18
|
+
end
|
19
|
+
if config[:project_plugins].empty?
|
20
|
+
puts_and_logs "No plugins declared... Check your config file.", check_verbose: false
|
21
|
+
return
|
22
|
+
end
|
13
23
|
config[:project_plugins].each do |plugin_definition|
|
14
24
|
gem_name, gem_req = PowerStencil::Plugins::Base.plugin_definition_to_name_and_req plugin_definition
|
25
|
+
logger.debug "Trying to install plugin '#{gem_name}'..."
|
15
26
|
specs = PowerStencil::Plugins::Base.install_gem gem_name, gem_req
|
16
27
|
spec = specs.first
|
17
|
-
|
28
|
+
puts_and_logs "Installed plugin '#{spec.name}' (version: #{spec.version})", check_verbose: false
|
18
29
|
end
|
19
30
|
return
|
20
31
|
end
|
@@ -25,10 +36,10 @@ module PowerStencil
|
|
25
36
|
else
|
26
37
|
puts "#{project.plugins.size} plugin#{project.plugins.size == 1 ? '' : 's'} found to be used in this project."
|
27
38
|
end
|
28
|
-
project.plugins.each do |
|
29
|
-
puts " - #{
|
39
|
+
project.plugins.each do |_, plugin|
|
40
|
+
puts " - #{plugin.name} (in '#{plugin.plugin_path}')"
|
30
41
|
if config[:verbose]
|
31
|
-
|
42
|
+
plugin.capabilities.each do |name, value|
|
32
43
|
puts " #{name}: #{value}"
|
33
44
|
end
|
34
45
|
end
|
@@ -44,8 +55,12 @@ module PowerStencil
|
|
44
55
|
config.command_line_layer.extra_parameters.each do |plugin_name|
|
45
56
|
begin
|
46
57
|
target_path = File.join project.project_local_plugin_path(plugin_name)
|
47
|
-
|
48
|
-
|
58
|
+
msg = "Generated new local plugin '#{plugin_name}'."
|
59
|
+
project.track_action_with_git(msg) do
|
60
|
+
project.create_new_local_plugin_tree plugin_name, target_path
|
61
|
+
puts_and_logs msg, check_verbose: false
|
62
|
+
end
|
63
|
+
|
49
64
|
rescue => e
|
50
65
|
msg = "Could not create plugin '#{plugin_name}' because '#{e.message}'"
|
51
66
|
puts msg
|
@@ -8,6 +8,7 @@ module PowerStencil
|
|
8
8
|
include Climatic::Proxy
|
9
9
|
include PowerStencil::Project::Proxy
|
10
10
|
|
11
|
+
|
11
12
|
def execute
|
12
13
|
|
13
14
|
working_universe = if config[:compiled]
|
@@ -25,9 +26,15 @@ module PowerStencil
|
|
25
26
|
puts config[:shell_dsl][:session_greetings]
|
26
27
|
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
msg = 'Changes done in PowerStencil shell session.'
|
30
|
+
project.track_action_with_git(msg,
|
31
|
+
user_validation_required: true,
|
32
|
+
validation_message: 'Would you like to commit your changes ?',
|
33
|
+
show_files_to_commit: true) do
|
34
|
+
Pry.start context,
|
35
|
+
prompt: [proc { config[:shell_dsl][:prompt_level_1] }, proc { config[:shell_dsl][:prompt_level_2] }],
|
36
|
+
quiet: true
|
37
|
+
end
|
31
38
|
|
32
39
|
end
|
33
40
|
|
@@ -31,22 +31,6 @@ module PowerStencil
|
|
31
31
|
PowerStencil.project.engine.entity type, name, @universe
|
32
32
|
end
|
33
33
|
|
34
|
-
# Need to implement a `replace` method which would rename files before...
|
35
|
-
# def edit_entity(type, name)
|
36
|
-
# tmp = Object.new
|
37
|
-
# tmp.extend PowerStencil::Utils::FileEdit
|
38
|
-
# org = entity(type, name)
|
39
|
-
# unless org.nil?
|
40
|
-
# mod = tmp.securely_edit_entity entity(type, name)
|
41
|
-
# raise PowerStencil::Error "You cannot "
|
42
|
-
#
|
43
|
-
#
|
44
|
-
# universe = org.universe
|
45
|
-
# universe.delete org
|
46
|
-
# universe.add mod
|
47
|
-
# end
|
48
|
-
# end
|
49
|
-
|
50
34
|
def entities(criterion: nil, value: nil, &filter_block)
|
51
35
|
PowerStencil.project.engine.entities @universe, criterion: criterion, value: value, &filter_block
|
52
36
|
end
|