knife-cookbook-doc 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ v0.11.0 (Jun 5 2014)
2
+ --------------------
3
+
4
+ * Be honest about attribute types. Submitted by benlangfeld.
5
+
1
6
  v0.10.0 (Mar 3 2014)
2
7
  --------------------
3
8
 
data/CONTRIBUTING.md CHANGED
@@ -12,7 +12,7 @@ Pester us if we don't get your Pull Requests merged in a timely fashion. :)
12
12
 
13
13
  ## How to speed the merging of pull requests
14
14
 
15
- * Describe your changes in the CHANGELOG.
15
+ * Describe your changes in the CHANGELOG.
16
16
  * Give yourself some credit in the appropriate place (usually the CHANGELOG).
17
17
  * Make commits of logical units.
18
18
  * Ensure your commit messages help others understand what you are doing and why.
data/README.md CHANGED
@@ -35,7 +35,7 @@ If the user has not specified documentation for the recipe in `metadata.rb`
35
35
  then the tool takes the first sentence of the detailed documentation as the
36
36
  summary to use in the table of contents.
37
37
 
38
- #### Step 2
38
+ #### Step 3
39
39
 
40
40
  If the user has not specified documentation for the attributes in `metadata.rb`
41
41
  then the tool scans the attribute files and uses the documentation block
@@ -44,7 +44,7 @@ preceding the attribute.
44
44
  #<> MyApp Admin Group: The group allowed to manage MyApp.
45
45
  default['myapp']['group'] = 'myapp-admin'
46
46
 
47
- #### Step 3
47
+ #### Step 4
48
48
 
49
49
  In each LWRP, add detailed documentation such as;
50
50
 
@@ -78,7 +78,7 @@ The other text will be added at the start of the LWRP documentation
78
78
  except if marked with `@section <heading>`, in which case it will be added
79
79
  to the end of the LWRP documentation.
80
80
 
81
- #### Step 4
81
+ #### Step 5
82
82
 
83
83
  In each definition add documentation like:
84
84
 
@@ -91,7 +91,7 @@ In each definition add documentation like:
91
91
 
92
92
  @section Examples
93
93
 
94
- # An example of my awesome service
94
+ # An example of my awesome definition
95
95
  mycookbook_awesome_definition "app resources" do
96
96
  user 'appuser'
97
97
  group 'appgroup'
@@ -100,7 +100,7 @@ In each definition add documentation like:
100
100
  =end
101
101
 
102
102
 
103
- #### Step 5
103
+ #### Step 6
104
104
 
105
105
  Finally the user should add some documentation fragments into the `doc/` dir.
106
106
  Most importantly you should add `doc/overview.md` which will replace the first
@@ -41,7 +41,7 @@
41
41
 
42
42
  <% unless attributes.empty? %>
43
43
  <% attributes.each do |name, description, default, choice| %>
44
- * `<%= name %>` - <%= description %><% if !description.nil? && !description.strip.end_with?(".") %>.<% end %> <% unless choice.empty? %>Available options: <%= "`#{choice.join('`, `')}`" %>. <% end %>Defaults to `<%= default %>`.
44
+ * `<%= name %>` - <%= description %><% if !description.nil? && !description.strip.end_with?(".") %>.<% end %> <% unless choice.empty? %>Available options: <%= "`#{choice.map(&:inspect).join('`, `')}`" %>. <% end %>Defaults to `<%= default.inspect %>`.
45
45
  <% end %>
46
46
  <% else %>
47
47
  *No attributes defined*
@@ -32,7 +32,7 @@ module KnifeCookbookDoc
32
32
  else
