power_stencil 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/power_stencil.rb +1 -0
- data/lib/power_stencil/command_processors/create.rb +11 -7
- data/lib/power_stencil/command_processors/entity_helper.rb +4 -8
- data/lib/power_stencil/dsl/entities.rb +3 -3
- data/lib/power_stencil/engine/project_engine.rb +1 -1
- data/lib/power_stencil/initializer.rb +3 -3
- data/lib/power_stencil/plugins/base.rb +1 -1
- data/lib/power_stencil/plugins/capabilities.rb +1 -1
- data/lib/power_stencil/utils/entity_helper.rb +35 -0
- data/lib/power_stencil/version.rb +1 -1
- data/power_stencil.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ab7d833b0c353a7f1a1d1cd240bd89b7e1d6920
|
4
|
+
data.tar.gz: 61a22b0e88f7fe4072f241619174a231407e52e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5754fd517225f6b0f17100e9129a7eb55b1be226cffeec5f69b4f16fbc26755d7911137d7cfef9d7a408d12cd0aceff13bcda261e707a622574b853e41f8c8a8
|
7
|
+
data.tar.gz: 26ffefc937dd522b7c8834f31d4d2a06fc3800e6576a4f5512878396956ddf49f25723bad7ea24ab0458b75493554ec1a711a4e58bc9ba2dc9d394d3c3a647ee
|
data/lib/power_stencil.rb
CHANGED
@@ -21,6 +21,7 @@ require 'power_stencil/utils/gem_utils'
|
|
21
21
|
require 'power_stencil/utils/file_edit'
|
22
22
|
require 'power_stencil/utils/graphviz'
|
23
23
|
require 'power_stencil/utils/completion'
|
24
|
+
require 'power_stencil/utils/entity_helper'
|
24
25
|
|
25
26
|
require 'climatic/script/unimplemented_processor'
|
26
27
|
require 'power_stencil/project/proxy'
|
@@ -19,15 +19,19 @@ module PowerStencil
|
|
19
19
|
if md = property_def.match(/^\s*(?<prop_name>[^:=]+)\s*[:=]\s*(?<prop_val>.*)\s*$/)
|
20
20
|
property_value = md['prop_val']
|
21
21
|
logger.debug "Using extra properties from command line '#{md['prop_name']}' = '#{property_value}'"
|
22
|
-
if
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
if pd = property_value.match(/^\s*!entity\s+(?<entity_id>.+)\s*$/)
|
23
|
+
property_value = pd['entity_id']
|
24
|
+
esr = PowerStencil::Utils::EntityHelper::EntitySearchReference.from_string property_value
|
25
|
+
if esr
|
26
|
+
type, name = esr.to_a
|
27
|
+
referenced_entity = project.engine.entity(type, name)
|
28
|
+
property_value = referenced_entity.to_reference unless referenced_entity.nil?
|
29
|
+
puts_and_logs "Could not find entity '#{type.to_s}/#{name}' !", logs_as: :error, check_verbose: false if referenced_entity.nil?
|
30
|
+
end
|
28
31
|
end
|
29
|
-
|
30
32
|
entity_as_hash[md['prop_name'].to_sym] = property_value
|
33
|
+
|
34
|
+
|
31
35
|
else
|
32
36
|
raise PowerStencil::Error, "Invalid command line property definition: '#{property_def}'"
|
33
37
|
end
|
@@ -3,11 +3,7 @@ module PowerStencil
|
|
3
3
|
|
4
4
|
module EntityHelper
|
5
5
|
|
6
|
-
|
7
|
-
def as_path
|
8
|
-
[type, name].map(&:to_s).join '/'
|
9
|
-
end
|
10
|
-
end
|
6
|
+
include PowerStencil::Utils::EntityHelper
|
11
7
|
|
12
8
|
def describe_entity_types(entity_types)
|
13
9
|
report = {}
|
@@ -132,9 +128,9 @@ module PowerStencil
|
|
132
128
|
criteria = stack
|
133
129
|
else
|
134
130
|
stack.each do |param|
|
135
|
-
|
136
|
-
|
137
|
-
|
131
|
+
esr = EntitySearchReference.from_string param
|
132
|
+
if esr
|
133
|
+
esr.fill next_entity_reference
|
138
134
|
else
|
139
135
|
if next_entity_reference.type.nil? or next_entity_reference.type.empty?
|
140
136
|
next_entity_reference.type = param.to_sym
|
@@ -19,9 +19,9 @@ module PowerStencil
|
|
19
19
|
|
20
20
|
def entity(type_or_path, name = nil)
|
21
21
|
type, name = if name.nil?
|
22
|
-
|
23
|
-
if
|
24
|
-
|
22
|
+
esr = PowerStencil::Utils::EntityHelper::EntitySearchReference.from_string type_or_path
|
23
|
+
if esr
|
24
|
+
esr.to_a
|
25
25
|
else
|
26
26
|
raise PowerStencil::Error, "Invalid entity id: '#{type_or_path}'"
|
27
27
|
end
|
@@ -17,12 +17,12 @@ module PowerStencil
|
|
17
17
|
logger.debug 'Starting PowerStencil initialization...'
|
18
18
|
setup_system_processors
|
19
19
|
setup_universe_compiler_logger
|
20
|
-
|
20
|
+
project fail_on_error: false
|
21
21
|
logger.debug 'PowerStencil initialization complete'
|
22
22
|
end
|
23
23
|
|
24
|
-
def project
|
25
|
-
@project ||= try_to_load_project
|
24
|
+
def project(fail_on_error: true)
|
25
|
+
@project ||= try_to_load_project fail_on_error: fail_on_error
|
26
26
|
end
|
27
27
|
|
28
28
|
private
|
@@ -19,7 +19,7 @@ module PowerStencil
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def
|
22
|
+
def determine_capabilities
|
23
23
|
yaml_file = plugin_capabilities_definition_file
|
24
24
|
unless File.exists? yaml_file and File.file? yaml_file and File.readable? yaml_file
|
25
25
|
raise PowerStencil::Error, "Plugin '#{self.name}' has no definition file !"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module PowerStencil
|
2
|
+
module Utils
|
3
|
+
|
4
|
+
module EntityHelper
|
5
|
+
|
6
|
+
EntitySearchReference = Struct.new(:type, :name) do
|
7
|
+
|
8
|
+
def self.from_string(string)
|
9
|
+
if md = string.match(/^\s*(?<type>[^\/]+)\/\s*(?<name>.+)\s*$/)
|
10
|
+
return new md[:type].to_sym, md[:name]
|
11
|
+
end
|
12
|
+
|
13
|
+
false
|
14
|
+
end
|
15
|
+
|
16
|
+
def as_path
|
17
|
+
to_a.map(&:to_s).join '/'
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_a
|
21
|
+
[type, name]
|
22
|
+
end
|
23
|
+
|
24
|
+
def fill(something)
|
25
|
+
something.type = type
|
26
|
+
something.name = name
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
data/power_stencil.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
|
28
28
|
spec.add_dependency 'climatic', '~> 0.2.35'
|
29
29
|
spec.add_dependency 'dir_glob_ignore', '~> 0.3'
|
30
|
-
spec.add_dependency 'universe_compiler', '~> 0.5.
|
30
|
+
spec.add_dependency 'universe_compiler', '~> 0.5.6'
|
31
31
|
spec.add_dependency 'pry'
|
32
32
|
spec.add_dependency 'git' , '~> 1.5.0'
|
33
33
|
spec.add_dependency 'haml', '~> 5.1.2'
|
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.7
|
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-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.5.
|
89
|
+
version: 0.5.6
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.5.
|
96
|
+
version: 0.5.6
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: pry
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -310,6 +310,7 @@ files:
|
|
310
310
|
- lib/power_stencil/utils/completion.rb
|
311
311
|
- lib/power_stencil/utils/dependency_solver.rb
|
312
312
|
- lib/power_stencil/utils/directory_processor.rb
|
313
|
+
- lib/power_stencil/utils/entity_helper.rb
|
313
314
|
- lib/power_stencil/utils/file_edit.rb
|
314
315
|
- lib/power_stencil/utils/file_helper.rb
|
315
316
|
- lib/power_stencil/utils/gem_utils.rb
|
@@ -328,7 +329,7 @@ metadata:
|
|
328
329
|
documentation_uri: https://gitlab.com/tools4devops/power_stencil/blob/master/README.md
|
329
330
|
source_code_uri: https://gitlab.com/tools4devops/power_stencil
|
330
331
|
homepage_uri: https://powerstencil.brizone.org/
|
331
|
-
post_install_message: "\nThank you for installing PowerStencil 0.9.
|
332
|
+
post_install_message: "\nThank you for installing PowerStencil 0.9.7 !\nFrom the command
|
332
333
|
line you can run `power_stencil --help`\nIf your shell is not completing the command:\n
|
333
334
|
\ If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nOfficial Website
|
334
335
|
\ : https://powerstencil.brizone.org/\nFull documentation here : https://gitlab.com/tools4devops/power_stencil/blob/master/README.md\nFeel
|