knife-cookbook-doc 0.15.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmNiMDNhYTk3Y2U4MjUzZGExZGY2MGZmOGQzMDMzZTNjZjdjZGUyOQ==
4
+ ZTdjZDI5OTM0Mjk5MTU4ZDVmMTI4NTMzOTM4MjJlMjNlYmM5ZDRiMg==
5
5
  data.tar.gz: !binary |-
6
- ODk5ZDcyMTQzNmQzMWUzYmQ0MGMxMWI1MmJlY2YyODRjNzAyMzU2Mw==
6
+ YWIyYmJiZGZlMWZlZTg3NDZkZjBkNjRkOWU4Yjg3MmE4YzUxODEyNQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NWU0ZWQ4YThjNzUzMDE0NzYxNjE3MTlmNjdmNDk1N2M0N2RkZjVmZmRjZWJh
10
- ODQ2Yjk4NWU1NDRhYzEwNzQ0ZDg4YWU1NjU5NGUwMDMwOGJhMzZjNmMyYzI3
11
- MzkzZDFlY2E5MzdlMTVkMTA4NGFlOTYyODQ3ZDY3Y2EyYjBlMmM=
9
+ NTM0YTIzODBhNmE0NGIxYjlhZDA3ZjViNzAyNDc2NGZjZWQwNjhkNTRlZThk
10
+ ODg4N2EwODE3ZjRkOThkOGI1MGYzYjNjZTA0NmZlN2ZjMjFjMTIxNDA1NjE4
11
+ YjQ4NTdmOGJjMGZiOTBmNjI4YmZmYmE3NDg1NDAxNTA0Y2QzNTg=
12
12
  data.tar.gz: !binary |-
