caretaker 0.2.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.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.rspec +3 -0
- data/.rubocop.yml +77 -0
- data/.travis.yml +68 -0
- data/CHANGELOG.md +13 -0
- data/CODEOWNERS +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +3 -0
- data/Gemfile +6 -0
- data/LICENSE.md +25 -0
- data/README.md +395 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/caretaker.gemspec +30 -0
- data/exe/caretaker +121 -0
- data/lib/caretaker.rb +692 -0
- data/lib/caretaker/version.rb +3 -0
- data/spec/caretaker_spec.rb +5 -0
- data/spec/spec_helper.rb +14 -0
- data/testing/caretaker +124 -0
- metadata +169 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8ae01de9679103e7fd324ce578ad6c0bd3ff00fbab2b4d0eb1964d7ae45aca39
|
|
4
|
+
data.tar.gz: 414155fb956a777182eed40ff69d1769cc356c4b078f45568ab17d20f942443a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8bc530f2a374f70317e93408b50c7a9c61d720e02971d56d64c0e4f6659750da3fd989ad834e13ab58db94e859c5c673044e4733f61e2145c61dd23048646e17
|
|
7
|
+
data.tar.gz: e976dadf1c948e40f70218d5e331c69a6eb4d0fe16655931a727d10ba9de196dfb8c9f1d0e5fd18f79a0906513592b833386b590f648dc9ebcb6a371c836e017
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Layout/CaseIndentation:
|
|
2
|
+
Enabled: false
|
|
3
|
+
|
|
4
|
+
Layout/ClosingHeredocIndentation:
|
|
5
|
+
Enabled: false
|
|
6
|
+
|
|
7
|
+
Layout/FirstHashElementIndentation:
|
|
8
|
+
Enabled: false
|
|
9
|
+
|
|
10
|
+
Layout/HashAlignment:
|
|
11
|
+
Enabled: false
|
|
12
|
+
|
|
13
|
+
Layout/HeredocIndentation:
|
|
14
|
+
Enabled: false
|
|
15
|
+
|
|
16
|
+
Layout/IndentationWidth:
|
|
17
|
+
Width: 4
|
|
18
|
+
|
|
19
|
+
Layout/LineLength:
|
|
20
|
+
Enabled: false
|
|
21
|
+
|
|
22
|
+
Layout/SpaceInsideArrayLiteralBrackets:
|
|
23
|
+
Enabled: false
|
|
24
|
+
|
|
25
|
+
Metrics/AbcSize:
|
|
26
|
+
Enabled: false
|
|
27
|
+
|
|
28
|
+
Metrics/BlockLength:
|
|
29
|
+
Enabled: false
|
|
30
|
+
|
|
31
|
+
Metrics/BlockNesting:
|
|
32
|
+
Enabled: false
|
|
33
|
+
|
|
34
|
+
Metrics/ClassLength:
|
|
35
|
+
Enabled: false
|
|
36
|
+
|
|
37
|
+
Metrics/CyclomaticComplexity:
|
|
38
|
+
Enabled: false
|
|
39
|
+
|
|
40
|
+
Metrics/MethodLength:
|
|
41
|
+
Enabled: false
|
|
42
|
+
|
|
43
|
+
Metrics/PerceivedComplexity:
|
|
44
|
+
Enabled: false
|
|
45
|
+
|
|
46
|
+
Naming/FileName:
|
|
47
|
+
Enabled: false
|
|
48
|
+
|
|
49
|
+
Style/FrozenStringLiteralComment:
|
|
50
|
+
Enabled: false
|
|
51
|
+
|
|
52
|
+
Style/HashSyntax:
|
|
53
|
+
Enabled: false
|
|
54
|
+
|
|
55
|
+
Style/PercentLiteralDelimiters:
|
|
56
|
+
Enabled: false
|
|
57
|
+
|
|
58
|
+
Style/RaiseArgs:
|
|
59
|
+
EnforcedStyle: compact
|
|
60
|
+
|
|
61
|
+
Style/RedundantBegin:
|
|
62
|
+
Enabled: false
|
|
63
|
+
|
|
64
|
+
Style/RedundantConditional:
|
|
65
|
+
Enabled: false
|
|
66
|
+
|
|
67
|
+
Style/RedundantReturn:
|
|
68
|
+
Enabled: false
|
|
69
|
+
|
|
70
|
+
Style/SpecialGlobalVars:
|
|
71
|
+
Enabled: false
|
|
72
|
+
|
|
73
|
+
Style/WordArray:
|
|
74
|
+
EnforcedStyle: brackets
|
|
75
|
+
|
|
76
|
+
Style/RedundantPercentQ:
|
|
77
|
+
Enabled: false
|
data/.travis.yml
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
matrix:
|
|
2
|
+
include:
|
|
3
|
+
- language: ruby
|
|
4
|
+
name: "Bundler (rvm 2.4 & bundler 1.17.3)"
|
|
5
|
+
rvm: 2.4
|
|
6
|
+
before_install:
|
|
7
|
+
- gem install bundler -v 1.17.3
|
|
8
|
+
- language: ruby
|
|
9
|
+
name: "Bundler (rvm 2.4 & bundler 2.0.1)"
|
|
10
|
+
rvm: 2.4
|
|
11
|
+
before_install:
|
|
12
|
+
- gem install bundler -v 2.0.1
|
|
13
|
+
- language: ruby
|
|
14
|
+
name: "Bundler (rvm 2.5 & bundler 2.0.1)"
|
|
15
|
+
rvm: 2.5
|
|
16
|
+
before_install:
|
|
17
|
+
- gem install bundler -v 2.0.1
|
|
18
|
+
- language: ruby
|
|
19
|
+
name: "Bundler (rvm 2.6 & bundler 2.0.1)"
|
|
20
|
+
rvm: 2.6
|
|
21
|
+
before_install:
|
|
22
|
+
- gem install bundler -v 2.0.1
|
|
23
|
+
- language: ruby
|
|
24
|
+
name: "Rubocop (rvm 2.4)"
|
|
25
|
+
env: SKIP_INTERPRETER=true
|
|
26
|
+
rvm: 2.4
|
|
27
|
+
before_install:
|
|
28
|
+
- git clone https://github.com/TravisToolbox/rubocop-travis.git
|
|
29
|
+
install:
|
|
30
|
+
- ./rubocop-travis/install.sh
|
|
31
|
+
script:
|
|
32
|
+
- ./rubocop-travis/scan.sh
|
|
33
|
+
- language: ruby
|
|
34
|
+
name: "Rubocop (rvm 2.5)"
|
|
35
|
+
env: SKIP_INTERPRETER=true
|
|
36
|
+
rvm: 2.5
|
|
37
|
+
before_install:
|
|
38
|
+
- git clone https://github.com/TravisToolbox/rubocop-travis.git
|
|
39
|
+
install:
|
|
40
|
+
- ./rubocop-travis/install.sh
|
|
41
|
+
script:
|
|
42
|
+
- ./rubocop-travis/scan.sh
|
|
43
|
+
- language: ruby
|
|
44
|
+
name: "Rubocop (rvm 2.6)"
|
|
45
|
+
env: SKIP_INTERPRETER=true
|
|
46
|
+
rvm: 2.6
|
|
47
|
+
before_install:
|
|
48
|
+
- git clone https://github.com/TravisToolbox/rubocop-travis.git
|
|
49
|
+
install:
|
|
50
|
+
- ./rubocop-travis/install.sh
|
|
51
|
+
script:
|
|
52
|
+
- ./rubocop-travis/scan.sh
|
|
53
|
+
- language: ruby
|
|
54
|
+
name: Link Checking (rvm 2.6)
|
|
55
|
+
rvm: 2.6
|
|
56
|
+
env:
|
|
57
|
+
- WHITELIST="https://github.com/WolfSoftware/caretaker,https://img.shields.io"
|
|
58
|
+
before_install:
|
|
59
|
+
- mkdir travis
|
|
60
|
+
- git clone https://github.com/TravisToolbox/awesomebot-travis.git travis/awesomebot
|
|
61
|
+
install:
|
|
62
|
+
- "./travis/awesomebot/install.sh"
|
|
63
|
+
script:
|
|
64
|
+
- "./travis/awesomebot/scan.sh"
|
|
65
|
+
notifications:
|
|
66
|
+
email: false
|
|
67
|
+
slack:
|
|
68
|
+
secure: VlksQ+/ir1FybDRDbsps3/1oWqt46clxR30qE+mQUWHTyXbHW7iNWb/rcXDpF2/4/e9TvDeqgvkaMBhPIOs0JT6vIRAo++A60o6XoIvmEhsRdnB+qYR9OeZ30X7z56LuiiWKzGQZSzEYlzUdgw2KV3AursAoe/tJWnAsA1VK85b9dxE2O8Vfla3BfrECQVfYlzZ5ANk+bnpjMv6FNSv2PT//iVl60SPAL5d9ryvAOZbPgD0c9BkhiuHz2W8RO/p7LZ6UlfXofnOgk9Z+eCBwamkMphlKYSFPMKvrLJoISqwjfIRH5+x1RF5wJZAcTZbeIffezw3TVjRMyTnUL2OqdRimBPgRLX+LuD7SmRuo84wfN90L/DKChaS4FJ8PiLK2u8bJepmQ7hxWdB8mAGW6t8OK7arAKGnrJ2Kkk/j7iIjopPpYMO/l2Vdr4hOCsXvPAi2G55CyxD+L3QTfm1QUXGCzyqbFlV6vmjDr8pxeseptDgyF0g2DzHymG/1M3vJttsenDlBRZn0Yv5VMekIetzouYWFlNkt1A9idOZmfG+ZoV0Zog90YFjRayGv2h/PEpZ7iWlJmawo/TifEv9J1DJgRXFmS5eLstV9TonpAl+xhn/yvxU1xmDHo4M3fKIPDPix0OAdRsSh+aHYdmkUVPFkCEqaPhvWUyOA6TJFoCoo=
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
This changelog was automatically generated using [Caretaker](https://github.com/WolfSoftware/caretaker) by [Wolf Software](https://github.com/WolfSoftware)
|
|
7
|
+
|
|
8
|
+
### [v0.1.0](https://github.com/WolfSoftware/caretaker/releases/v0.1.0)
|
|
9
|
+
|
|
10
|
+
> Released on February, 10th 2020
|
|
11
|
+
|
|
12
|
+
- Initial push [`[f74a2c4]`](https://github.com/WolfSoftware/caretaker/commit/f74a2c411bf3339410d6a0f59a981abf6286107e)
|
|
13
|
+
|
data/CODEOWNERS
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at wolf@tgwolf.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: https://contributor-covenant.org
|
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
=====================
|
|
3
|
+
|
|
4
|
+
Copyright © `2009-2020` `Wolf Software Limited`
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person
|
|
7
|
+
obtaining a copy of this software and associated documentation
|
|
8
|
+
files (the “Software”), to deal in the Software without
|
|
9
|
+
restriction, including without limitation the rights to use,
|
|
10
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the
|
|
12
|
+
Software is furnished to do so, subject to the following
|
|
13
|
+
conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
20
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
22
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
23
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
24
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
25
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
[](https://travis-ci.org/WolfSoftware/caretaker)
|
|
2
|
+
[](LICENSE.md)
|
|
3
|
+
[](https://github.com/WolfSoftware/caretaker/releases/latest)
|
|
4
|
+
[](https://github.com/WolfSoftware/caretaker/releases/latest)
|
|
5
|
+
[](https://github.com/WolfSoftware/caretaker/commits)
|
|
6
|
+
[](https://github.com/WolfSoftware/caretaker/commits/master)
|
|
7
|
+
[](#)
|
|
8
|
+
[](#)
|
|
9
|
+
[](https://github.com/WolfSoftware/caretaker/graphs/contributors)
|
|
10
|
+
[](https://github.com/WolfSoftware)
|
|
11
|
+
|
|
12
|
+
<a name="caretaker"></a>
|
|
13
|
+
# Caretaker
|
|
14
|
+
|
|
15
|
+
Caretaker is an automated changelog generator. It works by reading the commit history for the repository and generates the changelog based on that. It requires no human intervention, and will work happily with existing repositories and their existing git histories.
|
|
16
|
+
|
|
17
|
+
Caretaker also has an advanced category mode, which allows it to parse specially crafted commit messages and split the CHANGELOG into categories (per release).
|
|
18
|
+
|
|
19
|
+
<a name="additional-features"></a>
|
|
20
|
+
## Additional features
|
|
21
|
+
|
|
22
|
+
* Converting a GitHub username tag into a link to the GitHub user (appended to the commit message).
|
|
23
|
+
* Automatically linking each commit message to the hash of that commit.
|
|
24
|
+
* Automatically linking each pull request to the pull request number.
|
|
25
|
+
* Can run automatically as a post-commit hook.
|
|
26
|
+
* Ignore commits that are shorter than a specified number of words.
|
|
27
|
+
|
|
28
|
+
> For a full list of featues see the section on command line usage.
|
|
29
|
+
|
|
30
|
+
<a name="table-of-contents"></a>
|
|
31
|
+
## Table of contents
|
|
32
|
+
|
|
33
|
+
<!--TOCBot-->
|
|
34
|
+
* [Caretaker](#caretaker)
|
|
35
|
+
* [Additional features](#additional-features)
|
|
36
|
+
* [Table of contents](#table-of-contents)
|
|
37
|
+
* [Installation](#installation)
|
|
38
|
+
* [Command line usage](#command-line-usage)
|
|
39
|
+
* [Basic usage](#basic-usage)
|
|
40
|
+
* [Initialise the repository](#initialise-the-repository)
|
|
41
|
+
* [The post-commit hook](#the-post-commit-hook)
|
|
42
|
+
* [Customisation](#customisation)
|
|
43
|
+
* [Example of customised usage](#example-of-customised-usage)
|
|
44
|
+
* [Resulting post-commit hook](#resulting-post-commit-hook)
|
|
45
|
+
* [Advanced usage](#advanced-usage)
|
|
46
|
+
* [Category example](#category-example)
|
|
47
|
+
* [Category list](#category-list)
|
|
48
|
+
* [Example category output](#example-category-output)
|
|
49
|
+
* [Caretaker config file](#caretaker-config-file)
|
|
50
|
+
* [Example config file](#example-config-file)
|
|
51
|
+
* [Github usernames](#github-usernames)
|
|
52
|
+
* [Github username example](#github-username-example)
|
|
53
|
+
* [Github username command line example](#github-username-command-line-example)
|
|
54
|
+
* [Result](#result)
|
|
55
|
+
* [Pull requests and commits](#pull-requests-and-commits)
|
|
56
|
+
* [Pull request linking example](#pull-request-linking-example)
|
|
57
|
+
* [Issues](#issues)
|
|
58
|
+
* [Issues link example](#issues-link-example)
|
|
59
|
+
* [Issues link result](#issues-link-result)
|
|
60
|
+
* [Using caretaker in your own code](#using-caretaker-in-your-own-code)
|
|
61
|
+
* [Installation](#installation)
|
|
62
|
+
* [Usage](#usage)
|
|
63
|
+
* [Load the gem](#load-the-gem)
|
|
64
|
+
* [Initialise](#initialise)
|
|
65
|
+
* [Generate a changelog](#generate-a-changelog)
|
|
66
|
+
* [Initialise the git repo](#initialise-the-git-repo)
|
|
67
|
+
* [Contributing to caretaker](#contributing-to-caretaker)
|
|
68
|
+
* [Setup](#setup)
|
|
69
|
+
* [Testing](#testing)
|
|
70
|
+
<!--TOCBot-->
|
|
71
|
+
|
|
72
|
+
<a name="installation"></a>
|
|
73
|
+
## Installation
|
|
74
|
+
|
|
75
|
+
Installing caretaker is very simple, just execute the following command.
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
gem install caretaker
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
<a name="command-line-usage"></a>
|
|
82
|
+
## Command line usage
|
|
83
|
+
|
|
84
|
+
Caretaker has a number of command line options:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
Usage: caretaker [-h] [-a author] [-c] [-e] [-i] [-o filename] [-r] [-s] [-u] [-w number]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
| Option | Purpose | Default Value |
|
|
91
|
+
| ------ | ------- |:-------------:|
|
|
92
|
+
| -h or --help | Show the help message | N/A |
|
|
93
|
+
| -a or --author [Github username] | Specify the author name | |
|
|
94
|
+
| -c or --config | Generate a .caretaker.cfg config file. | false |
|
|
95
|
+
| -e or --enable-categories | Enable the splitting of commit messages into categories | false |
|
|
96
|
+
| -i or --init | Initialise the repo to use caretaker | |
|
|
97
|
+
| -o or --output [filename] | Set the name of the output file | CHANGELOG.md |
|
|
98
|
+
| -r or --remove-categories | Remove categories from commit messages. --enable-categories sets this to true | false |
|
|
99
|
+
| -s or --silent | Turn off all output from Caretaker, aka Silent Mode | false |
|
|
100
|
+
| -u or --url-verification | Verify each url to ensure that the links are valid, skip any links that are not | false |
|
|
101
|
+
| -w or --words number | Minimum number of words needed to include a commit. | 1 |
|
|
102
|
+
|
|
103
|
+
<a name="basic-usage"></a>
|
|
104
|
+
### Basic usage
|
|
105
|
+
|
|
106
|
+
<a name="initialise-the-repository"></a>
|
|
107
|
+
### Initialise the repository
|
|
108
|
+
|
|
109
|
+
This step isn't required but running the following command configures your repository to use caretaker automatically on every commit to ensure that your changelog is as up-to-date as possible.
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
caretaker -i
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
What is actually does is create a post-commit hook in your git repo which execute caretaker and adds the updated CHANGELOG.md to the commit ready for you to push.
|
|
116
|
+
|
|
117
|
+
<a name="the-post-commit-hook"></a>
|
|
118
|
+
#### The post-commit hook
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
#!/usr/bin/env bash
|
|
122
|
+
|
|
123
|
+
OUTPUT_FILE="CHANGELOG.md"
|
|
124
|
+
|
|
125
|
+
caretaker
|
|
126
|
+
|
|
127
|
+
res=$(git status --porcelain | grep "${OUTPUT_FILE}" | wc -l)
|
|
128
|
+
if [[ "${res}" -gt 0 ]]; then
|
|
129
|
+
git add "${OUTPUT_FILE}"
|
|
130
|
+
git commit --amend --no-edit
|
|
131
|
+
end
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
<a name="customisation"></a>
|
|
135
|
+
### Customisation
|
|
136
|
+
|
|
137
|
+
There are a number of ways in which you can customise the way caretaker works, you can enable category mode, or change the output file from CHANGELOG.md to some other name. If you do this as part of the initialisation then the settings are retained.
|
|
138
|
+
|
|
139
|
+
<a name="example-of-customised-usage"></a>
|
|
140
|
+
#### Example of customised usage
|
|
141
|
+
```
|
|
142
|
+
caretaker -i -e -o HISTORY.md
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
<a name="resulting-post-commit-hook"></a>
|
|
146
|
+
#### Resulting post-commit hook
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
#!/usr/bin/env bash
|
|
150
|
+
|
|
151
|
+
OUTPUT_FILE="CHANGELOG.md"
|
|
152
|
+
|
|
153
|
+
caretaker -i -e -o HISTORY.md
|
|
154
|
+
|
|
155
|
+
res=$(git status --porcelain | grep "${OUTPUT_FILE}" | wc -l)
|
|
156
|
+
if [[ "${res}" -gt 0 ]]; then
|
|
157
|
+
git add "${OUTPUT_FILE}"
|
|
158
|
+
git commit --amend --no-edit
|
|
159
|
+
end
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
It is worth noting the final git commit command the ```--amend``` tells git to amend the last commit and add in the output file and the ```--no-edit``` tells git that we do not want to edit the commit message and to retain the previous one.
|
|
163
|
+
|
|
164
|
+
Once the initialisation is complete, you should never need to do anything else as caretaker will run automatically and keep your changelog up-to-date. You can re-run the init command at anytime if you wish to change the configuration that you are using.
|
|
165
|
+
|
|
166
|
+
If you do not want to run caretaker automatically, maybe you are just evaluating it and are not yet ready to fully automate the process, then you can run caretaker manually from the command line.
|
|
167
|
+
|
|
168
|
+
<a name="advanced-usage"></a>
|
|
169
|
+
## Advanced usage
|
|
170
|
+
|
|
171
|
+
Amongst other things Caretaker has a category mode (-e or --enable-categories) which allows for the grouping of changes by category. This is done by using special tags as a prefix to your commit messaged. It will parse these prefixes and group like commits together, within a specific release.
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
git commit -m "<category>: <message>"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
<a name="category-example"></a>
|
|
178
|
+
### Category example
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
git commit -m "docs: Updated the README.md to include an example."
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
<a name="category-list"></a>
|
|
185
|
+
#### Category list
|
|
186
|
+
|
|
187
|
+
The categories are used for splitting the changelog into logical sections. In the following table the category is what is displayed in the CHANGELOG.md (as the section header), and the patterns are the strings that it will match on when parsing the commit messages.
|
|
188
|
+
|
|
189
|
+
> The matching is case-insensitive.
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
| Category | Patterns | Purpose |
|
|
193
|
+
| -------- | -------- | ------- |
|
|
194
|
+
| New Features | new features, new feature, new, feature | Any new features that have been added |
|
|
195
|
+
| Improvements | improvements, improvement | Any improvement or enhancement of an existing feature |
|
|
196
|
+
| Bug Fixes | bug fixes, bug fix, bug, bugs | Any bug fixes to existing features |
|
|
197
|
+
| Security Fixes | security fixes, security | Any security fixes to existing features |
|
|
198
|
+
| Refactor | refactor | A code change that neither fixes a bug or adds a feature |
|
|
199
|
+
| Style | style | A change that does not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) |
|
|
200
|
+
| Deprecated | deprecated | Any existing feature that is being deprecated |
|
|
201
|
+
| Removed | removed | Any existing feature that is being removed |
|
|
202
|
+
| Tests | tests, test, testing | Any changes to the existing tests |
|
|
203
|
+
| Documentation | documentation, docs | Changes to documentation only |
|
|
204
|
+
| Chores | chores, chore | Changes to the build process or auxiliary tools and libraries such as documentation generation |
|
|
205
|
+
| Experiments | experiments, experiment | Any experiments that you are carrying out, these are things that might get added and then removed again |
|
|
206
|
+
| Miscellaneous | miscellaneous, misc | Anything else (this shouldn't really be required) |
|
|
207
|
+
| Initial Commit | initial commit, initial | A special tag for the initial commit to the repo |
|
|
208
|
+
| Skip | skip, ignore | A special tag to ignore adding the commit to the CHANGELOG |
|
|
209
|
+
|
|
210
|
+
> Any commit without a matching category will be added to an 'Uncategorised' group.
|
|
211
|
+
|
|
212
|
+
<a name="example-category-output"></a>
|
|
213
|
+
#### Example category output
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
# Changelog
|
|
217
|
+
|
|
218
|
+
All notable changes to this project will be documented in this file.
|
|
219
|
+
|
|
220
|
+
### [Unreleased](https://github.com/WolfSoftware/caretaker/compare/v1.0.0...HEAD)
|
|
221
|
+
|
|
222
|
+
###### Documentation:
|
|
223
|
+
|
|
224
|
+
- Updated the README.md to include an example.
|
|
225
|
+
|
|
226
|
+
###### Uncategorised:
|
|
227
|
+
|
|
228
|
+
- Created an example without a prefix.
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
<a name="caretaker-config-file"></a>
|
|
232
|
+
### Caretaker config file
|
|
233
|
+
|
|
234
|
+
Caretaker allows you to generate a config file (-c or --config-file) which it will read automatically, so that you do not need to provide command line flags each time you run Caretaker, this file is also read when you run Caretaker via the post-commit hook.
|
|
235
|
+
|
|
236
|
+
It will look in the base of the current git repository for the config file, if it is not found it will then check your home directory, if still not found it will check the current directory and every parent directory until it either finds a config file or runs out of directories to check. Placing the config file, for example, in your home directory will have the effect of making it global for ALL your git repositories.
|
|
237
|
+
|
|
238
|
+
> The config file is called ```.caretaker.yml```.
|
|
239
|
+
|
|
240
|
+
You can run Caretaker with command line options and if you add the -c option it will generate the config (in the base of your git repository) with the settings you specificy.
|
|
241
|
+
|
|
242
|
+
<a name="example-config-file"></a>
|
|
243
|
+
#### Example config file
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
enable-categories: false
|
|
247
|
+
min-words: 1
|
|
248
|
+
remove-categories: false
|
|
249
|
+
silent: false
|
|
250
|
+
verify-urls: false
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
<a name="github-usernames"></a>
|
|
254
|
+
### Github usernames
|
|
255
|
+
|
|
256
|
+
Caretaker is also able to parse commit messages for special tags which specify a GitHub username and converts those tags into a link to the user. This link appended to the commit messages.
|
|
257
|
+
|
|
258
|
+
<a name="github-username-example"></a>
|
|
259
|
+
#### Github username example
|
|
260
|
+
```
|
|
261
|
+
git commit -m "docs: This is a GitHub username example. {TGWolf}"
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
In addition you can set a username using the -a option:
|
|
265
|
+
|
|
266
|
+
<a name="github-username-command-line-example"></a>
|
|
267
|
+
#### Github username command line example
|
|
268
|
+
```
|
|
269
|
+
git commit -m "docs: This is a GitHub username example." -a TGWolf
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
You can also use the -a option along with the -i (init) option to set the username as your default for all commits.
|
|
273
|
+
|
|
274
|
+
If there is already a {author} tag within the commit then the -a option is ignored for that commit, it is only appended to commits with no author. This stops double entries if you enable -a after you have already tagged commits with an author.
|
|
275
|
+
|
|
276
|
+
<a name="result"></a>
|
|
277
|
+
#### Result
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
- This is a GitHub username example. [`[Author: TGWolf]`](https://github.com/TGWolf)
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
<a name="pull-requests-and-commits"></a>
|
|
284
|
+
### Pull requests and commits
|
|
285
|
+
|
|
286
|
+
Caretaker is also able to identify the difference between pull requests and commits and automatically creates a link to either the pull request number or the commit it.
|
|
287
|
+
|
|
288
|
+
<a name="pull-request-linking-example"></a>
|
|
289
|
+
#### Pull request linking example
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
- This is a normal commit. [`[17df108]`](https://github.com/WolfSoftware/caretaker/commit/17df1080a501ed1bb780aa946190d64966dc30df)
|
|
293
|
+
- This is a pull request. [`[#7]`](https://github.com/WolfSoftware/caretaker/pull/7)
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
<a name="issues"></a>
|
|
297
|
+
### Issues
|
|
298
|
+
|
|
299
|
+
It is also possible to specify a tag within the commit to tell caretaker that the commit relates to an issue and caretaker will create a link to that issues.
|
|
300
|
+
|
|
301
|
+
<a name="issues-link-example"></a>
|
|
302
|
+
#### Issues link example
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
git commit -m "Bug: This fixes a bug in the code and resolves issue (issue-7).
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
<a name="issues-link-result"></a>
|
|
309
|
+
#### Issues link result
|
|
310
|
+
|
|
311
|
+
```
|
|
312
|
+
##### Bug Fixes:
|
|
313
|
+
|
|
314
|
+
This fixes a bug in the code and resolves issue [`[#7]`](https://github.com/WolfSoftware/caretaker/issues/7)
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
<a name="using-caretaker-in-your-own-code"></a>
|
|
318
|
+
## Using caretaker in your own code
|
|
319
|
+
|
|
320
|
+
<a name="installation"></a>
|
|
321
|
+
### Installation
|
|
322
|
+
|
|
323
|
+
Add this line to your application's Gemfile:
|
|
324
|
+
|
|
325
|
+
```ruby
|
|
326
|
+
gem 'caretaker'
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
And then execute:
|
|
330
|
+
|
|
331
|
+
```
|
|
332
|
+
$ bundle install
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Or install it yourself as:
|
|
336
|
+
|
|
337
|
+
```
|
|
338
|
+
$ gem install caretaker
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
<a name="usage"></a>
|
|
342
|
+
### Usage
|
|
343
|
+
|
|
344
|
+
<a name="load-the-gem"></a>
|
|
345
|
+
#### Load the gem
|
|
346
|
+
```ruby
|
|
347
|
+
require 'caretaker'
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
<a name="initialise"></a>
|
|
351
|
+
#### Initialise
|
|
352
|
+
|
|
353
|
+
```ruby
|
|
354
|
+
caretaker = Caretaker.new(output: 'HISTORY.md')
|
|
355
|
+
```
|
|
356
|
+
> output is `optional` and will default to `CHANGELOG.md`
|
|
357
|
+
|
|
358
|
+
<a name="generate-a-changelog"></a>
|
|
359
|
+
#### Generate a changelog
|
|
360
|
+
|
|
361
|
+
```ruby
|
|
362
|
+
Caretaker.generate_changelog
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
<a name="initialise-the-git-repo"></a>
|
|
366
|
+
#### Initialise the git repo
|
|
367
|
+
|
|
368
|
+
```Ruby
|
|
369
|
+
Caretaker.init_repo
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
<a name="contributing-to-caretaker"></a>
|
|
373
|
+
## Contributing to caretaker
|
|
374
|
+
|
|
375
|
+
<a name="setup"></a>
|
|
376
|
+
### Setup
|
|
377
|
+
|
|
378
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
379
|
+
|
|
380
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will
|
|
381
|
+
create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
382
|
+
|
|
383
|
+
<a name="testing"></a>
|
|
384
|
+
### Testing
|
|
385
|
+
|
|
386
|
+
For local testing make sure that you run `bundle exec rspec spec` and then `rake install` to install the gem locally.
|
|
387
|
+
|
|
388
|
+
For further information please refer to the [contributing](https://github.com/WolfSoftware/contributing) documentation.
|
|
389
|
+
|
|
390
|
+
# To-Do List
|
|
391
|
+
|
|
392
|
+
- [ ] CLI option to enable/disable linking to commit hashes
|
|
393
|
+
- [ ] CLI option to enable/disable linking to pull requests
|
|
394
|
+
- [ ] CLI option to enable/disable linking to github users
|
|
395
|
+
|