puppet-doc-lint 0.2.0 → 0.3.0
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/README.md +39 -2
- data/lib/puppet-doc-lint/parser.rb +2 -2
- data/lib/puppet-doc-lint/result.rb +5 -3
- data/lib/puppet-doc-lint/version.rb +1 -1
- data/spec/manifests/bad_author_block.pp +77 -0
- data/spec/runner_acceptance_spec.rb +8 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b785db59bb3c0b5397307901564a9814841e9a2
|
4
|
+
data.tar.gz: 38b68375f3fad99363eca90ecc277c6d43762687
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d59d5332839324fdd0c3e31f467f6af4224eff248e761bd49c4ec31c52911de9c32035788930d6c4fb344dd5d7452e06010103b3f5ccc08b5dd3102a3d1c27f7
|
7
|
+
data.tar.gz: 36c7c59d91507a5f3c6144564d7d7beb90d509f6154a2b0fdf5a836f73fd1c9c107ea9e6f5f32272d228ad6d1b8f21eb3ce018ccbd1b43aab2085f056c241129
|
data/README.md
CHANGED
@@ -3,13 +3,48 @@
|
|
3
3
|
|
4
4
|
Lint your Puppet files for RDoc coverage
|
5
5
|
|
6
|
-
This project is heavily based on the puppet-parse code base, go check it out! :smile:
|
6
|
+
This project is heavily based on the [puppet-parse](https://github.com/johanek/puppet-parse) code base, go check it out! :smile:
|
7
|
+
|
8
|
+
## Assumptions
|
9
|
+
|
10
|
+
This assumes that you're formatting your documentation in Puppet with [RDoc formatting](http://rdoc.sourceforge.net/doc/).
|
11
|
+
|
12
|
+
For example _this_ will work:
|
13
|
+
|
14
|
+
```Rdoc
|
15
|
+
# == Class: foo
|
16
|
+
#
|
17
|
+
# This module manages foo
|
18
|
+
#
|
19
|
+
# === Parameters
|
20
|
+
#
|
21
|
+
# [*ensure*]
|
22
|
+
# Controls presence of package and stuff
|
23
|
+
#
|
24
|
+
# === Authors
|
25
|
+
#
|
26
|
+
# * Jane Doe <mailto:jane.doe@fakecorp.com>
|
27
|
+
#
|
28
|
+
```
|
29
|
+
|
30
|
+
_This_ will not:
|
31
|
+
|
32
|
+
```
|
33
|
+
# Class: foo
|
34
|
+
#
|
35
|
+
# This module manages foo
|
36
|
+
#
|
37
|
+
# Parameters:
|
38
|
+
# - $ensure
|
39
|
+
#
|
40
|
+
# Authors: Jane Doe <mailto:jane.doe@fakecorp.com>
|
41
|
+
#
|
42
|
+
```
|
7
43
|
|
8
44
|
## Installation
|
9
45
|
|
10
46
|
gem install puppet-doc-lint
|
11
47
|
|
12
|
-
|
13
48
|
## Usage
|
14
49
|
|
15
50
|
### By hand
|
@@ -28,6 +63,8 @@ class firewall::linux::debian Docs found are ["ensure", "enable"]
|
|
28
63
|
|
29
64
|
### Rake task
|
30
65
|
|
66
|
+
** Currrently broken maybe? **
|
67
|
+
|
31
68
|
If you want to parse your entire modules directory, you can add
|
32
69
|
`require 'puppet-doc-lint/rake-task' to your Rakefile and then run
|
33
70
|
|
@@ -45,7 +45,7 @@ class PuppetDocLint
|
|
45
45
|
rdoc.parts.each do |part|
|
46
46
|
if part.respond_to?(:items)
|
47
47
|
part.items.each do |item|
|
48
|
-
next if item.label.nil?
|
48
|
+
next if item.label.nil? || item.parts.first.class == RDoc::Markup::BlankLine
|
49
49
|
key = item.label.to_s.tr('^A-Za-z0-9_-', '')
|
50
50
|
docs[key] = item.parts.first.parts
|
51
51
|
end # do item
|
@@ -63,7 +63,7 @@ class PuppetDocLint
|
|
63
63
|
author_docs = rdoc.parts.chunk{|i|i.class == RDoc::Markup::Heading && i.text == 'Authors'}.reject{|sep,ans| sep}.map{|sep,ans| ans}
|
64
64
|
|
65
65
|
author_docs.each do | doc_chunk |
|
66
|
-
unless doc_chunk[1].class == RDoc::Markup::BlankLine || doc_chunk[1].class == RDoc::Markup::Heading
|
66
|
+
unless doc_chunk[1].class == RDoc::Markup::BlankLine || doc_chunk[1].class == RDoc::Markup::Heading || !doc_chunk[1].respond_to?(:items)
|
67
67
|
doc_chunk[1].items.each do |chunk|
|
68
68
|
authors << chunk.parts.first.parts
|
69
69
|
end
|
@@ -23,9 +23,11 @@ class PuppetDocLint
|
|
23
23
|
puts "Class #{class_name} ( #{file_name} )".bg_blue
|
24
24
|
puts "Parameters found #{parameters}"
|
25
25
|
if no_documentation
|
26
|
-
puts "No documentation found."
|
27
|
-
puts "
|
28
|
-
puts "
|
26
|
+
puts "No documentation found.".red
|
27
|
+
puts "Possible reasons:"
|
28
|
+
puts "* The documentation is not formatted in the RDoc format"
|
29
|
+
puts "* There's a bug in the puppet documentation parser"
|
30
|
+
puts "* There is no documentation at all"
|
29
31
|
else
|
30
32
|
puts "Documented parameters found: #{documented_parameters}".green
|
31
33
|
puts "Undocumented parameters found: #{undocumented_parameters}".red
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# This adds the necessary components to get backports for ubuntu and debian
|
2
|
+
#
|
3
|
+
# == Parameters
|
4
|
+
#
|
5
|
+
# [*release*]
|
6
|
+
# The ubuntu/debian release name. Defaults to $lsbdistcodename. Setting this
|
7
|
+
# manually can cause undefined behavior. (Read: universe exploding)
|
8
|
+
#
|
9
|
+
# [*pin_priority*]
|
10
|
+
# _default_: 200
|
11
|
+
#
|
12
|
+
# The priority that should be awarded by default to all packages coming from
|
13
|
+
# the Debian Backports project.
|
14
|
+
#
|
15
|
+
# == Examples
|
16
|
+
#
|
17
|
+
# include apt::backports
|
18
|
+
#
|
19
|
+
# class { 'apt::backports':
|
20
|
+
# release => 'natty',
|
21
|
+
# }
|
22
|
+
#
|
23
|
+
# == Authors
|
24
|
+
#
|
25
|
+
# Ben Hughes, I think. At least blame him if this goes wrong.
|
26
|
+
# I just added puppet doc.
|
27
|
+
#
|
28
|
+
# == Copyright
|
29
|
+
#
|
30
|
+
# Copyright 2011 Puppet Labs Inc, unless otherwise noted.
|
31
|
+
class apt::backports(
|
32
|
+
$release = $::lsbdistcodename,
|
33
|
+
$location = $::apt::params::backports_location,
|
34
|
+
$pin_priority = 200,
|
35
|
+
) inherits apt::params {
|
36
|
+
|
37
|
+
if ! is_integer($pin_priority) {
|
38
|
+
fail('$pin_priority must be an integer')
|
39
|
+
}
|
40
|
+
|
41
|
+
if $::lsbdistid == 'LinuxMint' {
|
42
|
+
if $::lsbdistcodename == 'debian' {
|
43
|
+
$distid = 'debian'
|
44
|
+
$release_real = 'wheezy'
|
45
|
+
} else {
|
46
|
+
$distid = 'ubuntu'
|
47
|
+
$release_real = $::lsbdistcodename ? {
|
48
|
+
'qiana' => 'trusty',
|
49
|
+
'petra' => 'saucy',
|
50
|
+
'olivia' => 'raring',
|
51
|
+
'nadia' => 'quantal',
|
52
|
+
'maya' => 'precise',
|
53
|
+
}
|
54
|
+
}
|
55
|
+
} else {
|
56
|
+
$distid = $::lsbdistid
|
57
|
+
$release_real = downcase($release)
|
58
|
+
}
|
59
|
+
|
60
|
+
$key = $distid ? {
|
61
|
+
'debian' => '46925553',
|
62
|
+
'ubuntu' => '437D05B5',
|
63
|
+
}
|
64
|
+
$repos = $distid ? {
|
65
|
+
'debian' => 'main contrib non-free',
|
66
|
+
'ubuntu' => 'main universe multiverse restricted',
|
67
|
+
}
|
68
|
+
|
69
|
+
apt::source { 'backports':
|
70
|
+
location => $location,
|
71
|
+
release => "${release_real}-backports",
|
72
|
+
repos => $repos,
|
73
|
+
key => $key,
|
74
|
+
key_server => 'pgp.mit.edu',
|
75
|
+
pin => $pin_priority,
|
76
|
+
}
|
77
|
+
}
|
@@ -70,7 +70,8 @@ describe PuppetDocLint::DocRunner do
|
|
70
70
|
|
71
71
|
it "should return a multi-element array" do
|
72
72
|
subject.class.should be(Array)
|
73
|
-
|
73
|
+
# Count of how many test manifests we have
|
74
|
+
subject.size.should eql(8)
|
74
75
|
end
|
75
76
|
|
76
77
|
end
|
@@ -127,5 +128,11 @@ describe PuppetDocLint::DocRunner do
|
|
127
128
|
it_should_behave_like "something undocumented", file, klass
|
128
129
|
end
|
129
130
|
|
131
|
+
describe "badly formatted author block" do
|
132
|
+
file = 'spec/manifests/bad_author_block.pp'
|
133
|
+
klass = 'apt::backports'
|
134
|
+
it_should_behave_like "standard tests", file, klass
|
135
|
+
end
|
136
|
+
|
130
137
|
end
|
131
138
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-doc-lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Souter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- lib/puppet-doc-lint/string.rb
|
129
129
|
- lib/puppet-doc-lint/version.rb
|
130
130
|
- puppet-doc-lint.gemspec
|
131
|
+
- spec/manifests/bad_author_block.pp
|
131
132
|
- spec/manifests/define_nordoc.pp
|
132
133
|
- spec/manifests/define_rdoc.pp
|
133
134
|
- spec/manifests/nested_bullets.pp
|
@@ -163,6 +164,7 @@ signing_key:
|
|
163
164
|
specification_version: 4
|
164
165
|
summary: Doc Parser for Puppet Modules. Returns Information about documentation.
|
165
166
|
test_files:
|
167
|
+
- spec/manifests/bad_author_block.pp
|
166
168
|
- spec/manifests/define_nordoc.pp
|
167
169
|
- spec/manifests/define_rdoc.pp
|
168
170
|
- spec/manifests/nested_bullets.pp
|