knife-undev 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/knife/undev/converter.rb +16 -2
- data/lib/knife/undev/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee3859bb9ebaf13604c3dea0ee4cecbd92a85901
|
4
|
+
data.tar.gz: 6450b2a74accd0842836ed86880b0ab2c3326c19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f6a58475ff094de062036cb32d8b520f58a72c3dc0b7ffcd239a321d13302b5e764dcc08ff8fffdfcd35d1b786d165b194963d946945b0e89e4169b3c0194b6
|
7
|
+
data.tar.gz: 114eb0fe6aa65640d0aa9a94f100f79c2332680133dbcf3dc4746d463471f64dfae420162f6751578efd23b22740c1ba9ba6d139dc648d7d6b4b4fdd18c4b035
|
@@ -9,6 +9,7 @@ module Knife
|
|
9
9
|
def initialize(filename, klass = 'role')
|
10
10
|
@filename = filename
|
11
11
|
@klass = klass
|
12
|
+
@comment_counter = 0
|
12
13
|
end
|
13
14
|
|
14
15
|
def to_yml
|
@@ -24,6 +25,10 @@ module Knife
|
|
24
25
|
hash.delete(key) if hash[key].nil? || hash[key].empty?
|
25
26
|
end
|
26
27
|
|
28
|
+
def comment(hash, value='')
|
29
|
+
hash["#comment_#{@comment_counter+=1}"] = ""
|
30
|
+
end
|
31
|
+
|
27
32
|
def role_to_yml
|
28
33
|
r = Chef::Role.new
|
29
34
|
r.from_file(@filename)
|
@@ -35,8 +40,15 @@ module Knife
|
|
35
40
|
safe_delete(hash, 'run_list')
|
36
41
|
result_hash['name'] = hash.delete('name')
|
37
42
|
result_hash['description'] = hash.delete('description')
|
43
|
+
comment(result_hash)
|
38
44
|
result_hash['env_run_lists'] = hash.delete('env_run_lists')
|
39
|
-
|
45
|
+
comment(result_hash)
|
46
|
+
result_hash.merge(hash).to_yaml.each_line do |line|
|
47
|
+
puts '' if line.match /#comment_\d+/
|
48
|
+
next if line.match /#comment_\d+/
|
49
|
+
next if line == '---'
|
50
|
+
puts line
|
51
|
+
end
|
40
52
|
end
|
41
53
|
|
42
54
|
def env_to_yml
|
@@ -49,7 +61,9 @@ module Knife
|
|
49
61
|
safe_delete(hash, 'default_attributes')
|
50
62
|
safe_delete(hash, 'cookbook_versions')
|
51
63
|
safe_delete(hash, 'description')
|
52
|
-
|
64
|
+
hash.to_yaml.each_line do |line|
|
65
|
+
next if line == '---'
|
66
|
+
end
|
53
67
|
end
|
54
68
|
|
55
69
|
end
|
data/lib/knife/undev/version.rb
CHANGED