power_stencil 0.6.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +2 -0
  3. data/README.md +3 -7
  4. data/doc/entities.md +8 -8
  5. data/doc/images/power-stencil-entity-creation.svg +247 -114
  6. data/doc/templates.md +22 -18
  7. data/etc/base_commands_definition.yml +14 -0
  8. data/etc/power_stencil.yaml +7 -1
  9. data/etc/templates/project/.zzzgitignore.erb +8 -3
  10. data/lib/power_stencil.rb +1 -0
  11. data/lib/power_stencil/command_processors/create.rb +6 -5
  12. data/lib/power_stencil/command_processors/delete.rb +23 -15
  13. data/lib/power_stencil/command_processors/edit.rb +4 -2
  14. data/lib/power_stencil/command_processors/plugin.rb +6 -2
  15. data/lib/power_stencil/command_processors/shell.rb +10 -3
  16. data/lib/power_stencil/dsl/entities.rb +0 -16
  17. data/lib/power_stencil/engine/entities_handling.rb +1 -1
  18. data/lib/power_stencil/engine/project_engine.rb +5 -9
  19. data/lib/power_stencil/plugins/templates.rb +2 -2
  20. data/lib/power_stencil/project/base.rb +15 -12
  21. data/lib/power_stencil/project/create.rb +23 -2
  22. data/lib/power_stencil/project/git.rb +75 -0
  23. data/lib/power_stencil/project/info.rb +1 -1
  24. data/lib/power_stencil/project/paths.rb +22 -6
  25. data/lib/power_stencil/project/plugins.rb +1 -1
  26. data/lib/power_stencil/project/templates.rb +15 -22
  27. data/lib/power_stencil/system_entity_definitions/all.rb +1 -1
  28. data/lib/power_stencil/system_entity_definitions/buildable.rb +1 -1
  29. data/lib/power_stencil/system_entity_definitions/entity_override.rb +5 -0
  30. data/lib/power_stencil/system_entity_definitions/entity_project_common.rb +12 -4
  31. data/lib/power_stencil/system_entity_definitions/{has_associated_files.rb → entity_templates.rb} +2 -2
  32. data/lib/power_stencil/system_entity_definitions/project_config.rb +1 -1
  33. data/lib/power_stencil/system_entity_definitions/project_entity.rb +6 -0
  34. data/lib/power_stencil/system_entity_definitions/simple_exec.rb +2 -2
  35. data/lib/power_stencil/version.rb +1 -1
  36. data/power_stencil.gemspec +1 -0
  37. metadata +19 -4
@@ -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 located in a directory `<entity_type>/<entity_name>/`. 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). This is what is called `templates-templates`.
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,20 +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
- Created 'simple_exec/demo_templates'
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'
47
- - Templates path : '/tmp/tst3/simple_exec/demo_templates'
48
+ - Templates path : '/tmp/tst3/templates/simple_exec/demo_templates'
48
49
  - Status : Valid
49
50
  - Buildable : true
50
51
  ```
51
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.
52
53
 
53
- 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:
54
55
 
55
56
  ```shell
56
57
  $ ls -l simple_exec/demo_templates
@@ -79,14 +80,14 @@ End of process 15572
79
80
 
80
81
  What can we see there ?
81
82
 
82
- 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`...
83
84
  And by the way the generated script seems to have been run, as we can see in the output.
84
85
 
85
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.
86
87
 
87
- 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 !!**
88
89
 
89
- 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:
90
91
 
91
92
  ```shell
92
93
  #!/usr/bin/env bash
@@ -123,7 +124,7 @@ echo "It was done in the scope of 'demo_templates' (which is of the type 'simple
123
124
 
124
125
  The content has been "de-templated"... :+1: sooo cool !
125
126
 
126
- :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).
127
128
 
128
129
  # What can I do within templates ?
129
130
 
@@ -176,7 +177,7 @@ This should be self explanatory, there is another part that could be displayed i
176
177
 
