danger-toc 0.1.3 → 0.2.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
  SHA256:
3
- metadata.gz: 6f762724f89edff7e76c51e6ffae851d257b1f4f5ef2fd668a9c7e28c5a62c0f
4
- data.tar.gz: 9b9cd63986e67d85dda7a1067eb70abdd782ed27ad684ac72b781fb5145f5493
3
+ metadata.gz: 1d27e70d24b49b9cb6028e5f55a4315740babe9e9f51a73fe95d7c502e2c18b2
4
+ data.tar.gz: f58a7d7c22ae8f8746f9aa9318dbf461511149d5f3881bc9e927020723a80359
5
5
  SHA512:
6
- metadata.gz: 18157fc64bfcc1efb3db474d650b771a314a90b15838bfe5d222a21ab344c18a80bb848b41f5623e1391f30921b3ae058f4f3c40e0076f5a5b7af2e840b02993
7
- data.tar.gz: 932ac02e3ebaac4ada45b08fe6353bcbf7bc84b66f87e44e4c35f799e0a881db35843f6c31dafa6f22fcf0631a6b3551c8ce25cacffde51f81eb5a5ee8c7c255
6
+ metadata.gz: cb815bca9f3cf08a3f6b2a474cdd9c15d8eb3b92c7478e595c86c62a510b52e55e1ef542a6121ca06fa4210239d6dfa4dcb50c26366e3e2adaffc639e6ef66e5
7
+ data.tar.gz: 36cb65b82c3ba399ef44a45c2f461f7b7cad09d857eadcb86265f7758370314637550ec1777db7a2c8ea8fa0a44e43d5ede2f4169600cd0bb31efe2531f27c16
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-08-15 11:59:49 -0400 using RuboCop version 0.58.2.
3
+ # on 2019-07-28 16:26:13 -0400 using RuboCop version 0.58.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -15,11 +15,6 @@ Layout/IndentHeredoc:
15
15
  - 'lib/toc/plugin.rb'
16
16
  - 'spec/toc_spec.rb'
17
17
 
18
- # Offense count: 2
19
- Lint/DuplicateMethods:
20
- Exclude:
21
- - 'lib/toc/config.rb'
22
-
23
18
  # Offense count: 4
24
19
  Metrics/AbcSize:
25
20
  Max: 19
@@ -83,4 +78,4 @@ Style/GuardClause:
83
78
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
84
79
  # URISchemes: http, https
85
80
  Metrics/LineLength:
86
- Max: 119
81
+ Max: 123
@@ -1,5 +1,10 @@
1
1
  ## Changelog
2
2
 
