knife-cookbook-doc 0.28.0 → 0.29.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: bf234f956b5b2932a4b0bc628c5ecf93c76f2446
4
- data.tar.gz: 0d42eca15452227f41a815ba49607d82aff27ab3
3
+ metadata.gz: 7d4e4e61d176043dd41fa77782ac36203bc1251a
4
+ data.tar.gz: 49a72076fe65ea3f15878479e7c709394e2bc14c
5
5
  SHA512:
6
- metadata.gz: 53cc932300b345ca738a9aff13caac0704788d8abf66b2872852a0b4553af6cd187b53d31625b47d6b8cdf4eedcdfa7b7a1c684d7d60090ca5fc266a1cd36b1e
7
- data.tar.gz: cf0d15453d5565e2d0360f7d6baac7a6c3ce0a14912fdfc16fb68b2f360211b2871ca0408d59e37423dfb45d8f26eec5ecc81f14cbf74ce58d4327b95ec31430
6
+ metadata.gz: 325f8c3e22e8f67778480106847aafbccc2d7da9d58831005f3fa09b7e3de3c4710c9a05e6023718a8669c064e51c94f3cc8cf5305752704e5d6a587d5c89fae
7
+ data.tar.gz: 876de6b5caff31196e93bd7dd71c8b5fb1c6bec5725a95c24644595ae19954de6a043d1e987be44df56c67c1e376eec46bec027bcd9ef285ce0b7393347e97da
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  /Gemfile.lock
2
2
  /*.gem
3
+ /fixture/README-generated.md
3
4
 
4
5
  # Intermediate package dir
5
6
  /pkg
@@ -1,3 +1,7 @@
1
+ # v0.29.0 (Jun 26 2020)
2
+
3
+ * Extract descriptions from `libraries/*.rb`. Submitted by Joe Nuspl.
4
+
1
5
  # v0.28.0 (Jun 11 2020)
2
6
 
3
7
  * If `Berksfile` exists, add source_url links to cookbooks. Submitted by Joe Nuspl.
data/Rakefile CHANGED
@@ -4,3 +4,12 @@ require 'rake/clean'
4
4
  task :default => :build
5
5
 
6
6
  CLEAN.include 'pkg'
7
+
8
+ task :test => :install
9
+ task :test do
10
+ sh <<SCRIPT
11
+ cd fixture
12
+ knife cookbook doc . -o README-generated.md -c knife.rb
13
+ diff -u README-expected.md README-generated.md && rm README-generated.md
14
+ SCRIPT
15
+ end
@@ -50,6 +50,11 @@ This resource is awesome.
50
50
  - my_attribute: This is an attribute. Defaults to <code>"a default value"</code>.
51
51
  - my_property: This is a property. Defaults to <code>"another default value"</code>.
52
52
 
53
+ # Libraries
54
+
55
+ ## stooges()
56
+ Returns `['Moe', 'Larry', 'Curly']`
57
+
53
58
  # Credits
54
59
 
55
60
  * Mathias Lafeldt
@@ -0,0 +1,7 @@
1
+ # <
2
+ # ## stooges()
3
+ # Returns `['Moe', 'Larry', 'Curly']`
4
+ # >
5
+ def stooges
6
+ %w(Moe Larry Curly)
7
+ end
@@ -157,6 +157,13 @@
157
157
  <%= resource.top_level_description(key) -%>
158
158
  <% end -%>
159
159
 
160
+ <% end -%>
161
+ <% end -%>
162
+ <% unless libraries.empty? -%>
163
+ # Libraries
164
+ <% libraries.each do |lib| -%>
165
+
166
+ <%= lib.descriptions %>
160
167
  <% end -%>
161
168
  <% end -%>
162
169
  <% fragments.keys.select {|k|k != 'overview' && k != 'credit' && k != 'requirements'}.each do |key| -%>
@@ -9,6 +9,7 @@ module KnifeCookbookDoc
9
9
  require 'knife_cookbook_doc/base_model'
10
10
  require 'knife_cookbook_doc/documenting_lwrp_base'
11
11
  require 'knife_cookbook_doc/definitions_model'
12
+ require 'knife_cookbook_doc/libraries_model'
12
13
  require 'knife_cookbook_doc/readme_model'
13
14
  require 'knife_cookbook_doc/recipe_model'
14
15
  require 'knife_cookbook_doc/resource_model'
@@ -0,0 +1,13 @@
1
+ module KnifeCookbookDoc
2
+ class LibrariesModel
3
+ include KnifeCookbookDoc::BaseModel
4
+
5
+ attr_reader :descriptions
6
+
7
+ def initialize(name, filename)
8
+ @name = name
9
+ @filename = filename
10
+ @descriptions = extract_description
11
+ end
12
+ end
13
+ end
@@ -6,6 +6,7 @@ require 'rake/tasklib'
6
6
  require 'knife_cookbook_doc/base_model'
7
7
  require 'knife_cookbook_doc/documenting_lwrp_base'
8
8
  require 'knife_cookbook_doc/definitions_model'
9
+ require 'knife_cookbook_doc/libraries_model'
9
10
  require 'knife_cookbook_doc/readme_model'
10
11
  require 'knife_cookbook_doc/recipe_model'
11
12
  require 'knife_cookbook_doc/resource_model'
@@ -8,6 +8,8 @@ module KnifeCookbookDoc
8
8
  class ReadmeModel
9
9
  DEFAULT_CONSTRAINT = ">= 0.0.0".freeze
10
10
 
11
+ attr_reader :libraries
12
+
11
13
  def initialize(cookbook_dir, config)
12
14
 
13
15
  @metadata = Chef::Cookbook::Metadata.new
@@ -28,6 +30,10 @@ module KnifeCookbookDoc
28
30
  end
29
31
  end
30
32
 
33
+ @libraries = Dir["#{cookbook_dir}/libraries/*.rb"].sort.map do |path|
34
+ LibrariesModel.new(@metadata.name, path)
35
+ end
36
+
31
37
  @resources = []
32
38
  Dir["#{cookbook_dir}/resources/*.rb"].sort.each do |resource_filename|
33
39
  @resources << ResourceModel.new(@metadata.name, resource_filename)
@@ -1,3 +1,3 @@
1
1
  module KnifeCookbookDoc
2
- VERSION = '0.28.0'
2
+ VERSION = '0.29.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.28.0
4
+ version: 0.29.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: 2020-06-11 00:00:00.000000000 Z
12
+ date: 2020-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -94,6 +94,7 @@ files:
94
94
  - fixture/doc/overview.md
95
95
  - fixture/gemfile
96
96
  - fixture/knife.rb
97
+ - fixture/libraries/default.rb
97
98
  - fixture/metadata.rb
98
99
  - fixture/recipes/default.rb
99
100
  - fixture/resources/default.rb
@@ -104,6 +105,7 @@ files:
104
105
  - lib/knife_cookbook_doc/base_model.rb
105
106
  - lib/knife_cookbook_doc/definitions_model.rb
106
107
  - lib/knife_cookbook_doc/documenting_lwrp_base.rb
108
+ - lib/knife_cookbook_doc/libraries_model.rb
107
109
  - lib/knife_cookbook_doc/rake_task.rb
108
110
  - lib/knife_cookbook_doc/readme_model.rb
109
111
  - lib/knife_cookbook_doc/recipe_model.rb