knife-cookbook-doc 0.20.0 → 0.21.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: 2547fe3a4ed594bf06e9c563ae040c45c42001e3
4
- data.tar.gz: 92629b1e4e30ab40b3646708eb3ab97328afcad7
3
+ metadata.gz: 17c5fb8c4abf80bfc8900aba278be417d184c37d
4
+ data.tar.gz: 7724660129ece1fbb7fa7045ff7cdba8c3478de6
5
5
  SHA512:
6
- metadata.gz: 5625b1d45f32c07f42ca21baf9512fba3e2cc75765b16c5debcf02d3f30cbf6a2be87238c62adc611c43c9b8f16f878a01a7221434bca77b7b985e8e7ea0433a
7
- data.tar.gz: e4e821099a09abe61c24da3552a5c2c70fcf97af8e035a7b50117dd0712c5b5ad416d8de88566fd280d73514ddb239d81f9ecafb878eda0b948faf08562c0e9d
6
+ metadata.gz: 5cef0d16f18084b09540a0912ce6633ff257cc71d2996e77b183820a358985afb4357d3b4b00efd352862cd69b7185f77f2bd4a91b523abda2237fb4ef7cfbbb
7
+ data.tar.gz: 7a9e7770d224d241cb5939e287218808f5b9da50aeeb2ff2805cea931de577c8dc21375a3ef9ad3a5907ef661ae03fdf116b60aabf8c4405d50cae3fefb99030
data/.travis.yml CHANGED
@@ -4,9 +4,8 @@ sudo: false
4
4
  gemfile: fixture/gemfile
5
5
 
6
6
  rvm:
7
- - 2.0
8
- - 2.1
9
- - 2.2
7
+ - 2.2.6
8
+ - 2.3.3
10
9
 
11
10
  env:
12
11
  - CHEF_VERSION=master
@@ -21,25 +20,14 @@ env:
21
20
  - CHEF_VERSION=11.14.6
22
21
  - CHEF_VERSION=11.12.8
23
22
  - CHEF_VERSION=11.10.4
24
- - CHEF_VERSION=11.8.2
25
- - CHEF_VERSION=11.6.2
26
- - CHEF_VERSION=11.4.4
27
- - CHEF_VERSION=11.2.0
28
- - CHEF_VERSION=11.0.0
29
23
 
30
24
  matrix:
31
25
  fast_finish: true
32
26
  exclude:
33
- - env: CHEF_VERSION=11.8.2
34
- rvm: 2.2
35
- - env: CHEF_VERSION=11.6.2
36
- rvm: 2.2
37
- - env: CHEF_VERSION=11.4.4
38
- rvm: 2.2
39
- - env: CHEF_VERSION=11.2.0
40
- rvm: 2.2
41
- - env: CHEF_VERSION=11.0.0
42
- rvm: 2.2
27
+ - env: CHEF_VERSION=11.12.8
28
+ rvm: 2.3.3
29
+ - env: CHEF_VERSION=11.10.4
30
+ rvm: 2.3.3
43
31
 
44
32
  allow_failures:
45
33
  - env: CHEF_VERSION=master
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.21.0 (Dec 2 2016)
2
+
3
+ * Add support `--ignore-missing-doc-attr` to skip attributes with no documentation. Submitted by Andrey Zax.
4
+
1
5
  # v0.20.0 (Mar 11 2016)
2
6
 
3
7
  * Support custom requirements being specified in `doc/requirements.md`. Submitted by Deepak Sihag.
@@ -36,6 +36,12 @@ module KnifeCookbookDoc
36
36
  :default => Pathname.new("#{File.dirname(__FILE__)}/README.md.erb").realpath,
37
37
  :description => 'Set template file used to render README.md'
38
38
 
39
+ option :ignore_missing_attribute_desc,
40
+ :long => '--ignore-missing-doc-attr',
41
+ :boolean => true,
42
+ :default => false,
43
+ :description => 'Ignore attributes without documetation'
44
+
39
45
  def run
40
46
  unless (cookbook_dir = name_args.first)
41
47
  ui.fatal 'Please provide cookbook directory as an argument'
@@ -44,7 +50,7 @@ module KnifeCookbookDoc
44
50
 
45
51
  cookbook_dir = File.realpath(cookbook_dir)
46
52
 
47
- model = ReadmeModel.new(cookbook_dir, config[:constraints])
53
+ model = ReadmeModel.new(cookbook_dir, config)
48
54
 
49
55
  template = File.read(config[:template_file])
50
56
  eruby = Erubis::Eruby.new(template)
@@ -3,9 +3,10 @@ module KnifeCookbookDoc
3
3
 
4
4
  ATTRIBUTE_REGEX = "(^\s*(?:default|set|force_default|override|force_override).*?)=\s*\n?\s*(.*?)$".freeze
5
5
 
6
- def initialize(filename)
6
+ def initialize(filename, config)
7
7
  @filename = filename
8
8
  @attributes = {}
9
+ @config = config
9
10
  load_descriptions
10
11
  end
11
12
 
@@ -48,6 +49,10 @@ module KnifeCookbookDoc
48
49
  resource_data = resource_data.gsub(/^\s*\# ?\<\>\s(.*?$)\n#{ATTRIBUTE_REGEX}/) do
49
50
  update_attribute($2, $1)
50
51
  end
52
+
53
+ if @config[:ignore_missing_attribute_desc]
54
+ @attributes.select! { |att_name, att_options| att_options.has_key? :description }
55
+ end
51
56
  end
52
57
 
53
58
  def update_attribute(name, description)
@@ -2,7 +2,7 @@ module KnifeCookbookDoc
2
2
  class ReadmeModel
3
3
  DEFAULT_CONSTRAINT = ">= 0.0.0".freeze
4
4
 
5
- def initialize(cookbook_dir, constraints)
5
+ def initialize(cookbook_dir, config)
6
6
 
7
7
  @metadata = Chef::Cookbook::Metadata.new
8
8
  @metadata.from_file("#{cookbook_dir}/metadata.rb")
@@ -15,7 +15,7 @@ module KnifeCookbookDoc
15
15
  else
16
16
  @attributes = []
17
17
  Dir["#{cookbook_dir}/attributes/*.rb"].sort.each do |attribute_filename|
18
- model = AttributesModel.new(attribute_filename)
18
+ model = AttributesModel.new(attribute_filename, config)
19
19
  if !model.attributes.empty?
20
20
  @attributes += model.attributes
21
21
  end
@@ -51,7 +51,7 @@ module KnifeCookbookDoc
51
51
  end
52
52
  end
53
53
  @metadata = @metadata
54
- @constraints = constraints
54
+ @constraints = config[:constraints]
55
55
  end
56
56
 
57
57
  def fragments
@@ -1,3 +1,3 @@
1
1
  module KnifeCookbookDoc
2
- VERSION = '0.20.0'
2
+ VERSION = '0.21.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.20.0
4
+ version: 0.21.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: 2016-03-11 00:00:00.000000000 Z
12
+ date: 2016-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 2.2.2
131
+ rubygems_version: 2.5.1
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: Knife plugin to generate README.md for a cookbook