ansible_make_role 0.7.7 → 0.7.8

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
  SHA256:
3
- metadata.gz: 2a22c1c0e2cf8ffbf1acb934620f80e2d9393364d0de685476e9ca3ef5bf9969
4
- data.tar.gz: def88d2a7e22f7f434dd0cf317dbfb9270a6a2f2b887c92a2c513d56bc57b90c
3
+ metadata.gz: 8fe8e24d4a2a257d19e11b2ca0758a63a13b0508fb30275c3a070d5f69ba156b
4
+ data.tar.gz: 76624736cd47411c67168b84f2557097f7bad6e32b709ceb887f80e3ba5e8181
5
5
  SHA512:
6
- metadata.gz: b62ac0ca21d319b957048bcbfd829681613500eb2a5efca56b2e1f35c6b350a0dc28823e499288a77394b80ac4fecfd605cf02e25b6ee5a6e11eab3e1ab7e0d4
7
- data.tar.gz: 0b2828173981eaa825a5103ff6ff36536ce653e0c4c767fd55dfbf256c3dd5b1977c20b86d0abcae05360d1ab9dcf7f64eb0d2eead533fe8a064266d350df8a1
6
+ metadata.gz: b79115eb6a4a34d75f4fc949d29ac1a3b2f32d822b218e280390a7d88429cf925c4e7f30c1173d9212686e6d61b1eae3a5b1233b2284e3cbddaf125e0a25ea91
7
+ data.tar.gz: '018970b8bd8de8cfe0840cc7a49cc413b6564b4e0d52232137a3385da7f5fb2640733fd2bd73669b4287446015674751ecb708d675dee971983a31af3610f634'
@@ -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
- files = compile_role(role_file, role_dir)
27
- if git
28
- git_file = "#{role_dir}/.gitignore"
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
- generated_files = []
98
- (sections.to_a + [["meta", meta]]).each { |section, lines|
99
- next if lines.empty? && section != "meta"
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
- generated_files
107
+ file
108
+ }.compact
112
109
  end
113
110
 
114
111
  # Unindent lines by the indentation of the first non-comment and non-blank
@@ -1,3 +1,3 @@
1
1
  module AnsibleMakeRole
2
- VERSION = "0.7.7"
2
+ VERSION = "0.7.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ansible_make_role
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.7
4
+ version: 0.7.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen