power_stencil 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c8c69b2dc3cdadebcdf0899978842ccf2fe9759
4
- data.tar.gz: 7381be842bd05452ba6c71f8e6cffb417eb4d9eb
3
+ metadata.gz: 7f0c8423324989df34f6a82f3d94876049918c72
4
+ data.tar.gz: cbc370533eacc74d7ab8c3c827c9ac491d233294
5
5
  SHA512:
6
- metadata.gz: efe862901f45e4c0df84304f5aa41ddf5985f898e85b73d3d8ebe1822478007c59eadb72fcce2adb73dddc0b8394bb4c15899478485e34fcdf50d849dfccad66
7
- data.tar.gz: ed7abb218f9551d5bc5732016874db6e34375a2581fdc2b4b69cdff3663af5d1baeb80114b48b35c35cccf1e104dbc0a369a33aef5c21b18bcddbbdfde00b452
6
+ metadata.gz: df40c5459e352c58ebb6bd8da2c737c21fdb41f09bb4ec9c52f11fdbb2f9fa6d8f75282f9fb16981970625929e594e62e4bd51b8516db7517ee338383bc8210f
7
+ data.tar.gz: 9490d7ac9be83f7b6993ff201d0ab72f1cc5baa7701a4edfe7dfc81e6bca6d082dc01193cac35bf5ed75d28428629aed806e80b049f838440e3b924bcefb197c
@@ -23,7 +23,7 @@ module <%= plugin_module_name %>
23
23
  puts File.readlines(generated_file)
24
24
  end
25
25
  else
26
- raise PowerStencil::Error, 'Plugin <%= plugin_name %> doesnt know how handle the build of a <%= plugin_name %>_entity entity type !'
26
+ raise PowerStencil::Error, "Plugin '<%= plugin_name %>' doesnt know how handle the build of a '#{built_entity.type}' type !"
27
27
  end
28
28
  end
29
29
 
@@ -23,7 +23,7 @@ module <%= plugin_module_name %>
23
23
  puts File.readlines(generated_file)
24
24
  end
25
25
  else
26
- raise PowerStencil::Error, 'Plugin <%= plugin_name %> doesnt know how handle the build of a <%= plugin_name %>_entity entity type !'
26
+ raise PowerStencil::Error, "Plugin '<%= plugin_name %>' doesnt know how handle the build of a '#{built_entity.type}' type !"
27
27
  end
28
28
  end
29
29
 
@@ -21,7 +21,7 @@ module PowerStencil
21
21
  source_provider = entity_class.entity_type_source_provider
22
22
  source_provider_display = if source_provider == PowerStencil
23
23
  "'#{source_provider.name}'"
24
- elsif source_provider == project
24
+ elsif source_provider.is_a? project.class
25
25
  "project '#{source_provider.name}'"
26
26
  elsif source_provider.is_a? PowerStencil::Plugins::Base
27
27
  "plugin '#{source_provider.name}'"
@@ -27,7 +27,7 @@ module PowerStencil
27
27
  source_provider = entity.class.entity_type_source_provider
28
28
  source_provider_display = if source_provider == PowerStencil
29
29
  "'#{source_provider.name}'"
30
- elsif source_provider == project
30
+ elsif source_provider.is_a? project.class
31
31
  "project '#{source_provider.name}'"
32
32
  elsif source_provider.is_a? PowerStencil::Plugins::Base
33
33
  "plugin '#{source_provider.name}'"
@@ -1,3 +1,5 @@
1
+ require 'power_stencil/project/require_entity_definitions'
2
+
1
3
  module PowerStencil
2
4
  module Engine
3
5
 
@@ -21,30 +23,41 @@ module PowerStencil
21
23
  next
22
24
  end
23
25
  # This is a ruby library or there is something wrong
24
- securely_require_with_entity_class_detection file_or_dir, source
25
26
 
27
+ # securely_require_with_entity_class_detection file_or_dir, source
28
+ securely_require_with_entity_class_detection(source) do
29
+ securely_require file_or_dir, fail_on_error: true
30
+ end
31
+
32
+ end
33
+ required_files.sort!.each do |file|
34
+ securely_require_with_entity_class_detection source do
35
+ securely_require file, fail_on_error: true
36
+ end
26
37
  end
27
- required_files.sort!.each { |file| securely_require_with_entity_class_detection file, source }
28
38
  required_files
29
39
  end
30
40
 
31
41
  private
32
42
 
43
+ include PowerStencil::Project::RequireEntityDefinition
44
+
33
45
  def load_system_entities_definition
34
46
  require_definition_files [SYSTEM_ENTITY_DEFINITION_ENTRY_POINT], PowerStencil
35
47
  end
36
48
 