3
+ ### 0.2.0 (2019/07/28)
4
+
5
+ * [#16](https://github.com/dblock/danger-toc/pull/16): Deprecate `check` in favor of `check!` - [@dblock](https://github.com/dblock).
6
+ * [#16](https://github.com/dblock/danger-toc/pull/16): Deprecate `configure`, configure directly on `toc` - [@dblock](https://github.com/dblock).
7
+
3
8
  ### 0.1.3 (2018/08/15)
4
9
 
5
10
  * [#7](https://github.com/dblock/danger-toc/issues/7): Parse documents as Github Flavored Markdown by default - [@dblock](https://github.com/dblock).
data/Dangerfile CHANGED
@@ -1,4 +1,4 @@
1
1
  # danger.systems
2
2
 
3
- changelog.check
4
- toc.check
3
+ changelog.check!
4
+ toc.check!
data/Gemfile CHANGED
@@ -2,4 +2,15 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'danger-changelog', '~> 0.2.0'
5
+ group :development, :test do
6
+ gem 'bundler'
7
+ gem 'danger-changelog', '~> 0.6.0'
8
+ gem 'guard', '~> 2.14'
9
+ gem 'guard-rspec', '~> 4.7'
10
+ gem 'listen'
11
+ gem 'pry'
12
+ gem 'rake', '~> 10.0'
13
+ gem 'rspec', '~> 3.4'
14
+ gem 'rubocop', '0.58.2'
15
+ gem 'yard'
16
+ end
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017 Daniel Doubrovkine <dblock@dblock.org>
1
+ Copyright (c) 2017-2019 Daniel Doubrovkine <dblock@dblock.org>
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -9,11 +9,9 @@ A plugin for [danger.systems](http://danger.systems) that makes sure your projec
9
9
 
10
10
  - [Installation](#installation)
11
11
  - [Usage](#usage)
12
- - [Configuration](#configuration)
13
- - [Methods and Attributes](#methods-and-attributes)
14
- - [toc.files](#tocfiles)
15
- - [toc.header](#tocheader)
16
- - [toc.check](#toccheck)
12
+ - [toc.files](#tocfiles)
13
+ - [toc.header](#tocheader)
14
+ - [toc.check!](#toccheck)
17
15
  - [Contributing](#contributing)
18
16
  - [Copyright](#copyright)
19
17
 
@@ -31,32 +29,27 @@ Add `toc.check` to your Dangerfile. Make a pull request and see this plugin in a
31
29
 
32
30
  ## Usage
33
31
 
34
- ### Configuration
32
+ Methods and settings from this plugin are available in your `Dangerfile` under the `toc` namespace.
35
33
 
36
- The plugin supports following configuration options:
34
+ ### toc.files
35
+
36
+ List of files to ensure TOC in, default is `README.md`.
37
37
 
38
38
  ```ruby
39
- Danger::Toc.configure do |config|
40
- config.files = [ 'README.md' ]
41
- config.header = 'Table of Contents'
42
- end
39
+ config.files = [ 'README.md', 'DEV.md' ]
43
40
  ```
44
41
 
45
- ### Methods and Attributes
46
-
47
- Methods and attributes from this plugin are available in your `Dangerfile` under the `toc` namespace.
48
-
49
- #### toc.files
50
-
51
- List of files to ensure TOC in, default is `README.md`.
52
-
53
- #### toc.header
42
+ ### toc.header
54
43
 
55
44
  The Table of Contents header, without `#`, default is `Table of Contents`.
56
45
 
57
- #### toc.check
46
+ ```ruby
47
+ config.header = 'Custom Table of Contents'
48
+ ```
49
+
50
+ ### toc.check!
58
51
 
59
- Run all checks with defaults.
52
+ Run all checks.
60
53
 
61
54
  ## Contributing
62
55
 
@@ -64,6 +57,6 @@ See [CONTRIBUTING](CONTRIBUTING.md).
64
57
 
65
58
  ## Copyright
66
59
 
67
- Copyright (c) Daniel Doubrovkine, 2017
60
+ Copyright (c) Daniel Doubrovkine, 2017-2019
68
61
 
69
62
  MIT License, see [LICENSE](LICENSE.txt) for details.
@@ -20,14 +20,4 @@ Gem::Specification.new do |spec|
20
20
  spec.add_dependency 'activesupport'
21
21
  spec.add_dependency 'kramdown'
22
22
  spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
23
-
24
- spec.add_development_dependency 'bundler', '~> 1.3'
25
- spec.add_development_dependency 'guard', '~> 2.14'
26
- spec.add_development_dependency 'guard-rspec', '~> 4.7'
27
- spec.add_development_dependency 'listen'
28
- spec.add_development_dependency 'pry'
29
- spec.add_development_dependency 'rake', '~> 10.0'
30
- spec.add_development_dependency 'rspec', '~> 3.4'
31
- spec.add_development_dependency 'rubocop', '0.58.2'
32
- spec.add_development_dependency 'yard'
33
23
  end
@@ -3,7 +3,16 @@ module Danger
3
3
  module Config
4
4
  extend self
5
5
 
6
- attr_accessor :files, :header
6
+ ATTRIBUTES = %i[
7
+ files
8
+ header
9
+ ].freeze
10
+
11
+ ACCESSORS = ATTRIBUTES.map { |name| "#{name}=".to_sym }
12
+
13
+ DELEGATORS = ATTRIBUTES + ACCESSORS
14
+
15
+ attr_accessor(*Config::ATTRIBUTES)
7
16
  attr_writer :format
8
17
 
9
18
  # Files to process
@@ -35,6 +44,7 @@ module Danger
35
44
 
36
45
  class << self
37
46
  def configure
47
+ warn '[DEPRECATION] `configure` is deprecated. Please directly configure the Danger plugin via `toc.xyz=` instead.'
38
48
  block_given? ? yield(Config) : Config
39
49
  end
40
50
 
@@ -1,3 +1,3 @@
1
1
  module Toc
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
@@ -3,42 +3,44 @@ module Danger
3
3
  #
4
4
  # @example Run all checks on the default README.md.
5
5
  #
6
- # toc.check
6
+ # toc.check!
7
7
  #
8
- # @example Customize filenames and remind the requester to update TOCs when necessary.
8
+ # @example Customize files and remind the requester to update TOCs when necessary.
9
9
  #
10
- # toc.filenames = ['README.md']
10
+ # toc.files = ['README.md']
11
11
  # toc.is_toc_correct?
12
12
  #
13
13
  # @see dblock/danger-toc
14
14
  # @tags toc
15
15
 
16
16
  class DangerToc < Plugin
17
- # The toc filenames, defaults to `[README.md]`.
18
- # @return [Array]
19
- attr_accessor :filenames
17
+ extend Forwardable
20
18
 
21
- def initialize(dangerfile)
22
- @filenames = ['README.md']
23
- super
19
+ def_delegators Danger::Toc.config, *Danger::Toc::Config::DELEGATORS
20
+
21
+ # Run all checks.
22
+ # @return [void]
23
+ def check!
24
+ is_toc_correct?
24
25
  end
25
26
 
26
27
  # Run all checks.
27
28
  # @return [void]
28
29
  def check
29
- is_toc_correct?
30
+ warn '[DEPRECATION] `check` is deprecated. Please use `check!` instead.'
31
+ check!
30
32
  end
31
33
 
32
34
  # Has the README file been modified?
33
35
  # @return [boolean]
34
36
  def toc_changes?
35
- (git.modified_files & filenames).any? || (git.added_files & filenames).any?
37
+ (git.modified_files & files).any? || (git.added_files & files).any?
36
38
  end
37
39
 
38
40
  # Is the TOC format correct?
39
41
  # @return [boolean]
40
42
  def is_toc_correct?
41
- filenames.all? do |filename|
43
+ files.all? do |filename|
42
44
  toc_file = Danger::Toc::MarkdownFile.new(filename)
43
45
  if !toc_file.exists?
44
46
  messaging.fail("The #{filename} file does not exist.", sticky: false)
@@ -14,9 +14,7 @@ describe Danger::Toc::Config do
14
14
  end
15
15
  context 'custom value' do
16
16
  before do
17
- Danger::Toc.configure do |config|
18
- config.files = ['README.md', 'SOMETHING.md']
19
- end
17
+ Danger::Toc.config.files = ['README.md', 'SOMETHING.md']
20
18
  end
21
19
 
22
20
  it 'is set' do
@@ -32,9 +30,7 @@ describe Danger::Toc::Config do
32
30
  end
33
31
  context 'custom value' do
34
32
  before do
35
- Danger::Toc.configure do |config|
36
- config.header = 'Custom TOC'
37
- end
33
+ Danger::Toc.config.header = 'Custom TOC'
38
34
  end
39
35
 
40
36
  it 'is set' do
@@ -52,9 +48,7 @@ describe Danger::Toc::Config do
52
48
 
53
49
  context 'custom value' do
54
50
  before do
55
- Danger::Toc.configure do |config|
56
- config.format = :kramdown
57
- end
51
+ Danger::Toc.config.format = :kramdown
58
52
  end
59
53
 
60
54
  it 'is set' do
@@ -13,7 +13,7 @@ describe Danger::Toc do
13
13
  let(:filename) { File.expand_path('fixtures/markdown_file/one_section_with_toc.md', __dir__) }
14
14
  let(:dangerfile) { testing_dangerfile }
15
15
  let(:toc) do
16
- dangerfile.toc.filenames = [filename]
16
+ dangerfile.toc.files = [filename]
17
17
  dangerfile.toc
18
18
  end
19
19
  let(:status_report) { toc.status_report }
@@ -108,9 +108,7 @@ Here's the expected TOC for #{filename}:
108
108
 
109
109
  context 'with a custom toc header' do
110
110
  before do
111
- Danger::Toc.configure do |config|
112
- config.header = 'Custom TOC'
113
- end
111
+ Danger::Toc.config.header = 'Custom TOC'
114
112
  end
115
113
 
116
114
  context 'with missing TOC' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-toc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dblock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-15 00:00:00.000000000 Z
11
+ date: 2019-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -52,132 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.0'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.3'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.3'
69
- - !ruby/object:Gem::Dependency
70
- name: guard
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '2.14'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '2.14'
83
- - !ruby/object:Gem::Dependency
84
- name: guard-rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '4.7'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '4.7'
97
- - !ruby/object:Gem::Dependency
98
- name: listen
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: pry
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: rake
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '10.0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '10.0'
139
- - !ruby/object:Gem::Dependency
140
- name: rspec
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '3.4'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '3.4'
153
- - !ruby/object:Gem::Dependency
154
- name: rubocop
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - '='
158
- - !ruby/object:Gem::Version
159
- version: 0.58.2
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - '='
165
- - !ruby/object:Gem::Version
166
- version: 0.58.2
167
- - !ruby/object:Gem::Dependency
168
- name: yard
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: '0'
181
55
  description: A danger.systems plugin for your markdown TOC.
182
56
  email:
183
57
  - dblock@dblock.org
@@ -247,8 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
121
  - !ruby/object:Gem::Version
248
122
  version: '0'
249
123
  requirements: []
250
- rubyforge_project:
251
- rubygems_version: 2.7.6
124
+ rubygems_version: 3.0.3
252
125
  signing_key:
253
126
  specification_version: 4
254
127
  summary: A danger.systems plugin for your markdown TOC.