power_stencil 0.4.1 → 0.4.2
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/dsl/entities.rb +27 -1
- data/lib/power_stencil/engine/entities_handling.rb +3 -1
- data/lib/power_stencil/system_entity_definitions/entity_project_common.rb +2 -2
- data/lib/power_stencil/system_entity_definitions/non_persistent.rb +1 -1
- data/lib/power_stencil/system_entity_definitions/simple_exec.rb +3 -3
- data/lib/power_stencil/utils/file_edit.rb +1 -1
- data/lib/power_stencil/version.rb +1 -1
- data/power_stencil.gemspec +2 -2
- metadata +5 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 397ae8708dcf83c49787aa22e1ef23360c136ba7
|
4
|
+
data.tar.gz: b504e3d431b71a01f70a1315e20122bce6ba0681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65dc07d1a0b556782f3a3b67bb8d430084b6ed6cd35bf9c9e7764d5a9d8e2d51dabf49a5392ba07cbb2e1a0fa224dd981b4503f37fb9b5ef5ded0394c367c042
|
7
|
+
data.tar.gz: ace8effec5fd7ed0d4fe8401917e71f245f074853093fff4dbb5768917d4e3351553e7abd0d24e708844c0e98c90e2ce13776dfd08aebb8b941ffa804400c7b8
|
@@ -13,10 +13,36 @@ module PowerStencil
|
|
13
13
|
e.nil? ? entity(type.to_sym, name) : e
|
14
14
|
end
|
15
15
|
|
16
|
-
def entity(
|
16
|
+
def entity(type_or_path, name = nil)
|
17
|
+
type, name = if name.nil?
|
18
|
+
md = type_or_path.match /^(?<type>[^\/]+)\/(?<name>.*)$/
|
19
|
+
if md
|
20
|
+
[md['type'].to_sym, md['name']]
|
21
|
+
else
|
22
|
+
raise PowerStencil::Error, "Invalid entity id: '#{type_or_path}'"
|
23
|
+
end
|
24
|
+
else
|
25
|
+
[type_or_path, name]
|
26
|
+
end
|
17
27
|
PowerStencil.project.engine.entity type, name, @universe
|
18
28
|
end
|
19
29
|
|
30
|
+
# Need to implement a `replace` method which would rename files before...
|
31
|
+
# def edit_entity(type, name)
|
32
|
+
# tmp = Object.new
|
33
|
+
# tmp.extend PowerStencil::Utils::FileEdit
|
34
|
+
# org = entity(type, name)
|
35
|
+
# unless org.nil?
|
36
|
+
# mod = tmp.securely_edit_entity entity(type, name)
|
37
|
+
# raise PowerStencil::Error "You cannot "
|
38
|
+
#
|
39
|
+
#
|
40
|
+
# universe = org.universe
|
41
|
+
# universe.delete org
|
42
|
+
# universe.add mod
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
|
20
46
|
def entities(criterion: nil, value: nil, &filter_block)
|
21
47
|
PowerStencil.project.engine.entities @universe, criterion: criterion, value: value, &filter_block
|
22
48
|
end
|
@@ -45,8 +45,10 @@ module PowerStencil
|
|
45
45
|
def delete_entity(work_universe, type, name, delete_files: false)
|
46
46
|
entity_to_delete = work_universe.get_entity type, name
|
47
47
|
get_user_confirmation prompt: "Are you sure you want delete '#{[type, name].join '/'}' ?" do
|
48
|
+
work_universe.delete(entity_to_delete).each do |impacted_entity, _|
|
49
|
+
impacted_entity.save raise_error: false, force_save: true
|
50
|
+
end
|
48
51
|
entity_to_delete.delete force_files_deletion: delete_files
|
49
|
-
entity_to_delete.universe = nil
|
50
52
|
entity_to_delete
|
51
53
|
end
|
52
54
|
end
|
@@ -3,8 +3,8 @@ module PowerStencil
|
|
3
3
|
|
4
4
|
module EntityProjectCommon
|
5
5
|
|
6
|
-
|
7
|
-
super(
|
6
|
+
def save(uri = source_uri, raise_error: true, force_save: false, force_files_generation: false )
|
7
|
+
super(source_uri, raise_error: raise_error, force_save: force_save)
|
8
8
|
unless PowerStencil.project.entity_type_templates[type].nil?
|
9
9
|
PowerStencil.project.generate_entity_dir_for_entity self, force: force_files_generation
|
10
10
|
end
|
@@ -26,10 +26,10 @@ module PowerStencil
|
|
26
26
|
super(raise_error: raise_error)
|
27
27
|
end
|
28
28
|
|
29
|
-
def save(uri = source_uri, force_files_generation: false)
|
30
|
-
valid?
|
29
|
+
def save(uri = source_uri, raise_error: true, force_save: false, force_files_generation: false )
|
30
|
+
valid? raise_error: raise_error
|
31
31
|
self.post_process.save
|
32
|
-
super
|
32
|
+
super
|
33
33
|
end
|
34
34
|
|
35
35
|
def delete(force_files_deletion: false)
|
@@ -25,7 +25,7 @@ module PowerStencil
|
|
25
25
|
def securely_edit_entity(entity, &modifications_validation_block)
|
26
26
|
initial_uri = entity.source_uri
|
27
27
|
modified_entity = nil
|
28
|
-
Tempfile.create([entity.type.to_s
|
28
|
+
Tempfile.create(["#{entity.type.to_s}_#{entity.name.to_s}", '.yaml']) do |tmpfile|
|
29
29
|
tmpfile.puts entity.to_yaml
|
30
30
|
tmpfile.flush
|
31
31
|
securely_edit_file(tmpfile, &modifications_validation_block)
|
data/power_stencil.gemspec
CHANGED
@@ -25,9 +25,9 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
26
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
27
|
|
28
|
-
spec.add_dependency 'climatic', '~> 0.2
|
28
|
+
spec.add_dependency 'climatic', '~> 0.2.29'
|
29
29
|
spec.add_dependency 'dir_glob_ignore', '~> 0.3'
|
30
|
-
spec.add_dependency 'universe_compiler', '~> 0.3.
|
30
|
+
spec.add_dependency 'universe_compiler', '~> 0.3.9'
|
31
31
|
spec.add_dependency 'pry'
|
32
32
|
|
33
33
|
spec.post_install_message = %Q{
|
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.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent B.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -57,9 +57,6 @@ dependencies:
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.2'
|
62
|
-
- - ">="
|
63
60
|
- !ruby/object:Gem::Version
|
64
61
|
version: 0.2.29
|
65
62
|
type: :runtime
|
@@ -67,9 +64,6 @@ dependencies:
|
|
67
64
|
version_requirements: !ruby/object:Gem::Requirement
|
68
65
|
requirements:
|
69
66
|
- - "~>"
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: '0.2'
|
72
|
-
- - ">="
|
73
67
|
- !ruby/object:Gem::Version
|
74
68
|
version: 0.2.29
|
75
69
|
- !ruby/object:Gem::Dependency
|
@@ -92,20 +86,14 @@ dependencies:
|
|
92
86
|
requirements:
|
93
87
|
- - "~>"
|
94
88
|
- !ruby/object:Gem::Version
|
95
|
-
version: 0.3.
|
96
|
-
- - ">="
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
version: 0.3.2
|
89
|
+
version: 0.3.9
|
99
90
|
type: :runtime
|
100
91
|
prerelease: false
|
101
92
|
version_requirements: !ruby/object:Gem::Requirement
|
102
93
|
requirements:
|
103
94
|
- - "~>"
|
104
95
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0.3.
|
106
|
-
- - ">="
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
version: 0.3.2
|
96
|
+
version: 0.3.9
|
109
97
|
- !ruby/object:Gem::Dependency
|
110
98
|
name: pry
|
111
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -265,7 +253,7 @@ homepage: https://gitlab.com/tools4devops/power_stencil
|
|
265
253
|
licenses:
|
266
254
|
- MIT
|
267
255
|
metadata: {}
|
268
|
-
post_install_message: "\nThank you for installing PowerStencil 0.4.
|
256
|
+
post_install_message: "\nThank you for installing PowerStencil 0.4.2 !\nFrom the command
|
269
257
|
line you can run `power_stencil --help`\nIf your shell is not completing the command:\n
|
270
258
|
\ If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nFull documentation
|
271
259
|
here : https://gitlab.com/tools4devops/power_stencil/blob/master/README.md\nFeel
|