37
- def securely_require_with_entity_class_detection(entity_definition_file_path, source)
38
- before = PowerStencil::Engine::EntitiesHandling.all_types
39
- securely_require entity_definition_file_path, fail_on_error: true
40
- after = PowerStencil::Engine::EntitiesHandling.all_types
41
- after.reject { |k, _| before.keys.include? k }
42
- .each do |_, plugin_entity_class|
43
- plugin_entity_class.instance_eval do
44
- @entity_type_source_provider = source
45
- end
46
- end
47
- end
49
+ # def securely_require_with_entity_class_detection(entity_definition_file_path, source)
50
+ # before = PowerStencil::Engine::EntitiesHandling.all_types
51
+ # securely_require entity_definition_file_path, fail_on_error: true
52
+ # after = PowerStencil::Engine::EntitiesHandling.all_types
53
+ # after.reject { |k, _| before.keys.include? k }
54
+ # .each do |_, plugin_entity_class|
55
+ # plugin_entity_class.instance_eval do
56
+ # @entity_type_source_provider = source
57
+ # end
58
+ # end
59
+ # end
60
+
48
61
  end
49
62
 
50
63
  end
@@ -1,3 +1,5 @@
1
+ require 'power_stencil/project/require_entity_definitions'
2
+
1
3
  module PowerStencil
2
4
  module Plugins
3
5
 
@@ -6,25 +8,17 @@ module PowerStencil
6
8
  def require_plugin_entity_definitions
7
9
  return unless capabilities[:entity_definitions]
8
10
  logger.info "Requiring '#{self.name}' plugin entity definitions..."
9
- securely_require_with_entity_class_detection
10
- end
11
+ securely_require_with_entity_class_detection(self) do
12
+ plugin_definition[:entity_definitions].each do |entity_definition_file_path|
13
+ securely_require entity_definition_file_path, fail_on_error: true
14
+ end
15
+ end
11
16
 
17
+ end
12
18
 
13
19
  private
14
20
 
15
- def securely_require_with_entity_class_detection
16
- before = PowerStencil::Engine::EntitiesHandling.all_types
17
- plugin_definition[:entity_definitions].each do |entity_definition_file_path|
18
- securely_require entity_definition_file_path, fail_on_error: true
19
- end
20
- after = PowerStencil::Engine::EntitiesHandling.all_types
21
- after.reject { |k, _| before.keys.include? k }.each do |_, plugin_entity_class|
22
- plugin = self
23
- plugin_entity_class.instance_eval do
24
- @entity_type_source_provider = plugin
25
- end
26
- end
27
- end
21
+ include PowerStencil::Project::RequireEntityDefinition
28
22
 
29
23
  end
30
24
 
@@ -9,6 +9,7 @@ require 'power_stencil/project/templates'
9
9
  require 'power_stencil/project/plugins'
10
10
  require 'power_stencil/project/git'
11
11
  require 'power_stencil/project/completion'
12
+ require 'power_stencil/project/require_entity_definitions'
12
13
 
13
14
  require 'power_stencil/engine/project_engine'
14
15
  require 'power_stencil/engine/entity_engine'
@@ -64,7 +64,7 @@ module PowerStencil
64
64
  source_provider = klass.entity_type_source_provider
65
65
  source_provider_display = if source_provider == PowerStencil
66
66
  "'#{source_provider.name}'"
67
- elsif source_provider == self
67
+ elsif source_provider.is_a? self.class
68
68
  "project '#{source_provider.name}'"
69
69
  elsif source_provider.is_a? PowerStencil::Plugins::Base
70
70
  "plugin '#{source_provider.name}'"
@@ -0,0 +1,21 @@
1
+ module PowerStencil
2
+ module Project
3
+
4
+ module RequireEntityDefinition
5
+
6
+ def securely_require_with_entity_class_detection(source, &block)
7
+ before = PowerStencil::Engine::EntitiesHandling.all_types
8
+ yield
9
+ after = PowerStencil::Engine::EntitiesHandling.all_types
10
+ after.reject { |k, _| before.keys.include? k }.each do |_, defined_entity_class|
11
+ provider = source
12
+ defined_entity_class.instance_eval do
13
+ @entity_type_source_provider = provider
14
+ end
15
+ end
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module PowerStencil
2
- VERSION = '0.9.4'.freeze
2
+ VERSION = '0.9.5'.freeze
3
3
  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
4
+ version: 0.9.5
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-14 00:00:00.000000000 Z
11
+ date: 2019-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -288,6 +288,7 @@ files:
288
288
  - lib/power_stencil/project/paths.rb
289
289
  - lib/power_stencil/project/plugins.rb
290
290
  - lib/power_stencil/project/proxy.rb
291
+ - lib/power_stencil/project/require_entity_definitions.rb
291
292
  - lib/power_stencil/project/templates.rb
292
293
  - lib/power_stencil/project/versioning.rb
293
294
  - lib/power_stencil/system_entity_definitions/all.rb
@@ -327,7 +328,7 @@ metadata:
327
328
  documentation_uri: https://gitlab.com/tools4devops/power_stencil/blob/master/README.md
328
329
  source_code_uri: https://gitlab.com/tools4devops/power_stencil
329
330
  homepage_uri: https://powerstencil.brizone.org/
330
- post_install_message: "\nThank you for installing PowerStencil 0.9.4 !\nFrom the command
331
+ post_install_message: "\nThank you for installing PowerStencil 0.9.5 !\nFrom the command
331
332
  line you can run `power_stencil --help`\nIf your shell is not completing the command:\n
332
333
  \ If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nOfficial Website
333
334
  \ : https://powerstencil.brizone.org/\nFull documentation here : https://gitlab.com/tools4devops/power_stencil/blob/master/README.md\nFeel