puppet-ghostbuster 0.3.0 → 0.4.0

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: 908643e9ab2393c19fe67d3b59c65dd9c83be53a
4
- data.tar.gz: c8308c83ec8baea56fbcd6de574b4a0a614e2981
3
+ metadata.gz: 65c4533a993b62ad0194d46774be738437de8a38
4
+ data.tar.gz: d68124e057a0aee869af77cbf7923b8d3a47eaa3
5
5
  SHA512:
6
- metadata.gz: fa0254d403fb3573c54bbe2c2dceafac7c306f2974685d9fbea83716a980270b35a14aa7403934f962bf364c75e74c115a6e5743d730daceb12d4feb4c4ce246
7
- data.tar.gz: 7af1016cb3e9dc6169300fe854182da081d6f139fbfd1f0c4e9abffecb2684a95ed148598a810574b3513489fca4211cdae7dcf979b3b99f07cfe9b3c40a2319
6
+ metadata.gz: af14464b230b01dbde502d0f69f94d0be802ade503bf0067d660f557189419388534e2f936438a0249d480447ba2384a399a60c383530dfad2bcc2c9ff7319e7
7
+ data.tar.gz: 2884410e432f51d41c39bcb0f2e21cd164f788de919dd66c7057bc4842ac1bb71be20e90699140c0f78de96459d7958a1811077c653c46aed6956dbc8dbf434f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## [0.4.0](https://rubygems.org/gems/puppet-ghostbuster/versions/0.4.0) (2016-04-28)
4
+ [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.3.0...0.4.0)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - Output to JSON[\#17](https://github.com/camptocamp/puppet-ghostbuster/pull/17) ([mcanevet](https://github.com/mcanevet))
9
+
3
10
  ## [0.3.0](https://rubygems.org/gems/puppet-ghostbuster/versions/0.3.0) (2016-04-26)
4
11
  [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.2.1...0.3.0)
5
12
 
data/README.md CHANGED
@@ -29,20 +29,45 @@ You can add preconnect command with ``-p`` and server url with ``-s``.
29
29
  Example output
30
30
  --------------
31
31
  ```
32
- $ bundle exec puppet-ghostbuster -s https://puppetdburl:8081
33
- Class Foo::Install not used
34
- Class Foo::Service not used
35
- Class Foo not used
36
- ...
37
- Define Bar::Baz not used
38
- ...
39
- Template ./modulename/templates/foo.erb not used
40
- Template ./modulename/templates/bar.erb not used
41
- Template ./modulename/templates/baz.erb not used
42
- ...
43
- File ./foo/files/bar.txt not used
44
- File ./foo/files/baz.txt not used
45
- ...
32
+ $ puppet-ghostbuster -s https://puppetdburl:8081 | jsonpp
33
+ [
34
+ {
35
+ "title": "[GhostBuster] Class Foo::Install seems unused",
36
+ "body": "./modules/foo/manifests/install.pp"
37
+ },
38
+ {
39
+ "title": "[GhostBuster] Class Foo::Service seems unused",
40
+ "body": "./modules/foo/manifests/service.pp"
41
+ },
42
+ {
43
+ "title": "[GhostBuster] Class Foo seems unused",
44
+ "body": "./modules/foo/manifests/init.pp"
45
+ },
46
+ {
47
+ "title": "[GhostBuster] Define Bar:Baz seems unused",
48
+ "body": "./modules/bar/manifests/baz.pp"
49
+ },
50
+ {
51
+ "title": "[GhostBuster] Template modulename/foo.erb seems unused",
52
+ "body": "./modules/modulename/templates/foo.erb"
53
+ },
54
+ {
55
+ "title": "[GhostBuster] Template modulename/bar.erb seems unused",
56
+ "body": "./modules/modulename/templates/bar.erb"
57
+ },
58
+ {
59
+ "title": "[GhostBuster] Template modulename/baz.erb seems unused",
60
+ "body": "./modules/modulename/templates/baz.erb"
61
+ },
62
+ {
63
+ "title": "[GhostBuster] File foo/bar.txt seems unused",
64
+ "body": "./modules/foo/files/bar.txt"
65
+ },
66
+ {
67
+ "title": "[GhostBuster] File foo/baz.txt seems unused",
68
+ "body": "./modules/foo/files/baz.txt"
69
+ }
70
+ ]
46
71
  ```
47
72
 
48
73
  How It Works
@@ -1,3 +1,3 @@
1
1
  class PuppetGhostbuster
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -10,6 +10,7 @@ require 'puppet-ghostbuster/configuration'
10
10
  class PuppetGhostbuster
11
11
 
12
12
  attr_accessor :path
13
+ @@issues = []
13
14
 
14
15
  def exclude(filelist)
15
16
  ignorefile = "#{path}/.ghostbusterignore"
@@ -99,7 +100,7 @@ class PuppetGhostbuster
99
100
  if c = File.readlines(file).grep(/^class\s+([^\s\(\{]+)/){$1}[0]
100
101
  class_name = c.split('::').map(&:capitalize).join('::')
101
102
  count = self.class.used_classes.select { |klass| klass == class_name }.size
102
- puts "Class #{class_name} not used" if count == 0
103
+ @@issues << { :title => "[GhostBuster] Class #{class_name} seems unused", :body => file } if count == 0
103
104
  end
104
105
  end
105
106
  end
@@ -114,7 +115,7 @@ class PuppetGhostbuster
114
115
  if d = File.readlines(file).grep(/^define\s+([^\s\(\{]+)/){$1}[0]
115
116
  define_name = d.split('::').map(&:capitalize).join('::')
116
117
  count = self.class.client.request('resources', [:'=', 'type', define_name]).data.size
117
- puts "Define #{define_name} not used" if count == 0
118
+ @@issues << { :title => "[GhostBuster] Define #{define_name} seems unused", :body => file } if count == 0
118
119
  end
119
120
  end
120
121
  end
@@ -136,7 +137,7 @@ class PuppetGhostbuster
136
137
  end
137
138
  count += File.readlines(manifest).grep(/["']#{module_name}\/#{template_name}["']/).size
138
139
  end
139
- puts "Template #{template} not used" if count == 0
140
+ @@issues << { :title => "[GhostBuster] Template #{module_name}/#{template_name} seems unused", :body => template } if count == 0
140
141
  end
141
142
  end
142
143
 
@@ -161,7 +162,7 @@ class PuppetGhostbuster
161
162
  rescue ArgumentError
162
163
  end
163
164
  end
164
- puts "File #{file} not used" if count == 0
165
+ @@issues << { :title => "[GhostBuster] File #{module_name}/#{file_name} seems unused", :body => file } if count == 0
165
166
  end
166
167
  end
167
168
 
@@ -178,6 +179,7 @@ class PuppetGhostbuster
178
179
  find_unused_defines
179
180
  find_unused_templates
180
181
  find_unused_files
182
+ puts @@issues.to_json
181
183
  end
182
184
 
183
185
  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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Camptocamp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-26 00:00:00.000000000 Z
11
+ date: 2016-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coveralls