danger-toc 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 38ae0d61092888976e59f8da7acb132be0cd0284
4
+ data.tar.gz: cfd1e2d33f51048d8565908142ffbd35d7fe4803
5
+ SHA512:
6
+ metadata.gz: ae85c1148f5440b7fc2bcb4843118ef32944688e38a5391478130bd325a038fdacea55467ddd2bc14218d314a2be042ca6b334e08d92aea64b82f6cd6585f909
7
+ data.tar.gz: 38b99caf0a4a221a698e918c513b614a882e2c5268eaa9323d1552c2324468ff85368135cfa870d1cc83c053d19481ea5f9be18a0c372a3920a5a9936480d35d
@@ -0,0 +1,5 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
4
+ Gemfile.lock
5
+ .yardoc
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format=documentation
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ Include:
3
+ - Rakefile
4
+ Exclude:
5
+ - vendor/**/*
6
+
7
+ Metrics/BlockLength:
8
+ Enabled: fale
9
+
10
+ Metrics/LineLength:
11
+ Enabled: fale
12
+
13
+ inherit_from: .rubocop_todo.yml
@@ -0,0 +1,92 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2017-11-05 10:44:59 -0500 using RuboCop version 0.51.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 3
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
12
+ # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
13
+ Layout/IndentHeredoc:
14
+ Exclude:
15
+ - 'lib/toc/plugin.rb'
16
+ - 'spec/toc_spec.rb'
17
+
18
+ # Offense count: 1
19
+ Lint/DuplicateMethods:
20
+ Exclude:
21
+ - 'lib/toc/config.rb'
22
+
23
+ # Offense count: 4
24
+ Metrics/AbcSize:
25
+ Max: 18
26
+
27
+ # Offense count: 5
28
+ # Configuration parameters: CountComments, ExcludedMethods.
29
+ Metrics/BlockLength:
30
+ Max: 69
31
+
32
+ # Offense count: 20
33
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
34
+ # URISchemes: http, https
35
+ Metrics/LineLength:
36
+ Max: 119
37
+
38
+ # Offense count: 3
39
+ # Configuration parameters: CountComments.
40
+ Metrics/MethodLength:
41
+ Max: 21
42
+
43
+ # Offense count: 4
44
+ # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
45
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
46
+ Naming/FileName:
47
+ Exclude:
48
+ - 'Dangerfile'
49
+ - 'Gemfile'
50
+ - 'Guardfile'
51
+ - 'danger-toc.gemspec'
52
+
53
+ # Offense count: 2
54
+ # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros.
55
+ # NamePrefix: is_, has_, have_
56
+ # NamePrefixBlacklist: is_, has_, have_
57
+ # NameWhitelist: is_a?
58
+ # MethodDefinitionMacros: define_method, define_singleton_method
59
+ Naming/PredicateName:
60
+ Exclude:
61
+ - 'spec/**/*'
62
+ - 'lib/toc/markdown_file.rb'
63
+ - 'lib/toc/plugin.rb'
64
+
65
+ # Offense count: 6
66
+ Style/Documentation:
67
+ Exclude:
68
+ - 'spec/**/*'
69
+ - 'test/**/*'
70
+ - 'lib/toc/config.rb'
71
+ - 'lib/toc/constructor.rb'
72
+ - 'lib/toc/extractor.rb'
73
+ - 'lib/toc/markdown_file.rb'
74
+ - 'lib/toc/plugin.rb'
75
+
76
+ # Offense count: 3
77
+ Style/DoubleNegation:
78
+ Exclude:
79
+ - 'lib/toc/markdown_file.rb'
80
+
81
+ # Offense count: 2
82
+ # Configuration parameters: MinBodyLength.
83
+ Style/GuardClause:
84
+ Exclude:
85
+ - 'lib/toc/markdown_file.rb'
86
+
87
+ # Offense count: 1
88
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
89
+ # SupportedStyles: module_function, extend_self
90
+ Style/ModuleFunction:
91
+ Exclude:
92
+ - 'lib/toc/config.rb'
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+
3
+ cache:
4
+ directories:
5
+ - bundle
6
+
7
+ rvm:
8
+ - 2.4.1
9
+
10
+ before_script:
11
+ - bundle exec danger
12
+
13
+ script:
14
+ - bundle exec rake spec
@@ -0,0 +1,5 @@
1
+ ## Changelog
2
+
3
+ ### 0.1.0 (2017/11/5)
4
+
5
+ * Initial public release - [@dblock](https://github.com/dblock).
@@ -0,0 +1,125 @@
1
+ # Contributing to Danger-Toc
2
+
3
+ This project is work of [many contributors](https://github.com/dblock/danger-toc/graphs/contributors).
4
+
5
+ You're encouraged to submit [pull requests](https://github.com/dblock/danger-toc/pulls), [propose features and discuss issues](https://github.com/dblock/danger-toc/issues).
6
+
7
+ In the examples below, substitute your Github username for `contributor` in URLs.
8
+
9
+ ### Fork the Project
10
+
11
+ Fork the [project on Github](https://github.com/dblock/danger-toc) and check out your copy.
12
+
13
+ ```
14
+ git clone https://github.com/contributor/danger-toc.git
15
+ cd danger-toc
16
+ git remote add upstream https://github.com/dblock/danger-toc.git
17
+ ```
18
+
19
+ ### Bundle Install and Test
20
+
21
+ Ensure that you can build the project and run tests.
22
+
23
+ ```
24
+ bundle install
25
+ bundle exec rake
26
+ ```
27
+
28
+ ## Contribute Code
29
+
30
+ ### Create a Topic Branch
31
+
32
+ Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
33
+
34
+ ```
35
+ git checkout master
36
+ git pull upstream master
37
+ git checkout -b my-feature-branch
38
+ ```
39
+
40
+ ### Write Tests
41
+
42
+ Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add tests to [spec](spec).
43
+
44
+ We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
45
+
46
+ ### Write Code
47
+
48
+ Implement your feature or bug fix.
49
+
50
+ Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop). Run `bundle exec rubocop` and fix any style issues highlighted, auto-correct issues when possible with `bundle exec rubocop -a`. To silence generally ingored issues, including line lengths or code complexity metrics, run `bundle exec rubocop --auto-gen-config`.
51
+
52
+ Make sure that `bundle exec rake` completes without errors.
53
+
54
+ ### Write Documentation
55
+
56
+ Document any external behavior in the [README](README.md).
57
+
58
+ ### Update Toc
59
+
60
+ Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Don't remove *Your contribution here*.
61
+
62
+ Make it look like every other line, including a link to the issue being fixed, your name and link to your Github account.
63
+
64
+ ### Commit Changes
65
+
66
+ Make sure git knows your name and email address:
67
+
68
+ ```
69
+ git config --global user.name "Your Name"
70
+ git config --global user.email "contributor@example.com"
71
+ ```
72
+
73
+ Writing good commit logs is important. A commit log should describe what changed and why.
74
+
75
+ ```
76
+ git add ...
77
+ git commit
78
+ ```
79
+
80
+ ### Push
81
+
82
+ ```
83
+ git push origin my-feature-branch
84
+ ```
85
+
86
+ ### Make a Pull Request
87
+
88
+ Go to https://github.com/contributor/danger-toc and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
89
+
90
+ ### Update CHANGELOG Again
91
+
92
+ Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
93
+
94
+ ```
95
+ * [#123](https://github.com/dblock/danger-toc/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
96
+ ```
97
+
98
+ Amend your previous commit and force push the changes.
99
+
100
+ ```
101
+ git commit --amend
102
+ git push origin my-feature-branch -f
103
+ ```
104
+
105
+ ### Rebase
106
+
107
+ If you've been working on a change for a while, rebase with upstream/master.
108
+
109
+ ```
110
+ git fetch upstream
111
+ git rebase upstream/master
112
+ git push origin my-feature-branch -f
113
+ ```
114
+
115
+ ### Check on Your Pull Request
116
+
117
+ Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
118
+
119
+ ### Be Patient
120
+
121
+ It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
122
+
123
+ ## Thank You
124
+
125
+ Please do know that we really appreciate and value your time and work. We love you, really.
@@ -0,0 +1,4 @@
1
+ # danger.systems
2
+
3
+ changelog.check
4
+ toc.check
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'danger-changelog', '~> 0.2.0'
@@ -0,0 +1,19 @@
1
+ # A guardfile for making Danger Plugins
2
+ # For more info see https://github.com/guard/guard#readme
3
+
4
+ # To run, use `bundle exec guard`.
5
+
6
+ guard :rspec, cmd: 'bundle exec rspec' do
7
+ require 'guard/rspec/dsl'
8
+ dsl = Guard::RSpec::Dsl.new(self)
9
+
10
+ # RSpec files
11
+ rspec = dsl.rspec
12
+ watch(rspec.spec_helper) { rspec.spec_dir }
13
+ watch(rspec.spec_support) { rspec.spec_dir }
14
+ watch(rspec.spec_files)
15
+
16
+ # Ruby files
17
+ ruby = dsl.ruby
18
+ dsl.watch_spec_files_for(ruby.lib_files)
19
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2017 Daniel Doubrovkine <dblock@dblock.org>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,64 @@
1
+ # danger-toc
2
+
3
+ A plugin for [danger.systems](http://danger.systems) that makes sure your project’s `README.md` has a TOC.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/danger-toc.svg)](https://badge.fury.io/rb/danger-toc)
6
+ [![Build Status](https://travis-ci.org/dblock/danger-toc.svg?branch=master)](https://travis-ci.org/dblock/danger-toc)
7
+
8
+ ## Table of Contents
9
+
10
+ - [Installation](#installation)
11
+ - [Usage](#usage)
12
+ - [Configuration](#configuration)
13
+ - [Methods and Attributes](#methods-and-attributes)
14
+ - [toc.files](#tocfiles)
15
+ - [toc.check](#toccheck)
16
+ - [Contributing](#contributing)
17
+ - [Copyright](#copyright)
18
+
19
+ ## Installation
20
+
21
+ Add `danger-toc` to your Gemfile.
22
+
23
+ ```
24
+ gem 'danger-toc', '~> 0.1'
25
+ ```
26
+
27
+ Add `toc.check` to your Dangerfile. Make a pull request and see this plugin in action.
28
+
29
+ <img src='images/toc-missing.png'>
30
+
31
+ ## Usage
32
+
33
+ ### Configuration
34
+
35
+ The plugin supports following configuration options:
36
+
37
+ You can configure plugin using following code:
38
+ ```ruby
39
+ Danger::Toc.configure do |config|
40
+ config.files = [ 'README.md' ]
41
+ end
42
+ ```
43
+
44
+ ### Methods and Attributes
45
+
46
+ Methods and attributes from this plugin are available in your `Dangerfile` under the `toc` namespace.
47
+
48
+ #### toc.files
49
+
50
+ List of files to ensure TOC in.
51
+
52
+ #### toc.check
53
+
54
+ Run all checks with defaults.
55
+
56
+ ## Contributing
57
+
58
+ See [CONTRIBUTING](CONTRIBUTING.md).
59
+
60
+ ## Copyright
61
+
62
+ Copyright (c) Daniel Doubrovkine, 2017
63
+
64
+ MIT License, see [LICENSE](LICENSE.txt) for details.
@@ -0,0 +1,67 @@
1
+ # Releasing Danger-Toc
2
+
3
+ There're no hard rules about when to release danger-toc. Release bug fixes frequently, features not so frequently and breaking API changes rarely.
4
+
5
+ ### Release
6
+
7
+ Install bundle, run tests, check that all tests succeed locally.
8
+
9
+ ```
10
+ bundle install
11
+ rake
12
+ ```
13
+
14
+ Check that the last build succeeded in [Travis CI](https://travis-ci.org/dblock/danger-toc) for all supported platforms.
15
+
16
+ Increment the version, modify [lib/toc/gem_version.rb](lib/toc/gem_version.rb).
17
+
18
+ Following the [Semantic Versioning](http://semver.org/):
19
+ * Increment the third number if the release has bug fixes and/or very minor features with backward compatibility, only (eg. change `0.2.1` to `0.2.2`).
20
+ * Increment the second number if the release contains major features or breaking API changes (eg. change `0.2.1` to `0.3.0`).
21
+
22
+ Create a new version and mark it as Next in [CHANGELOG.md](CHANGELOG.md).
23
+
24
+ ```
25
+ ### 0.2.2 (12/03/2016)
26
+ ```
27
+
28
+ Remove the line with "* Your contribution here.", since there will be no more contributions to this release.
29
+
30
+ Commit your changes.
31
+
32
+ ```
33
+ git add CHANGELOG.md lib/toc/gem_version.rb
34
+ git commit -m "Preparing for release 0.2.2."
35
+ git push origin master
36
+ ```
37
+
38
+ Release.
39
+
40
+ ```
41
+ $ rake release
42
+
43
+ danger-toc 0.2.2 built to pkg/danger-toc-0.2.2.gem.
44
+ Tagged v0.2.2.
45
+ Pushed git commits and tags.
46
+ Pushed danger-toc 0.2.2 to rubygems.org.
47
+ ```
48
+
49
+ ### Prepare for the Next Version
50
+
51
+ Add the next release to [CHANGELOG.md](CHANGELOG.md).
52
+
53
+ ```
54
+ ### 0.2.3 (Next)
55
+
56
+ * Your contribution here.
57
+ ```
58
+
59
+ Increment the third version number in [lib/toc/gem_version.rb](lib/toc/gem_version.rb).
60
+
61
+ Commit your changes.
62
+
63
+ ```
64
+ git add CHANGELOG.md lib/slack/version.rb
65
+ git commit -m "Preparing for next development iteration, 0.2.3."
66
+ git push origin master
67
+ ```