33
33
  value = value.gsub(/\A\"|\A'|\"\Z|'\Z/, '')
34
34
  end
35
-
35
+
36
36
  options = {}
37
37
  options[:default] = value
38
38
  @attributes[name] = options
@@ -50,7 +50,7 @@ module KnifeCookbookDoc
50
50
  end
51
51
  end
52
52
 
53
- def update_attribute(name, description)
53
+ def update_attribute(name, description)
54
54
  name = get_attribute_name(name)
55
55
  options = @attributes[name]
56
56
  options[:description] = description.strip
@@ -1,44 +1,44 @@
1
- module KnifeCookbookDoc
2
- module BaseModel
3
-
4
- def top_level_description(section)
5
- (top_level_descriptions[section.to_s] || []).join("\n").gsub(/\n+$/m,"\n")
6
- end
7
-
8
- def top_level_descriptions
9
- @top_level_descriptions ||= {}
10
- end
11
-
12
- def short_description
13
- unless @short_description
14
- @short_description = first_sentence(top_level_description('main'))
15
- end
16
- @short_description
17
- end
18
-
19
- private
20
-
21
- def first_sentence(string)
22
- string.gsub(/^(.*?\.(\z|\s))/m) do |match|
23
- return $1.gsub("\n",' ').strip
24
- end
25
- return nil
26
- end
27
-
28
- def extract_description
29
- description = []
30
- IO.read(@filename).gsub(/^=begin *\n *\#\<\n(.*?)^ *\#\>\n=end *\n/m) do
31
- description << $1
32
- ""
33
- end.gsub(/^ *\#\<\n(.*?)^ *\#\>\n/m) do
34
- description << $1.gsub(/^ *\# ?/, '')
35
- ""
36
- end.gsub(/^ *\#\<\> (.*?)$/) do
37
- description << $1
38
- ""
39
- end
40
- description.join("\n")
41
- end
42
-
43
- end
44
- end
1
+ module KnifeCookbookDoc
2
+ module BaseModel
3
+
4
+ def top_level_description(section)
5
+ (top_level_descriptions[section.to_s] || []).join("\n").gsub(/\n+$/m,"\n")
6
+ end
7
+
8
+ def top_level_descriptions
9
+ @top_level_descriptions ||= {}
10
+ end
11
+
12
+ def short_description
13
+ unless @short_description
14
+ @short_description = first_sentence(top_level_description('main'))
15
+ end
16
+ @short_description
17
+ end
18
+
19
+ private
20
+
21
+ def first_sentence(string)
22
+ string.gsub(/^(.*?\.(\z|\s))/m) do |match|
23
+ return $1.gsub("\n",' ').strip
24
+ end
25
+ return nil
26
+ end
27
+
28
+ def extract_description
29
+ description = []
30
+ IO.read(@filename).gsub(/^=begin *\n *\#\<\n(.*?)^ *\#\>\n=end *\n/m) do
31
+ description << $1
32
+ ""
33
+ end.gsub(/^ *\#\<\n(.*?)^ *\#\>\n/m) do
34
+ description << $1.gsub(/^ *\# ?/, '')
35
+ ""
36
+ end.gsub(/^ *\#\<\> (.*?)$/) do
37
+ description << $1
38
+ ""
39
+ end
40
+ description.join("\n")
41
+ end
42
+
43
+ end
44
+ end
@@ -37,7 +37,7 @@ module KnifeCookbookDoc
37
37
  code = IO.read(@filename)
38
38
  code.gsub(/^ *define (.*?) (?=do)/m) do
39
39
  all = $1.split(' ', 2)
40
- @name = all.shift.gsub(/:/, '')
40
+ @name = all.shift.gsub(/:|,/, '')
41
41
  next if all.empty?
42
42
  all = eval("{#{all.last}}") rescue {}
43
43
  all.each do |k, v|
@@ -19,7 +19,7 @@ module KnifeCookbookDoc
19
19
  if !model.attributes.empty?
20
20
  @attributes += model.attributes
21
21
  end
22
- end
22
+ end
23
23
  end
24
24
 
25
25
  @resources = []
@@ -1,3 +1,3 @@
1
1
  module KnifeCookbookDoc
2
- VERSION = '0.10.0'
2
+ VERSION = '0.11.0'
3
3
  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.10.0
4
+ version: 0.11.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-03-02 00:00:00.000000000 Z
13
+ date: 2014-06-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: chef