177
178
  # Where do I create templates ?
178
179
 
179
- **When an entity is [buildable] you can find its templates in the `<entity_type>/<entity_name>` from the root of the project.**
180
+ **When an entity is [buildable] you can find its templates in the `templates/<entity_type>/<entity_name>` from the root of the project.**
180
181
 
181
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...
182
183
 
@@ -189,7 +190,7 @@ $ power_stencil info
189
190
  .
190
191
  .
191
192
  .
192
- - 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.2.18/etc/templates/simple_exec')
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'
193
194
  ```
194
195
 
195
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 !
@@ -200,7 +201,7 @@ To summarize about templates and _templates-templates_:
200
201
 
201
202
  ![entity-creation-flow]
202
203
 
203
- :information_source: 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...
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...
204
205
 
205
206
  # Creating templates-templates of your own
206
207
 
@@ -231,20 +232,21 @@ Let's now create an entity of this type:
231
232
 
232
233
  ```shell
233
234
  $ power_stencil create custom_buildable_entity/test1
234
- Created 'custom_buildable_entity/test1'
235
+ Creating 'custom_buildable_entity/test1'...
236
+ Generated templates in '/tmp/tst3/templates/custom_buildable_entity/test1'.
235
237
 
236
- $ ll custom_buildable_entity/test1
238
+ $ ll templates/custom_buildable_entity/test1
237
239
  total 12
238
240
  drwxrwxr-x 2 laurent laurent 4096 août 26 13:40 ./
239
241
  drwxrwxr-x 3 laurent laurent 4096 août 26 13:40 ../
240
242
  -rw-rw-r-- 1 laurent laurent 26 août 26 13:40 a_useless_text_file.txt
241
243
  ```
242
- Everything, seems ok. The entity `custom_buildable_entity/test1` has been created and there is now a new folder at the root of the project named `custom_buildable_entity/test1` and which content is a text file named `a_useless_text_file.txt`... So far so good.
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.
243
245
 
244
246
  And what is the content of this file ?
245
247
 
246
248
  ```shell
247
- $ cat custom_buildable_entity/test1/a_useless_text_file.txt
249
+ $ cat templates/custom_buildable_entity/test1/a_useless_text_file.txt
248
250
  This text has been generated on the 2019-08-26 13:50:35 +0200
249
251
 
250
252
  Lorem ipsum dolor sit amet, consectetur adipiscing elit,
@@ -309,15 +311,16 @@ Et voilà, let's verify:
309
311
 
