chef_attrdoc 1.0.0.pre → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -3
- data/bin/chef_attrdoc +18 -2
- data/lib/chef_attrdoc/version.rb +1 -1
- metadata +5 -5
data/README.md
CHANGED
@@ -4,7 +4,9 @@ chef_attrdoc
|
|
4
4
|
[![Build Status](https://travis-ci.org/mapleoin/chef_attrdoc.svg?branch=master)](https://travis-ci.org/mapleoin/chef_attrdoc)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/mapleoin/chef_attrdoc.png)](https://codeclimate.com/github/mapleoin/chef_attrdoc)
|
6
6
|
|
7
|
-
|
7
|
+
*The problem:* README documentation gets outdated because it's not close to the code. A lot of cookbook documentation describes the configuration options that the cookbook provides; so it naturally lies in attributes files.
|
8
|
+
|
9
|
+
*The solution:* Extract documentation from chef cookbooks' attributes files and format and output it to the cookbook's README.md file.
|
8
10
|
|
9
11
|
`chef_attrdoc` groups attribute initialization lines together with the comments immediately above them. Any lines containing an attribute initialization which are not separated by an empty line are considered a group. The comment immediately above them is assumed to describe the group of attributes below. Groups of attribute initialization lines which are not immediately preceded by a comment line are ignored and will not show up in the output.
|
10
12
|
|
@@ -17,6 +19,8 @@ $ gem install chef_attrdoc
|
|
17
19
|
$ chef_attrdoc ~/cookbooks/mycookbook
|
18
20
|
```
|
19
21
|
|
22
|
+
It's that simple. Only one command to run and `chef_attrdoc` will know how to do the rest.
|
23
|
+
|
20
24
|
`chef_attrdoc` will try to find an Attributes heading in the README.md file in that directory and replace its contents with the generated attributes documentation. The attributes documentation is compiled from all the files in the cookbook's `attributes/` directory. All the files ending in `.rb` in that directory are considered to be attributes files.
|
21
25
|
|
22
26
|
`chef_attrdoc` uses ruby's stdlib `ripper` module and so does not have any dependencies.
|
@@ -70,6 +74,6 @@ $ chef_attrdoc cookbook-example --stdout
|
|
70
74
|
|
71
75
|
Here are some longer examples from openstack chef cookbooks:
|
72
76
|
|
73
|
-
[openstack-
|
77
|
+
[openstack-identity attributes file](https://github.com/stackforge/cookbook-openstack-identity/blob/552488824aa720f08249bc4d19f5224e9382aa00/attributes/default.rb) - [output](https://gist.github.com/mapleoin/d211b29f68dd519a4878#attributes)
|
74
78
|
|
75
|
-
[openstack-
|
79
|
+
[openstack-common attributes file](https://github.com/stackforge/cookbook-openstack-common/tree/f0e55b8742d9285742163d8c2633833dc6f4241c/attributes) - [output](https://gist.github.com/mapleoin/d211b29f68dd519a4878#attributes)
|
data/bin/chef_attrdoc
CHANGED
@@ -1,4 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
# Copyright 2013-2014, Ionuț Arțăriși <ionut@artarisi.eu>
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
2
18
|
|
3
19
|
require 'optparse'
|
4
20
|
|
@@ -7,8 +23,8 @@ require 'chef_attrdoc'
|
|
7
23
|
options = {}
|
8
24
|
|
9
25
|
opt_parser = OptionParser.new do |opts|
|
10
|
-
opts.banner = "Usage: chef_attrdoc
|
11
|
-
opts.banner << "DIR - cookbook directory - defaults to the current directory\n
|
26
|
+
opts.banner = "Usage: chef_attrdoc [DIR] [options]\n"
|
27
|
+
opts.banner << "DIR - cookbook directory - defaults to the current directory\n"
|
12
28
|
|
13
29
|
options[:readme] = "README.md"
|
14
30
|
opts.on("-r", "--readme README",
|
data/lib/chef_attrdoc/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef_attrdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ionuț Arțăriși
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -87,9 +87,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
88
|
none: false
|
89
89
|
requirements:
|
90
|
-
- - ! '
|
90
|
+
- - ! '>='
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
92
|
+
version: '0'
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
95
|
rubygems_version: 1.8.23
|