caretaker 0.8.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
+ SHA256:
3
+ metadata.gz: 8616351a1037043537769ea4bce8fb8c0488e801b978d180ce08664be2abd82d
4
+ data.tar.gz: 28ba5a45a167cb04ed26d7609601e206c7e494f2a0fa4426faea7f2b40cc5675
5
+ SHA512:
6
+ metadata.gz: 612476cb1b2edf7537681a1951493ad1f44e0c90b278e92735672ee2cd1ef93e2dbd126aa775a4ef8bbd197ab09cc64e357ceb902b48ea0e2c05d20e21528bc5
7
+ data.tar.gz: cd6060a430808aedf702722f4083c6ee502f707d72ab46c0929c774908f967a9ca2a6efa6f2b85991611507d170a837f3edb5fbb794be232acfa72b4e442bdd5
@@ -0,0 +1,22 @@
1
+ .idea
2
+ ab-results*
3
+
4
+ /.bundle/
5
+ /.yardoc
6
+ /_yardoc/
7
+ /coverage/
8
+ /doc/
9
+ /pkg/
10
+ /spec/reports/
11
+ /tmp/
12
+
13
+ /Gemfile.lock
14
+
15
+ *.gem
16
+
17
+ # rspec failure tracking
18
+ .rspec_status
19
+
20
+ .lock
21
+
22
+ .caretaker.yml
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,80 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+
4
+ Layout/CaseIndentation:
5
+ Enabled: false
6
+
7
+ Layout/ClosingHeredocIndentation:
8
+ Enabled: false
9
+
10
+ Layout/FirstHashElementIndentation:
11
+ Enabled: false
12
+
13
+ Layout/HashAlignment:
14
+ Enabled: false
15
+
16
+ Layout/HeredocIndentation:
17
+ Enabled: false
18
+
19
+ Layout/IndentationWidth:
20
+ Width: 4
21
+
22
+ Layout/LineLength:
23
+ Enabled: false
24
+
25
+ Layout/SpaceInsideArrayLiteralBrackets:
26
+ Enabled: false
27
+
28
+ Metrics/AbcSize:
29
+ Enabled: false
30
+
31
+ Metrics/BlockLength:
32
+ Enabled: false
33
+
34
+ Metrics/BlockNesting:
35
+ Enabled: false
36
+
37
+ Metrics/ClassLength:
38
+ Enabled: false
39
+
40
+ Metrics/CyclomaticComplexity:
41
+ Enabled: false
42
+
43
+ Metrics/MethodLength:
44
+ Enabled: false
45
+
46
+ Metrics/PerceivedComplexity:
47
+ Enabled: false
48
+
49
+ Naming/FileName:
50
+ Enabled: false
51
+
52
+ Style/FrozenStringLiteralComment:
53
+ Enabled: false
54
+
55
+ Style/HashSyntax:
56
+ Enabled: false
57
+
58
+ Style/PercentLiteralDelimiters:
59
+ Enabled: false
60
+
61
+ Style/RaiseArgs:
62
+ EnforcedStyle: compact
63
+
64
+ Style/RedundantBegin:
65
+ Enabled: false
66
+
67
+ Style/RedundantConditional:
68
+ Enabled: false
69
+
70
+ Style/RedundantReturn:
71
+ Enabled: false
72
+
73
+ Style/SpecialGlobalVars:
74
+ Enabled: false
75
+
76
+ Style/WordArray:
77
+ EnforcedStyle: brackets
78
+
79
+ Style/RedundantPercentQ:
80
+ Enabled: false
@@ -0,0 +1,64 @@
1
+ matrix:
2
+ include:
3
+ - language: ruby
4
+ name: "Bundler (rvm 2.5 & bundler latest)"
5
+ rvm: 2.5
6
+ before_install:
7
+ - gem install bundler
8
+ - language: ruby
9
+ name: "Bundler (rvm 2.6 & bundler latest)"
10
+ rvm: 2.6
11
+ before_install:
12
+ - gem install bundler
13
+ - language: ruby
14
+ name: "Bundler (rvm 2.7 & bundler latest)"
15
+ rvm: 2.7
16
+ before_install:
17
+ - gem install bundler
18
+ - language: ruby
19
+ name: "Rubocop (rvm 2.5)"
20
+ env: SKIP_INTERPRETER=true
21
+ rvm: 2.5
22
+ before_install:
23
+ - git clone https://github.com/TravisToolbox/rubocop-travis.git
24
+ install:
25
+ - ./rubocop-travis/install.sh
26
+ script:
27
+ - ./rubocop-travis/scan.sh
28
+ - language: ruby
29
+ name: "Rubocop (rvm 2.6)"
30
+ env: SKIP_INTERPRETER=true
31
+ rvm: 2.6
32
+ before_install:
33
+ - git clone https://github.com/TravisToolbox/rubocop-travis.git
34
+ install:
35
+ - ./rubocop-travis/install.sh
36
+ script:
37
+ - ./rubocop-travis/scan.sh
38
+ - language: ruby
39
+ name: "Rubocop (rvm 2.7)"
40
+ env: SKIP_INTERPRETER=true
41
+ rvm: 2.7
42
+ before_install:
43
+ - git clone https://github.com/TravisToolbox/rubocop-travis.git
44
+ install:
45
+ - ./rubocop-travis/install.sh
46
+ script:
47
+ - ./rubocop-travis/scan.sh
48
+ - language: ruby
49
+ name: Link Checking (rvm 2.7)
50
+ rvm: 2.7
51
+ env:
52
+ - WHITELIST="https://img.shields.io,https://github.com/WolfSoftware/caretaker/compare/,https://github.com/WolfSoftware/caretaker/commit/,https://github.com/WolfSoftware/caretaker/issues/"
53
+ - EXCLUDE_FILES="CHANGELOG.md"
54
+ before_install:
55
+ - mkdir travis
56
+ - git clone https://github.com/TravisToolbox/awesomebot-travis.git travis/awesomebot
57
+ install:
58
+ - "./travis/awesomebot/install.sh"
59
+ script:
60
+ - "./travis/awesomebot/scan.sh"
61
+ notifications:
62
+ email: false
63
+ slack:
64
+ 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=
@@ -0,0 +1,65 @@
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.8.0](https://github.com/WolfSoftware/caretaker/compare/v0.7.0...v0.8.0)
9
+
10
+ > Released on March, 9th 2020
11
+
12
+ - Fix link checking whitelist [`[75d98d2]`](https://github.com/WolfSoftware/caretaker/commit/75d98d2413692ccabd88749b09707db8d7c79cb5) [`[TGWolf]`](https://github.com/TGWolf)
13
+
14
+ - Remove ruby 2.4 support and add 2.7 [`[6bd8c16]`](https://github.com/WolfSoftware/caretaker/commit/6bd8c1635d4953ed2ac472e8fc9ba6efcdd90f9f) [`[TGWolf]`](https://github.com/TGWolf)
15
+
16
+ - Fix rubocop issues around pinned ruby version [`[43e3155]`](https://github.com/WolfSoftware/caretaker/commit/43e3155c16d4db4a20803f449153bf726b911baa) [`[TGWolf]`](https://github.com/TGWolf)
17
+
18
+ ### [v0.7.0](https://github.com/WolfSoftware/caretaker/compare/v0.5.0...v0.7.0)
19
+
20
+ > Released on March, 9th 2020
21
+
22
+ - Fix a security issue with the new git@ code - yanked insecure version [`[48cc7b3]`](https://github.com/WolfSoftware/caretaker/commit/48cc7b3423a67c449074f7413fbbca18ccf1ccae) [`[TGWolf]`](https://github.com/TGWolf)
23
+
24
+ - Fixed a security warning in rake version and make caretaker work with git@ urls as well as https [`[48e7584]`](https://github.com/WolfSoftware/caretaker/commit/48e7584cb9e4f33922a278fb0d688202a5f08f35) [`[TGWolf]`](https://github.com/TGWolf)
25
+
26
+ - Update README with relation to pushing the tag to the remote [`[203f1e3]`](https://github.com/WolfSoftware/caretaker/commit/203f1e351d8c4e361687360b8305017688e73736) [`[TGWolf]`](https://github.com/TGWolf)
27
+
28
+ ### [v0.5.0](https://github.com/WolfSoftware/caretaker/compare/v0.4.0...v0.5.0)
29
+
30
+ > Released on February, 24th 2020
31
+
32
+ - Fix an error in the post-commit script where the wrong variable name was being used [`[c478e37]`](https://github.com/WolfSoftware/caretaker/commit/c478e376120aa0eb22b890b949218fb48df44b20) [`[TGWolf]`](https://github.com/TGWolf)
33
+
34
+ ### [v0.4.0](https://github.com/WolfSoftware/caretaker/compare/v0.3.0...v0.4.0)
35
+
36
+ > Released on February, 24th 2020
37
+
38
+ - Updated version file for push of gem [`[8dfae21]`](https://github.com/WolfSoftware/caretaker/commit/8dfae211ec5ab70477d3d6587d84cc043a790d64) [`[TGWolf]`](https://github.com/TGWolf)
39
+
40
+ - Fix errors from travis + rubocop [`[5e69549]`](https://github.com/WolfSoftware/caretaker/commit/5e69549506726a8782899d004b64b56ba6fe4729) [`[TGWolf]`](https://github.com/TGWolf)
41
+
42
+ - Fix some issues raised by shellcheck in the post-commit hook [`[caa33d2]`](https://github.com/WolfSoftware/caretaker/commit/caa33d239b00cbea48f9123177a126cade113fac) [`[TGWolf]`](https://github.com/TGWolf)
43
+
44
+ - Add new release tagging and version bumping [`[786ed88]`](https://github.com/WolfSoftware/caretaker/commit/786ed88d1bf3486b03fbc2ee755d4ae4c763ab96) [`[TGWolf]`](https://github.com/TGWolf)
45
+
46
+ - Updated changelog to reflect current version [`[007fa21]`](https://github.com/WolfSoftware/caretaker/commit/007fa219d4845f1910cd625a325574f80909153a) [`[TGWolf]`](https://github.com/TGWolf)
47
+
48
+ ### [v0.3.0](https://github.com/WolfSoftware/caretaker/compare/v0.2.0...v0.3.0)
49
+
50
+ > Released on February, 10th 2020
51
+
52
+ - Missed the name of the cli options for min-words from -m to -w [`[2b8e0cf]`](https://github.com/WolfSoftware/caretaker/commit/2b8e0cf79dd8e957aa688b395ab37f165322bd1e) [`[TGWolf]`](https://github.com/TGWolf)
53
+
54
+ - Type in the post-commit hook - doesnt stop it working but causes error output [`[9da99cc]`](https://github.com/WolfSoftware/caretaker/commit/9da99cc6b5bc131d491df8019b3acb5dcf62fa6f) [`[TGWolf]`](https://github.com/TGWolf)
55
+
56
+ ### [v0.2.0](https://github.com/WolfSoftware/caretaker/releases/v0.2.0)
57
+
58
+ > Released on February, 10th 2020
59
+
60
+ - Had to bump to version 0.2.0 due to a broken push of 0.1.0 [`[c101fb8]`](https://github.com/WolfSoftware/caretaker/commit/c101fb85fa1831b8758bb27944a1693253b1b74f) [`[TGWolf]`](https://github.com/TGWolf)
61
+
62
+ - Fix an issue with incorrect spinners in the generate config and repo init functions [`[a15b75b]`](https://github.com/WolfSoftware/caretaker/commit/a15b75bae917276c83536b1e7e385c1dfb55f55c) [`[TGWolf]`](https://github.com/TGWolf)
63
+
64
+ - Initial push [`[f74a2c4]`](https://github.com/WolfSoftware/caretaker/commit/f74a2c411bf3339410d6a0f59a981abf6286107e) [`[TGWolf]`](https://github.com/TGWolf)
65
+
@@ -0,0 +1,7 @@
1
+ # The codeowners file:
2
+ #
3
+ # For more information please read: https://help.github.com/articles/about-codeowners/
4
+
5
+ # These owners will be the default owners for everything in
6
+ # the repo. Unless a later match takes precedence,
7
+ * @WolfSoftware/reviewers
@@ -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/
@@ -0,0 +1,3 @@
1
+ # Contributing
2
+
3
+ Please refer to the [contributing](https://github.com/WolfSoftware/contributing) documentation.
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+ ruby '>= 2.5.0'
3
+
4
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
5
+
6
+ # Specify your gem's dependencies in slackit.gemspec
7
+ gemspec
@@ -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.
@@ -0,0 +1,445 @@
1
+ [![Build Status](https://img.shields.io/travis/WolfSoftware/caretaker/master?style=for-the-badge&logo=travis)](https://travis-ci.org/WolfSoftware/caretaker)
2
+ [![Software License](https://img.shields.io/badge/license-MIT-blue?style=for-the-badge)](LICENSE.md)
3
+ [![Release](https://img.shields.io/github/release/WolfSoftware/caretaker?color=blue&style=for-the-badge&logo=github&label=Latest%20Release)](https://github.com/WolfSoftware/caretaker/releases/latest)
4
+ [![Last Release](https://img.shields.io/github/release-date/WolfSoftware/caretaker?color=blue&style=for-the-badge&logo=github)](https://github.com/WolfSoftware/caretaker/releases/latest)
5
+ [![Github commits (since latest release)](https://img.shields.io/github/commits-since/WolfSoftware/caretaker/latest?color=blue&style=for-the-badge&logo=github)](https://github.com/WolfSoftware/caretaker/commits)
6
+ [![Last Commit](https://img.shields.io/github/last-commit/WolfSoftware/caretaker?color=blue&style=for-the-badge&logo=github)](https://github.com/WolfSoftware/caretaker/commits/master)
7
+ [![Code Size](https://img.shields.io/github/languages/code-size/WolfSoftware/caretaker?color=blue&style=for-the-badge&logo=github)](#)
8
+ [![Repo Size](https://img.shields.io/github/repo-size/WolfSoftware/caretaker?color=blue&style=for-the-badge&logo=github)](#)
9
+ [![Contributors](https://img.shields.io/github/contributors/WolfSoftware/caretaker?color=blue&style=for-the-badge&logo=github)](https://github.com/WolfSoftware/caretaker/graphs/contributors)
10
+ [![WolfSoftware](https://img.shields.io/badge/Created%20By-Wolf%20Software%20Ltd.-blue?style=for-the-badge)](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
+ * Bump verions and tag releases automatically.
28
+
29
+ > For a full list of featues see the section on command line usage.
30
+
31
+ <a name="table-of-contents"></a>
32
+ ## Table of contents
33
+
34
+ <!--TOCBot-->
35
+ * [Caretaker](#caretaker)
36
+ * [Additional features](#additional-features)
37
+ * [Table of contents](#table-of-contents)
38
+ * [Installation](#installation)
39
+ * [Command line usage](#command-line-usage)
40
+ * [Basic usage](#basic-usage)
41
+ * [Initialise the repository](#initialise-the-repository)
42
+ * [The post-commit hook](#the-post-commit-hook)
43
+ * [Customisation](#customisation)
44
+ * [Example of customised usage](#example-of-customised-usage)
45
+ * [Resulting post-commit hook](#resulting-post-commit-hook)
46
+ * [Advanced usage](#advanced-usage)
47
+ * [Category example](#category-example)
48
+ * [Category list](#category-list)
49
+ * [Example category output](#example-category-output)
50
+ * [Tagging release versions](#tagging-release-versions)
51
+ * [Release handler snippet](#release-handler-snippet)
52
+ * [Bumping release versions](#bumping-release-versions)
53
+ * [Caretaker config file](#caretaker-config-file)
54
+ * [Example config file](#example-config-file)
55
+ * [Github usernames](#github-usernames)
56
+ * [Github username example](#github-username-example)
57
+ * [Github username command line example](#github-username-command-line-example)
58
+ * [Result](#result)
59
+ * [Pull requests and commits](#pull-requests-and-commits)
60
+ * [Pull request linking example](#pull-request-linking-example)
61
+ * [Issues](#issues)
62
+ * [Issues link example](#issues-link-example)
63
+ * [Issues link result](#issues-link-result)
64
+ * [Using caretaker in your own code](#using-caretaker-in-your-own-code)
65
+ * [Installation](#installation)
66
+ * [Usage](#usage)
67
+ * [Load the gem](#load-the-gem)
68
+ * [Initialise](#initialise)
69
+ * [Generate a changelog](#generate-a-changelog)
70
+ * [Initialise the git repo](#initialise-the-git-repo)
71
+ * [Contributing to caretaker](#contributing-to-caretaker)
72
+ * [Setup](#setup)
73
+ * [Testing](#testing)
74
+ * [To-Do List](#to-do-list)
75
+ <!--TOCBot-->
76
+
77
+ <a name="installation"></a>
78
+ ## Installation
79
+
80
+ Installing caretaker is very simple, just execute the following command.
81
+
82
+ ```
83
+ gem install caretaker
84
+ ```
85
+
86
+ <a name="command-line-usage"></a>
87
+ ## Command line usage
88
+
89
+ Caretaker has a number of command line options:
90
+
91
+ ```
92
+ Usage: caretaker [-h] [-a author] [-c] [-e] [-i] [-o filename] [-r] [-s] [-u] [-w number]
93
+ ```
94
+
95
+ | Option | Purpose | Default Value |
96
+ | ------ | ------- |:-------------:|
97
+ | -h or --help | Show the help message | N/A |
98
+ | -a or --author [Github username] | Specify the author name | |
99
+ | -b or --bump [part] | Bump the VERSION.txt to next version. | |
100
+ | -c or --config | Generate a .caretaker.cfg config file. | false |
101
+ | -e or --enable-categories | Enable the splitting of commit messages into categories | false |
102
+ | -i or --init | Initialise the repo to use caretaker | |
103
+ | -o or --output [filename] | Set the name of the output file | CHANGELOG.md |
104
+ | -r or --remove-categories | Remove categories from commit messages. --enable-categories sets this to true | false |
105
+ | -s or --silent | Turn off all output from Caretaker, aka Silent Mode | false |
106
+ | -u or --url-verification | Verify each url to ensure that the links are valid, skip any links that are not | false |
107
+ | -w or --words number | Minimum number of words needed to include a commit. | 1 |
108
+
109
+ <a name="basic-usage"></a>
110
+ ### Basic usage
111
+
112
+ <a name="initialise-the-repository"></a>
113
+ ### Initialise the repository
114
+
115
+ 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.
116
+
117
+ ```
118
+ caretaker -i
119
+ ```
120
+
121
+ 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.
122
+
123
+ <a name="the-post-commit-hook"></a>
124
+ #### The post-commit hook
125
+
126
+ ```
127
+ #!/usr/bin/env bash
128
+
129
+ OUTPUT_FILE="CHANGELOG.md"
130
+
131
+ caretaker
132
+
133
+ res=$(git status --porcelain | grep "${OUTPUT_FILE}" | wc -l)
134
+ if [[ "${res}" -gt 0 ]]; then
135
+ git add "${OUTPUT_FILE}"
136
+ git commit --amend --no-edit
137
+ end
138
+ ```
139
+
140
+ <a name="customisation"></a>
141
+ ### Customisation
142
+
143
+ 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.
144
+
145
+ <a name="example-of-customised-usage"></a>
146
+ #### Example of customised usage
147
+ ```
148
+ caretaker -i -e -o HISTORY.md
149
+ ```
150
+
151
+ <a name="resulting-post-commit-hook"></a>
152
+ #### Resulting post-commit hook
153
+
154
+ ```
155
+ #!/usr/bin/env bash
156
+
157
+ OUTPUT_FILE="CHANGELOG.md"
158
+
159
+ caretaker -i -e -o HISTORY.md
160
+
161
+ res=$(git status --porcelain | grep "${OUTPUT_FILE}" | wc -l)
162
+ if [[ "${res}" -gt 0 ]]; then
163
+ git add "${OUTPUT_FILE}"
164
+ git commit --amend --no-edit
165
+ end
166
+ ```
167
+
168
+ 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.
169
+
170
+ 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.
171
+
172
+ 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.
173
+
174
+ <a name="advanced-usage"></a>
175
+ ## Advanced usage
176
+
177
+ 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.
178
+
179
+ ```
180
+ git commit -m "<category>: <message>"
181
+ ```
182
+
183
+ <a name="category-example"></a>
184
+ ### Category example
185
+
186
+ ```
187
+ git commit -m "docs: Updated the README.md to include an example."
188
+ ```
189
+
190
+ <a name="category-list"></a>
191
+ #### Category list
192
+
193
+ 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.
194
+
195
+ > The matching is case-insensitive.
196
+
197
+
198
+ | Category | Patterns | Purpose |
199
+ | -------- | -------- | ------- |
200
+ | New Features | new features, new feature, new, feature | Any new features that have been added |
201
+ | Improvements | improvements, improvement | Any improvement or enhancement of an existing feature |
202
+ | Bug Fixes | bug fixes, bug fix, bug, bugs | Any bug fixes to existing features |
203
+ | Security Fixes | security fixes, security | Any security fixes to existing features |
204
+ | Refactor | refactor | A code change that neither fixes a bug or adds a feature |
205
+ | Style | style | A change that does not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) |
206
+ | Deprecated | deprecated | Any existing feature that is being deprecated |
207
+ | Removed | removed | Any existing feature that is being removed |
208
+ | Tests | tests, test, testing | Any changes to the existing tests |
209
+ | Documentation | documentation, docs | Changes to documentation only |
210
+ | Chores | chores, chore | Changes to the build process or auxiliary tools and libraries such as documentation generation |
211
+ | Experiments | experiments, experiment | Any experiments that you are carrying out, these are things that might get added and then removed again |
212
+ | Miscellaneous | miscellaneous, misc | Anything else (this shouldn't really be required) |
213
+ | Initial Commit | initial commit, initial | A special tag for the initial commit to the repo |
214
+ | Skip | skip, ignore | A special tag to ignore adding the commit to the CHANGELOG |
215
+
216
+ > Any commit without a matching category will be added to an 'Uncategorised' group.
217
+
218
+ <a name="example-category-output"></a>
219
+ #### Example category output
220
+
221
+ ```
222
+ # Changelog
223
+
224
+ All notable changes to this project will be documented in this file.
225
+
226
+ ### [Unreleased](https://github.com/WolfSoftware/caretaker/compare/v1.0.0...HEAD)
227
+
228
+ ###### Documentation:
229
+
230
+ - Updated the README.md to include an example.
231
+
232
+ ###### Uncategorised:
233
+
234
+ - Created an example without a prefix.
235
+ ```
236
+
237
+ <a name="tagging-release-versions"></a>
238
+ ### Tagging release versions
239
+
240
+ Due to the way that post-commit hooks work, if you were tag a release that tag would either be ignored or worse lost, because the commit ID changes when a 'commit amend' is carried out. In order to get around this problem Caretaker can now tag releases
241
+ for you as part of its push process.
242
+
243
+ The current version is stored in 'VERSION.txt', and it is semantic version string (however it can include an optional v prefix eg v1.0.0). This version is used to 'tag' a release as part of the process. It works be comparing the current tag to the
244
+ one in the file and if they are different it will tag the release with the new version.
245
+
246
+ <a name="release-handler-snippet"></a>
247
+ #### Release handler snippet
248
+
249
+ The following code is a snippet of how the release mechanism works:
250
+
251
+ ```
252
+ if [[ -n $RELEASE_VERSION ]]; then
253
+ git tag "${TAG_VERSION}"
254
+ fi
255
+
256
+ #{cmd}
257
+
258
+ res=$(git status --porcelain | grep "${OUTPUT_FILE}" | wc -l)
259
+ if [[ "${res}" -gt 0 ]]; then
260
+ git add "${OUTPUT_FILE}" >> /dev/null 2>&1
261
+ git commit --amend --no-edit >> /dev/null 2>&1
262
+
263
+ if [[ -n "${RELEASE_VERSION"} ]]; then
264
+ git tag -f "${TAG_VERSION}"
265
+ fi
266
+ fi
267
+ ```
268
+
269
+ As you can see, it will tag the release, run caretaker and re-tag the release after the commit amend, ensuring that the tag persists. This is not a perfect solution, but it does work :)
270
+
271
+ > The created tag is *NOT* pushed to the remote end, this is to allow manual pushing once the release is correct.
272
+
273
+ <a name="bumping-release-versions"></a>
274
+ #### Bumping release versions
275
+
276
+ In order to make life as simple as possible the new version of Caretaker comes with a ```--bump``` option, this takes 1 argument of either ```major```, ```minor``` or ```patch``` and will update the version file accordingly.
277
+
278
+ > Note if the version file doesn't exist, it will be created with a default version of v0.1.0
279
+
280
+ <a name="caretaker-config-file"></a>
281
+ ### Caretaker config file
282
+
283
+ 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.
284
+
285
+ 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.
286
+
287
+ > The config file is called ```.caretaker.yml```.
288
+
289
+ 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.
290
+
291
+ <a name="example-config-file"></a>
292
+ #### Example config file
293
+
294
+ ```
295
+ enable-categories: false
296
+ min-words: 1
297
+ remove-categories: false
298
+ silent: false
299
+ verify-urls: false
300
+ ```
301
+
302
+ <a name="github-usernames"></a>
303
+ ### Github usernames
304
+
305
+ 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.
306
+
307
+ <a name="github-username-example"></a>
308
+ #### Github username example
309
+ ```
310
+ git commit -m "docs: This is a GitHub username example. {TGWolf}"
311
+ ```
312
+
313
+ In addition you can set a username using the -a option:
314
+
315
+ <a name="github-username-command-line-example"></a>
316
+ #### Github username command line example
317
+ ```
318
+ git commit -m "docs: This is a GitHub username example." -a TGWolf
319
+ ```
320
+
321
+ You can also use the -a option along with the -i (init) option to set the username as your default for all commits.
322
+
323
+ 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.
324
+
325
+ <a name="result"></a>
326
+ #### Result
327
+
328
+ ```
329
+ - This is a GitHub username example. [`[Author: TGWolf]`](https://github.com/TGWolf)
330
+ ```
331
+
332
+ <a name="pull-requests-and-commits"></a>
333
+ ### Pull requests and commits
334
+
335
+ 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.
336
+
337
+ <a name="pull-request-linking-example"></a>
338
+ #### Pull request linking example
339
+
340
+ ```
341
+ - This is a normal commit. [`[17df108]`](https://github.com/WolfSoftware/caretaker/commit/17df1080a501ed1bb780aa946190d64966dc30df)
342
+ - This is a pull request. [`[#7]`](https://github.com/WolfSoftware/caretaker/pull/7)
343
+ ```
344
+
345
+ <a name="issues"></a>
346
+ ### Issues
347
+
348
+ 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.
349
+
350
+ <a name="issues-link-example"></a>
351
+ #### Issues link example
352
+
353
+ ```
354
+ git commit -m "Bug: This fixes a bug in the code and resolves issue (issue-7).
355
+ ```
356
+
357
+ <a name="issues-link-result"></a>
358
+ #### Issues link result
359
+
360
+ ```
361
+ ##### Bug Fixes:
362
+
363
+ This fixes a bug in the code and resolves issue [`[#7]`](https://github.com/WolfSoftware/caretaker/issues/7)
364
+ ```
365
+
366
+ <a name="using-caretaker-in-your-own-code"></a>
367
+ ## Using caretaker in your own code
368
+
369
+ <a name="installation"></a>
370
+ ### Installation
371
+
372
+ Add this line to your application's Gemfile:
373
+
374
+ ```ruby
375
+ gem 'caretaker'
376
+ ```
377
+
378
+ And then execute:
379
+
380
+ ```
381
+ $ bundle install
382
+ ```
383
+
384
+ Or install it yourself as:
385
+
386
+ ```
387
+ $ gem install caretaker
388
+ ```
389
+
390
+ <a name="usage"></a>
391
+ ### Usage
392
+
393
+ <a name="load-the-gem"></a>
394
+ #### Load the gem
395
+ ```ruby
396
+ require 'caretaker'
397
+ ```
398
+
399
+ <a name="initialise"></a>
400
+ #### Initialise
401
+
402
+ ```ruby
403
+ caretaker = Caretaker.new(output: 'HISTORY.md')
404
+ ```
405
+ > output is `optional` and will default to `CHANGELOG.md`
406
+
407
+ <a name="generate-a-changelog"></a>
408
+ #### Generate a changelog
409
+
410
+ ```ruby
411
+ Caretaker.generate_changelog
412
+ ```
413
+
414
+ <a name="initialise-the-git-repo"></a>
415
+ #### Initialise the git repo
416
+
417
+ ```Ruby
418
+ Caretaker.init_repo
419
+ ```
420
+
421
+ <a name="contributing-to-caretaker"></a>
422
+ ## Contributing to caretaker
423
+
424
+ <a name="setup"></a>
425
+ ### Setup
426
+
427
+ 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.
428
+
429
+ 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
430
+ create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
431
+
432
+ <a name="testing"></a>
433
+ ### Testing
434
+
435
+ For local testing make sure that you run `bundle exec rspec spec` and then `rake install` to install the gem locally.
436
+
437
+ For further information please refer to the [contributing](https://github.com/WolfSoftware/contributing) documentation.
438
+
439
+ <a name="to-do-list"></a>
440
+ # To-Do List
441
+
442
+ - [ ] CLI option to enable/disable linking to commit hashes
443
+ - [ ] CLI option to enable/disable linking to pull requests
444
+ - [ ] CLI option to enable/disable linking to github users
445
+ - [ ] Option to allow auto-pushing of the tag to the remote origin