310
312
  ```shell
311
313
  $ power_stencil create custom_buildable_entity/test2
312
- Created 'custom_buildable_entity/test2'
314
+ Creating 'custom_buildable_entity/test2'...
315
+ Generated templates in '/tmp/tst3/templates/custom_buildable_entity/test2'.
313
316
 
314
- $ ls -la custom_buildable_entity/test2
317
+ $ ls -la templates/custom_buildable_entity/test2
315
318
  total 12
316
319
  drwxrwxr-x 2 laurent laurent 4096 août 26 18:37 .
317
320
  drwxrwxr-x 4 laurent laurent 4096 août 26 18:37 ..
318
321
  -rw-rw-r-- 1 laurent laurent 148 août 26 18:37 a_useless_text_file.txt
319
322
 
320
- $ cat custom_buildable_entity/test2/a_useless_text_file.txt
323
+ $ cat templates/custom_buildable_entity/test2/a_useless_text_file.txt
321
324
  This text has been generated on the <%= Time.now %>
322
325
 
323
326
  Lorem ipsum dolor sit amet, consectetur adipiscing elit,
@@ -352,6 +355,7 @@ Flawless victory !!
352
355
  [buildable]: entities.md#buildable-and-buildable_by "How to make an entity buildable ?"
353
356
  [entity field]: entities.md#field "How to access basic entity data"
354
357
  [reverse methods]: entities.md#has_one "Check reverse methods"
358
+ [unversioned]: entities.md#local-unversioned-entities "Unversioned/developer entities"
355
359
  <!-- Code links -->
356
360
 
357
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: |
@@ -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] %>
@@ -1,6 +1,7 @@
1
1
  require 'power_stencil/version'
2
2
 
3
3
  require 'universe_compiler'
4
+ require 'git'
4
5
  require 'dir_glob_ignore'
5
6
 
6
7
  $DO_NOT_AUTOSTART_CLIMATIC=true
@@ -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.save
40
-
41
- puts "Created '#{new_entity.as_path}'"
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
- puts "Failed to create '#{search_criterion.as_path}' with message '#{e.message}'."
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.each do |search_criterion|
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 *search_criterion.to_a, project.engine.root_universe
15
- puts_and_logs "Skipping '#{search_criterion.as_path}'. Entity not found.", check_verbose: false
16
- next
17
- end
18
- puts_and_logs "Deleting entity '#{search_criterion.as_path}'", check_verbose: false
19
- if project.engine.delete_entity project.engine.root_universe,
20
- *search_criterion.to_a,
21
- delete_files: config[:'delete-files']
22
- msg = "Deleted '#{search_criterion.as_path}'"
23
- msg << ' and associated files.' if config[:'delete-files']
24
- puts_and_logs msg, check_verbose: false
25
- else
26
- puts_and_logs 'Cancelled by user input.', check_verbose: false
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 '#{search_criterion.as_path}' with message '#{e.message}'.", logs_as: :error, check_verbose: false
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
- securely_edit_file target.source_uri do |modified_path, _|
16
- modifications_valid? modified_path, target
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
@@ -44,8 +44,12 @@ module PowerStencil
44
44
  config.command_line_layer.extra_parameters.each do |plugin_name|
45
45
  begin
46
46
  target_path = File.join project.project_local_plugin_path(plugin_name)
47
- project.create_new_local_plugin_tree plugin_name, target_path
48
- puts "Generated new plugin '#{plugin_name}'"
47
+ msg = "Generated new local plugin '#{plugin_name}'."
48
+ project.track_action_with_git(msg) do
49
+ project.create_new_local_plugin_tree plugin_name, target_path
50
+ puts_and_logs msg, check_verbose: false
51
+ end
52
+
49
53
  rescue => e
50
54
  msg = "Could not create plugin '#{plugin_name}' because '#{e.message}'"
51
55
  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
- Pry.start context,
29
- prompt: [proc { config[:shell_dsl][:prompt_level_1] }, proc { config[:shell_dsl][:prompt_level_2] }],
30
- quiet: true
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
@@ -59,7 +59,7 @@ module PowerStencil
59
59
  raise PowerStencil::Error, "Unknown entity type: '#{type}'"
60
60
  end
61
61
  fields[:name] = fields[:name].to_s
62
- res = @available_entities_hash[type.to_sym].new fields: fields, universe: work_universe
62
+ res = @available_entities_hash[type.to_sym].new fields: fields, universe: work_universe, user: user
63
63
  logger.debug "Created new '#{type}': \n#{fields.to_yaml}"
64
64
  work_universe.add res
65
65
  if work_universe == PowerStencil.project.engine.root_universe
@@ -62,24 +62,20 @@ module PowerStencil
62
62
  end
63
63
 
64
64
  def load_project_entities
65
- logger.debug 'Loading project entities - NOT IMPLEMENTED'
66
65
  root_universe.import project.project_entities_path, stop_on_error: false do |new_entity|
67
- process_entity new_entity
66
+ logger.debug "Loaded entity: '#{new_entity.as_path}'"
68
67
  end
69
68
  end
70
69
 
71
70
  def load_user_entities
72
- logger.debug 'Loading user entities - NOT IMPLEMENTED'
73
71
  root_universe.import project.user_entities_path, stop_on_error: false do |new_entity|
74
- process_entity new_entity
72
+ logger.debug "Loaded unversioned entity: '#{new_entity.as_path}'"
73
+ new_entity.instance_eval do
74
+ @is_versioned_entity = false
75
+ end
75
76
  end
76
77
  end
77
78
 
78
- def process_entity(entity)
79
- logger.debug "New entity: '#{entity.name}' (#{entity.type})"
80
- end
81
-
82
-
83
79
  end
84
80
 
85
81
  end
@@ -3,7 +3,7 @@ module PowerStencil
3
3
 
4
4
  module Templates
5
5
 
6
- def register_plugin_templates
6
+ def register_plugin_templates_templates
7
7
  return unless capabilities[:templates]
8
8
  logger.info "Loading '#{self.name}' plugin templates..."
9
9
  plugin_definition[:templates].each do |templates_path|
@@ -11,7 +11,7 @@ module PowerStencil
11
11
  Dir.entries(plugin_templates_path).reject { |e| %w(. ..).include? e }.each do |entry|
12
12
  template_path = File.join(plugin_templates_path, entry)
13
13
  if Dir.exist? template_path
14
- project.register_template_path_for_type entry.to_sym, template_path
14
+ project.register_template_template_path_for_type entry.to_sym, template_path
15
15
  end
16
16
  end
17
17
  end
@@ -5,6 +5,7 @@ require 'power_stencil/project/versioning'
5
5
  require 'power_stencil/project/info'
6
6
  require 'power_stencil/project/templates'
7
7
  require 'power_stencil/project/plugins'
8
+ require 'power_stencil/project/git'
8
9
 
9
10
  require 'power_stencil/engine/project_engine'
10
11
  require 'power_stencil/engine/entity_engine'
@@ -30,6 +31,7 @@ module PowerStencil
30
31
  include PowerStencil::Project::Templates
31
32
  include PowerStencil::Project::Plugins
32
33
  include PowerStencil::Project::Info
34
+ include PowerStencil::Project::Git
33
35
  extend PowerStencil::Project::Create
34
36
 
35
37
  attr_reader :engine, :entity_engine
@@ -44,38 +46,39 @@ module PowerStencil
44
46
  check_project_version
45
47
  bootstrap_plugins
46
48
  build_engines
47
- register_system_templates
48
- register_plugins_templates
49
- register_project_templates
49
+ register_system_templates_templates
50
+ register_plugins_templates_templates
51
+ register_project_templates_templates
52
+ setup_git_tracking
50
53
  end
51
54
 
52
55
  private
53
56
 
54
- def register_plugins_templates
57
+ def register_plugins_templates_templates
55
58
  plugins.each do |_, plugin|
56
- plugin.register_plugin_templates
59
+ plugin.register_plugin_templates_templates
57
60
  end
58
61
  end
59
62
 
60
63
 
61
- def register_project_templates
62
- dir = project_templates_path
64
+ def register_project_templates_templates
65
+ dir = project_templates_templates_path
63
66
  if Dir.exist? dir and File.readable? dir
64
67
  logger.info 'Registering project specific templates.'
65
68
  Dir.entries(dir).each do |potential_entity_type|
66
69
  next if potential_entity_type.match /^\./
67
70
  template_dir = File.join(dir, potential_entity_type)
68
71
  next unless File.directory? template_dir
69
- register_template_path_for_type potential_entity_type.to_sym, template_dir
72
+ register_template_template_path_for_type potential_entity_type.to_sym, template_dir
70
73
  end
71
74
  end
72
75
  end
73
76
 
74
- def register_system_templates
77
+ def register_system_templates_templates
75
78
  logger.debug 'Registering system templates'
76
79
  %i(plugin_definition simple_exec).each do |template_name|
77
- template_path = template_path template_name
78
- register_template_path_for_type template_name, template_path
80
+ template_path = system_template_template_path template_name
81
+ register_template_template_path_for_type template_name, template_path
79
82
  end
80
83
  end
81
84
 
@@ -88,4 +91,4 @@ module PowerStencil
88
91
  end
89
92
 
90
93
  end
91
- end
94
+ end