puppet-ghostbuster 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 841e3005eb07dc4a420ada3e7f9cd027ef6c76a1
4
- data.tar.gz: b801dd070b89ef433ac841b21944e47945f08b35
3
+ metadata.gz: e640683fdc2081827655309a5b74b8789f64fc0b
4
+ data.tar.gz: 35dc19ede6aead0efa888b524bf8cfa7e82f33a2
5
5
  SHA512:
6
- metadata.gz: 37a5506f1cb1db837cb4a5cd854026fcb8479e52938fb214c5d1bc4abb373b286ef6b6882bddb9edc42cfdfecf0b4a9db1388de0405836c60159ca484189ddb5
7
- data.tar.gz: 071723b403d2913147354045935c543da0a16b8b7c2551e46c830db64478bd1cd496c429df82a48a68581496f6be861c2f6facba979ebf056696a393b441b77b
6
+ metadata.gz: f371c80c10c50346e92f7f26a4d6c34aa986fb43a261475c873d9c05bfa028e107188cb642935270850a6a2253ae78c82d383afb583649b9fc2a96f09e4fe362
7
+ data.tar.gz: 5183186cf01b3c9bb5be41f3321113cd9b8df23d21139ac9295a11de7f8a245252616758cf56455af633b28777a1a3f39c13a773351ad0b68a20fca6f4c29c1a
@@ -1,3 +1,3 @@
1
1
  class PuppetGhostbuster
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -51,7 +51,7 @@ class PuppetGhostbuster
51
51
 
52
52
  def initialize
53
53
  Puppet.initialize_settings
54
- Dir["./**/*.pp"].each do |file|
54
+ Dir["./**/manifests/**/*.pp"].each do |file|
55
55
  if c = File.readlines(file).grep(/^class\s+([^\s\(\{]+)/){$1}[0]
56
56
  class_name = c.split('::').map(&:capitalize).join('::')
57
57
  count = self.class.used_classes.select { |klass| klass == class_name }.size
@@ -62,6 +62,21 @@ class PuppetGhostbuster
62
62
  puts "#{count} #{define_name}"
63
63
  end
64
64
  end
65
+ Dir['./**/templates/*'].each do |template|
66
+ next unless File.file?(template)
67
+ module_name, template_name = template.match(/.*\/([^\/]+)\/templates\/(.+)$/).captures
68
+ found = false
69
+ Dir["./**/manifests/**/*.pp"].each do |manifest|
70
+ if match = manifest.match(/.*\/([^\/]+)\/manifests\/.+$/)
71
+ manifest_module_name = match.captures[0]
72
+ found = File.readlines(manifest).grep(/["']\$\{module_name\}\/#{template_name}["']/).size > 0 if manifest_module_name == module_name
73
+ break if found
74
+ end
75
+ found = File.readlines(manifest).grep(/["']#{module_name}\/#{template_name}["']/).size > 0
76
+ break if found
77
+ end
78
+ puts "#{template} not used" unless found
79
+ end
65
80
  end
66
81
 
67
82
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-ghostbuster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Camptocamp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-21 00:00:00.000000000 Z
11
+ date: 2015-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json