13
- ZGNjNTVjMDA5ZTFmZDQ3ODE1OWJhNjQ3MmVmMmYzZTMxMDNkZjgwZjI5ZWM0
14
- M2NiMjZmODA1ZmFlOTQ4OTRmODBkZDRkNGYwMjcwZDE4ZWJjY2Q3NGFkZWUw
15
- ZjlkYWFkZmIxYjdmMDMzNjRjZmRlMDQ2NmU0NjU0ODNmNjI4ODU=
13
+ ZDA4YWVjYWEyMGU0ZmU4MjFkNGEzYTAwNGEzYTA0NDdjMmEyYWNhOWIxODdj
14
+ ZjgwYmM0M2I3NjBlYmUxOGMxYmE5MDMwMWRjNmE0YTBjMzkwZjk1NWEwMTBm
15
+ ZDZiMzFjOGI4MzgzZTYxNWI1N2QyM2NkMDdiOWNhN2E0NDg3ZmY=
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /*.iml
8
8
  /*.ipr
9
9
  /*.iws
10
+ /.rakeTasks
data/.travis.yml ADDED
@@ -0,0 +1,49 @@
1
+ language: ruby
2
+ cache: bundler
3
+ sudo: false
4
+ gemfile: fixture/gemfile
5
+
6
+ rvm:
7
+ - 2.0
8
+ - 2.1
9
+ - 2.2
10
+
11
+ env:
12
+ - CHEF_VERSION=master
13
+ - CHEF_VERSION=12.4.1
14
+ - CHEF_VERSION=12.3.0
15
+ - CHEF_VERSION=12.2.1
16
+ - CHEF_VERSION=12.1.2
17
+ - CHEF_VERSION=12.0.3
18
+ - CHEF_VERSION=11.18.12
19
+ - CHEF_VERSION=11.16.4
20
+ - CHEF_VERSION=11.14.6
21
+ - CHEF_VERSION=11.12.8
22
+ - CHEF_VERSION=11.10.4
23
+ - CHEF_VERSION=11.8.2
24
+ - CHEF_VERSION=11.6.2
25
+ - CHEF_VERSION=11.4.4
26
+ - CHEF_VERSION=11.2.0
27
+ - CHEF_VERSION=11.0.0
28
+
29
+ matrix:
30
+ fast_finish: true
31
+ exclude:
32
+ - env: CHEF_VERSION=11.8.2
33
+ rvm: 2.2
34
+ - env: CHEF_VERSION=11.6.2
35
+ rvm: 2.2
36
+ - env: CHEF_VERSION=11.4.4
37
+ rvm: 2.2
38
+ - env: CHEF_VERSION=11.2.0
39
+ rvm: 2.2
40
+ - env: CHEF_VERSION=11.0.0
41
+ rvm: 2.2
42
+
43
+ allow_failures:
44
+ - env: CHEF_VERSION=master
45
+
46
+ script:
47
+ - cd fixture
48
+ - bundle exec knife cookbook doc . -o README-generated.md -c knife.rb
49
+ - diff README-expected.md README-generated.md && rm README-generated.md
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # v0.16.0 (Aug 6 2015)
2
+
3
+ * Travis CI testing, and test matrix. Submitted by Mark Ayers.
4
+ * Added badges to README. Submitted by Mark Ayers.
5
+ * Expose metadata name value. Submitted by Mark Ayers.
6
+ * No longer capitalize the platform. Submitted by Mark Ayers.
7
+ * Allow '# <' and '# >' for doc block comments. Submitted by Mark Ayers.
8
+
1
9
  # v0.15.0 (Mar 20 2015)
2
10
 
3
11
  * Further bug-fixes for multi-line attributes. Submitted By Drew Blessing.
data/README.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # knife-cookbook-doc
2
2
 
3
+ [![Build Status](http://img.shields.io/travis/realityforge/knife-cookbook-doc.svg)](https://travis-ci.org/realityforge/knife-cookbook-doc)
4
+ [![Code Climate](https://codeclimate.com/github/realityforge/knife-cookbook-doc/badges/gpa.svg)](https://codeclimate.com/github/realityforge/knife-cookbook-doc)
5
+ [![Gem Version](https://badge.fury.io/rb/knife-cookbook-doc.svg)](http://badge.fury.io/rb/knife-cookbook-doc)
6
+ [![Dependency Status](https://gemnasium.com/realityforge/knife-cookbook-doc.svg)](https://gemnasium.com/realityforge/knife-cookbook-doc)
7
+ [![Inline docs](http://inch-ci.org/github/realityforge/knife-cookbook-doc.svg)](http://inch-ci.org/github/realityforge/knife-cookbook-doc)
8
+
9
+
3
10
  This is a knife plugin to help create and maintain a README.md for a cookbook.
4
11
  As much as possible the plugin makes use of the same metadata as used by chef
5
12
  when generating the documentation. The plugin will also scan the source files
@@ -160,6 +167,33 @@ The documentation stored in comments comes in three forms;
160
167
  # This is some documentation
161
168
  #>
162
169
 
170
+ ## Version Testing and Support Matrix
171
+
172
+ This knife plugin is tested against multiple MRI Ruby versions and multiple
173
+ Chef versions. We aim to test against the lastest patch version of each minor
174
+ version of Chef Client's knife. See the `.travis.yml` for more complete detail.
175
+
176
+ ```
177
+ | Chef | MRI Ruby | | |
178
+ | version | 2.0 | 2.1 | 2.2 |
179
+ |----------|----------|---------|---------|
180
+ | master | perhaps | perhaps | perhaps |
181
+ | 12.4.1 | yes | yes | yes |
182
+ | 12.3.0 | yes | yes | yes |
183
+ | 12.2.1 | yes | yes | yes |
184
+ | 12.1.2 | yes | yes | yes |
185
+ | 12.0.3 | yes | yes | yes |
186
+ | 11.18.12 | yes | yes | yes |
187
+ | 11.16.4 | yes | yes | yes |
188
+ | 11.14.6 | yes | yes | yes |
189
+ | 11.12.8 | yes | yes | yes |
190
+ | 11.10.4 | yes | yes | yes |
191
+ | 11.8.2 | yes | yes | no |
192
+ | 11.6.2 | yes | yes | no |
193
+ | 11.4.4 | yes | yes | no |
194
+ | 11.2.0 | yes | yes | no |
195
+ | 11.0.0 | yes | yes | no |
196
+ ```
163
197
 
164
198
  ## Credit
165
199
 
@@ -0,0 +1,13 @@
1
+ fixture CHANGELOG
2
+ =================
3
+
4
+ This file is used to list changes made in each version of the fixture cookbook.
5
+
6
+ 0.1.0
7
+ -----
8
+ - [your_name] - Initial release of fixture
9
+
10
+ - - -
11
+ Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
12
+
13
+ The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
@@ -0,0 +1,34 @@
1
+ # Description
2
+
3
+ # My Cookbook Readme
4
+
5
+ **`knife cookbook doc .` _rocks_**
6
+
7
+ # Requirements
8
+
9
+ ## Platform:
10
+
11
+ * cookbook-authors
12
+
13
+ ## Cookbooks:
14
+
15
+ * upon-magic
16
+
17
+ # Attributes
18
+
19
+ * `node['knife']['cookbook']['doc']` - Defaults to `successful automation`.
20
+
21
+ # Recipes
22
+
23
+ * [fixture::default](#fixturedefault) - The recipe is awesome.
24
+
25
+ ## fixture::default
26
+
27
+ The recipe is awesome. It does thing 1, thing 2 and thing 3!
28
+
29
+ MyApp Admin Group: The group allowed to manage MyApp.
30
+
31
+ # Credits
32
+
33
+ * Mathias Lafeldt
34
+ * Peter Donald
data/fixture/README.md ADDED
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+ default['knife']['cookbook']['doc'] = 'successful automation'
@@ -0,0 +1,4 @@
1
+ # Credits
2
+
3
+ * Mathias Lafeldt
4
+ * Peter Donald
@@ -0,0 +1,3 @@
1
+ # My Cookbook Readme
2
+
3
+ **`knife cookbook doc .` _rocks_**
data/fixture/gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org/'
2
+
3
+ if ENV['CHEF_VERSION'] == 'master'
4
+ gem 'chef', github: 'chef/chef'
5
+ else
6
+ gem 'chef', ENV['CHEF_VERSION']
7
+ end
8
+
9
+ gemspec path: '..'
data/fixture/knife.rb ADDED
@@ -0,0 +1,3 @@
1
+ cookbook_copyright 'A Cookbook Author'
2
+ cookbook_email 'author@example.com'
3
+ cookbook_license 'MIT'
@@ -0,0 +1,10 @@
1
+ name 'fixture'
2
+ maintainer 'A Cookbook Author'
3
+ maintainer_email 'author@example.com'
4
+ license 'MIT'
5
+ description 'Installs/Configures fixture'
6
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7
+ version '0.1.0'
8
+
9
+ supports 'cookbook-authors'
10
+ depends 'upon-magic'
@@ -0,0 +1,14 @@
1
+ #
2
+ # Cookbook Name:: fixture
3
+ # Recipe:: default
4
+ #
5
+ # Copyright 2015, Mark Ayers
6
+ #
7
+
8
+ =begin
9
+ #<
10
+ The recipe is awesome. It does thing 1, thing 2 and thing 3!
11
+ #>
12
+ =end
13
+
14
+ #<> MyApp Admin Group: The group allowed to manage MyApp.
@@ -149,6 +149,12 @@
149
149
  # License and Maintainer
150
150
 
151
151
  Maintainer:: <%= maintainer %> (<<%= maintainer_email %>>)
152
+ <% unless source_url.empty? -%>
153
+ <%= 'Source:: ' + source_url %>
154
+ <% end -%>
155
+ <% unless issues_url.empty? -%>
156
+ <%= 'Issues:: ' + issues_url %>
157
+ <% end -%>
152
158
 
153
159
  License:: <%= license %>
154
160
  <% else -%>
@@ -39,13 +39,13 @@ module KnifeCookbookDoc
39
39
  end
40
40
 
41
41
  # get/parse comments
42
- resource_data = resource_data.gsub(/^=begin\s*\n\s*\#\<\s*\n(.*?)^\s*\#\>\n=end\s*\n#{ATTRIBUTE_REGEX}/m) do
42
+ resource_data = resource_data.gsub(/^=begin\s*\n\s*\#\ ?<\s*\n(.*?)^\s*\# ?\>\n=end\s*\n#{ATTRIBUTE_REGEX}/m) do
43
43
  update_attribute($2, $1)
44
44
  end
45
- resource_data = resource_data.gsub(/^\s*\#\<\n(.*?)^\s*\#\>\n#{ATTRIBUTE_REGEX}/m) do
45
+ resource_data = resource_data.gsub(/^\s*\# ?\<\n(.*?)^\s*\# ?\>\n#{ATTRIBUTE_REGEX}/m) do
46
46
  update_attribute($2, $1.gsub(/^\s*\# ?/, ''))
47
47
  end
48
- resource_data = resource_data.gsub(/^\s*\#\<\>\s(.*?$)\n#{ATTRIBUTE_REGEX}/) do
48
+ resource_data = resource_data.gsub(/^\s*\# ?\<\>\s(.*?$)\n#{ATTRIBUTE_REGEX}/) do
49
49
  update_attribute($2, $1)
50
50
  end
51
51
  end
@@ -27,13 +27,13 @@ module KnifeCookbookDoc
27
27
 
28
28
  def extract_description
29
29
  description = []
30
- IO.read(@filename).gsub(/^=begin *\n *\#\<\n(.*?)^ *\#\>\n=end *\n/m) do
30
+ IO.read(@filename).gsub(/^=begin *\n *\# ?\<\n(.*?)^ *\# ?\>\n=end *\n/m) do
31
31
  description << $1
32
32
  ""
33
- end.gsub(/^ *\#\<\n(.*?)^ *\#\>\n/m) do
33
+ end.gsub(/^ *\# ?\<\n(.*?)^ *\# ?\>\n/m) do
34
34
  description << $1.gsub(/^ *\# ?/, '')
35
35
  ""
36
- end.gsub(/^ *\#\<\> (.*?)$/) do
36
+ end.gsub(/^ *\# ?\<\> (.*?)$/) do
37
37
  description << $1
38
38
  ""
39
39
  end
@@ -66,13 +66,33 @@ module KnifeCookbookDoc
66
66
  @definitions
67
67
  end
68
68
 
69
+ def cookbook_name
70
+ @metadata.name
71
+ end
72
+
69
73
  def description
70
74
  @metadata.description
71
75
  end
72
76
 
77
+ def source_url
78
+ if @metadata.methods.include? :source_url
79
+ @metadata.source_url
80
+ else
81
+ ""
82
+ end
83
+ end
84
+
85
+ def issues_url
86
+ if @metadata.methods.include? :issues_url
87
+ @metadata.issues_url
88
+ else
89
+ ""
90
+ end
91
+ end
92
+
73
93
  def platforms
74
94
  @metadata.platforms.map do |platform, version|
75
- format_constraint(platform.capitalize, version)
95
+ format_constraint(platform, version)
76
96
  end
77
97
  end
78
98
 
@@ -120,6 +140,10 @@ module KnifeCookbookDoc
120
140
  @metadata.license
121
141
  end
122
142
 
143
+ def name
144
+ @metadata.name
145
+ end
146
+
123
147
  def get_binding
124
148
  binding
125
149
  end
@@ -1,3 +1,3 @@
1
1
  module KnifeCookbookDoc
2
- VERSION = '0.15.0'
2
+ VERSION = '0.16.0'
3
3
  end
@@ -10,11 +10,19 @@ describe KnifeCookbookDoc::AttributesModel do
10
10
  #<> Single line comment
11
11
  default['knife_cookbook_doc']['attr1'] = 'attr1_value'
12
12
 
13
+ # <> Another single line comment
14
+ default['knife_cookbook_doc']['attr1x'] = 'attr1x_value'
15
+
13
16
  #<
14
17
  # Multiline comment with single line of text
15
18
  #>
16
19
  default['knife_cookbook_doc']['attr2'] = 'attr2_value'
17
20
 
21
+ # <
22
+ # Another multiline comment with single line of text
23
+ # >
24
+ default['knife_cookbook_doc']['attr2x'] = 'attr2x_value'
25
+
18
26
  =begin
19
27
  #<
20
28
  Multiline begin/end with single line of text
@@ -22,12 +30,25 @@ Multiline begin/end with single line of text
22
30
  =end
23
31
  default['knife_cookbook_doc']['attr3'] = 'attr3_value'
24
32
 
33
+ =begin
34
+ # <
35
+ Another multiline begin/end with single line of text
36
+ # >
37
+ =end
38
+ default['knife_cookbook_doc']['attr3x'] = 'attr3x_value'
39
+
25
40
  #<
26
41
  # Multiline comment with
27
- multiple lines of text
42
+ # multiple lines of text
28
43
  #>
29
44
  default['knife_cookbook_doc']['attr4'] = 'attr4_value'
30
45
 
46
+ # <
47
+ # Another multiline comment with
48
+ # multiple lines of text
49
+ # >
50
+ default['knife_cookbook_doc']['attr4x'] = 'attr4x_value'
51
+
31
52
  =begin
32
53
  #<
33
54
  Multiline begin/end with
@@ -35,6 +56,14 @@ multiple lines of text
35
56
  #>
36
57
  =end
37
58
  default['knife_cookbook_doc']['attr5'] = 'attr5_value'
59
+
60
+ =begin
61
+ # <
62
+ Another multiline begin/end with
63
+ multiple lines of text
64
+ # >
65
+ =end
66
+ default['knife_cookbook_doc']['attr5x'] = 'attr5x_value'
38
67
  EOS
39
68
  }
40
69
  subject do
@@ -52,6 +81,17 @@ EOS
52
81
  )
53
82
  end
54
83
 
84
+ it do
85
+ is_expected.to include(
86
+ [
87
+ "node['knife_cookbook_doc']['attr1x']",
88
+ 'Another single line comment',
89
+ 'attr1x_value',
90
+ []
91
+ ]
92
+ )
93
+ end
94
+
55
95
  it do
56
96
  is_expected.to include(
57
97
  [
@@ -63,6 +103,17 @@ EOS
63
103
  )
64
104
  end
65
105
 
106
+ it do
107
+ is_expected.to include(
108
+ [
109
+ "node['knife_cookbook_doc']['attr2x']",
110
+ 'Another multiline comment with single line of text',
111
+ 'attr2x_value',
112
+ []
113
+ ]
114
+ )
115
+ end
116
+
66
117
  it do
67
118
  is_expected.to include(
68
119
  [
@@ -74,6 +125,17 @@ EOS
74
125
  )
75
126
  end
76
127
 
128
+ it do
129
+ is_expected.to include(
130
+ [
131
+ "node['knife_cookbook_doc']['attr3x']",
132
+ 'Another multiline begin/end with single line of text',
133
+ 'attr3x_value',
134
+ []
135
+ ]
136
+ )
137
+ end
138
+
77
139
  it do
78
140
  is_expected.to include(
79
141
  [
@@ -85,6 +147,17 @@ EOS
85
147
  )
86
148
  end
87
149
 
150
+ it do
151
+ is_expected.to include(
152
+ [
153
+ "node['knife_cookbook_doc']['attr4x']",
154
+ "Another multiline comment with\nmultiple lines of text",
155
+ 'attr4x_value',
156
+ []
157
+ ]
158
+ )
159
+ end
160
+
88
161
  it do
89
162
  is_expected.to include(
90
163
  [
@@ -95,5 +168,16 @@ EOS
95
168
  ]
96
169
  )
97
170
  end
171
+
172
+ it do
173
+ is_expected.to include(
174
+ [
175
+ "node['knife_cookbook_doc']['attr5x']",
176
+ "Another multiline begin/end with\nmultiple lines of text",
177
+ 'attr5x_value',
178
+ []
179
+ ]
180
+ )
181
+ end
98
182
  end
99
183
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-cookbook-doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias Lafeldt
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-19 00:00:00.000000000 Z
12
+ date: 2015-08-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -76,13 +76,23 @@ extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
78
  - .gitignore
79
+ - .travis.yml
79
80
  - CHANGELOG.md
80
81
  - CONTRIBUTING.md
81
82
  - Gemfile
82
83
  - LICENSE
83
84
  - README.md
84
85
  - Rakefile
85
- - TODO.md
86
+ - fixture/CHANGELOG.md
87
+ - fixture/README-expected.md
88
+ - fixture/README.md
89
+ - fixture/attributes/default.rb
90
+ - fixture/doc/credit.md
91
+ - fixture/doc/overview.md
92
+ - fixture/gemfile
93
+ - fixture/knife.rb
94
+ - fixture/metadata.rb
95
+ - fixture/recipes/default.rb
86
96
  - knife_cookbook_doc.gemspec
87
97
  - lib/chef/knife/README.md.erb
88
98
  - lib/chef/knife/cookbook_doc.rb
data/TODO.md DELETED
@@ -1 +0,0 @@
1
- * Autodetect travis usage and add badges automagically