ansible_make_role 0.7.7 → 0.7.8
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/ansible_make_role.rb +13 -16
- data/lib/ansible_make_role/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fe8e24d4a2a257d19e11b2ca0758a63a13b0508fb30275c3a070d5f69ba156b
|
4
|
+
data.tar.gz: 76624736cd47411c67168b84f2557097f7bad6e32b709ceb887f80e3ba5e8181
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b79115eb6a4a34d75f4fc949d29ac1a3b2f32d822b218e280390a7d88429cf925c4e7f30c1173d9212686e6d61b1eae3a5b1233b2284e3cbddaf125e0a25ea91
|
7
|
+
data.tar.gz: '018970b8bd8de8cfe0840cc7a49cc413b6564b4e0d52232137a3385da7f5fb2640733fd2bd73669b4287446015674751ecb708d675dee971983a31af3610f634'
|
data/lib/ansible_make_role.rb
CHANGED
@@ -19,22 +19,19 @@ module AnsibleMakeRole
|
|
19
19
|
def self.git=(value) @git = value end
|
20
20
|
|
21
21
|
def self.make(role_dir)
|
22
|
+
changed = false
|
22
23
|
wrap_system_call_error {
|
23
24
|
role_file = "#{role_dir}/#{ROLE_FILE_NAME}"
|
24
25
|
meta_file = "#{role_dir}/meta/main.yml"
|
26
|
+
git_file = "#{role_dir}/.gitignore"
|
25
27
|
if force || !File.exist?(meta_file) || File.mtime(role_file) > File.mtime(meta_file)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
FileUtils.rm_f(git_file)
|
30
|
-
if !files.empty?
|
31
|
-
lines = files.map { |f| "./" + f.split("/")[-2..-1].join("/") + "\n" }.join
|
32
|
-
IO.write(git_file, lines)
|
33
|
-
end
|
28
|
+
if !compile_role(role_file, role_dir).empty?
|
29
|
+
IO.write(git_file, "*/main.yml\n") if git
|
30
|
+
changed = true
|
34
31
|
end
|
35
|
-
true
|
36
32
|
end
|
37
33
|
}
|
34
|
+
return changed
|
38
35
|
end
|
39
36
|
|
40
37
|
def self.clean(role_dir)
|
@@ -94,21 +91,21 @@ private
|
|
94
91
|
end
|
95
92
|
}
|
96
93
|
|
97
|
-
|
98
|
-
|
99
|
-
|
94
|
+
if meta.all? { |l| l =~ /^\s*$/ }
|
95
|
+
meta = ["dependencies: []"]
|
96
|
+
end
|
97
|
+
|
98
|
+
(sections.to_a + [["meta", meta]]).map { |section, lines|
|
100
99
|
next if lines.all? { |l| l =~ /^\s*$/ }
|
101
100
|
dir = "#{target}/#{section}"
|
102
101
|
file = "#{dir}/main.yml"
|
103
|
-
generated_files << file
|
104
|
-
|
105
102
|
FileUtils.mkdir_p(dir)
|
106
103
|
File.open(file, "w") { |f|
|
107
104
|
f.puts "---" if section != "meta"
|
108
105
|
unindent(lines).each { |l| f.puts l }
|
109
106
|
}
|
110
|
-
|
111
|
-
|
107
|
+
file
|
108
|
+
}.compact
|
112
109
|
end
|
113
110
|
|
114
111
|
# Unindent lines by the indentation of the first non-comment and non-blank
|