forked from thecodecrate/city-state
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(release): bump version to v1.0.0-20220102
- Loading branch information
Showing
13 changed files
with
964 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# BUILDING | ||
|
||
The code source follows the pattern of a common gem. You can find it inside the lib folder. | ||
|
||
This project is prepared to use Docker! Install the docker and (if you want) the docker-compose extension to easily build it! | ||
|
||
```bash | ||
docker-compose build | ||
``` | ||
|
||
## Open a console with the gem installed | ||
|
||
```bash | ||
docker-compose run gem bash | ||
``` | ||
|
||
## Check up the code quality with RuboCop | ||
|
||
```bash | ||
docker-compose run gem bundle exec rubocop -A | ||
``` | ||
|
||
## Run the unit tests with RSpec | ||
|
||
```bash | ||
docker-compose run gem bundle exec rspec --profile | ||
``` | ||
|
||
Please, if you want to edit/contribuct to the project, take a time to read | ||
our [LICENSE.txt](LICENSE.txt) file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
## v1.0.0-20220102 - Danilo Carolino (@danilogco) | ||
|
||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
We as members, contributors, and leaders pledge to make participation in our | ||
community a harassment-free experience for everyone, regardless of age, body | ||
size, visible or invisible disability, ethnicity, sex characteristics, gender | ||
identity and expression, level of experience, education, socio-economic status, | ||
nationality, personal appearance, race, religion, or sexual identity | ||
and orientation. | ||
|
||
We pledge to act and interact in ways that contribute to an open, welcoming, | ||
diverse, inclusive, and healthy community. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to a positive environment for our | ||
community include: | ||
|
||
* Demonstrating empathy and kindness toward other people | ||
* Being respectful of differing opinions, viewpoints, and experiences | ||
* Giving and gracefully accepting constructive feedback | ||
* Accepting responsibility and apologizing to those affected by our mistakes, | ||
and learning from the experience | ||
* Focusing on what is best not just for us as individuals, but for the | ||
overall community | ||
|
||
Examples of unacceptable behavior include: | ||
|
||
* The use of sexualized language or imagery, and sexual attention or | ||
advances of any kind | ||
* Trolling, insulting or derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or email | ||
address, without their explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Enforcement Responsibilities | ||
|
||
Community leaders are responsible for clarifying and enforcing our standards of | ||
acceptable behavior and will take appropriate and fair corrective action in | ||
response to any behavior that they deem inappropriate, threatening, offensive, | ||
or harmful. | ||
|
||
Community leaders have the right and responsibility to remove, edit, or reject | ||
comments, commits, code, wiki edits, issues, and other contributions that are | ||
not aligned to this Code of Conduct, and will communicate reasons for moderation | ||
decisions when appropriate. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies within all community spaces, and also applies when | ||
an individual is officially representing the community in public spaces. | ||
Examples of representing our community include using an official e-mail address, | ||
posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported to the community leaders responsible for enforcement at | ||
[email protected]. | ||
All complaints will be reviewed and investigated promptly and fairly. | ||
|
||
All community leaders are obligated to respect the privacy and security of the | ||
reporter of any incident. | ||
|
||
## Enforcement Guidelines | ||
|
||
Community leaders will follow these Community Impact Guidelines in determining | ||
the consequences for any action they deem in violation of this Code of Conduct: | ||
|
||
### 1. Correction | ||
|
||
**Community Impact**: Use of inappropriate language or other behavior deemed | ||
unprofessional or unwelcome in the community. | ||
|
||
**Consequence**: A private, written warning from community leaders, providing | ||
clarity around the nature of the violation and an explanation of why the | ||
behavior was inappropriate. A public apology may be requested. | ||
|
||
### 2. Warning | ||
|
||
**Community Impact**: A violation through a single incident or series | ||
of actions. | ||
|
||
**Consequence**: A warning with consequences for continued behavior. No | ||
interaction with the people involved, including unsolicited interaction with | ||
those enforcing the Code of Conduct, for a specified period of time. This | ||
includes avoiding interactions in community spaces as well as external channels | ||
like social media. Violating these terms may lead to a temporary or | ||
permanent ban. | ||
|
||
### 3. Temporary Ban | ||
|
||
**Community Impact**: A serious violation of community standards, including | ||
sustained inappropriate behavior. | ||
|
||
**Consequence**: A temporary ban from any sort of interaction or public | ||
communication with the community for a specified period of time. No public or | ||
private interaction with the people involved, including unsolicited interaction | ||
with those enforcing the Code of Conduct, is allowed during this period. | ||
Violating these terms may lead to a permanent ban. | ||
|
||
### 4. Permanent Ban | ||
|
||
**Community Impact**: Demonstrating a pattern of violation of community | ||
standards, including sustained inappropriate behavior, harassment of an | ||
individual, or aggression toward or disparagement of classes of individuals. | ||
|
||
**Consequence**: A permanent ban from any sort of public interaction within | ||
the community. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], | ||
version 2.0, available at | ||
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>. | ||
|
||
Community Impact Guidelines were inspired by [Mozilla's code of conduct | ||
enforcement ladder](https://github.com/mozilla/diversity). | ||
|
||
[homepage]: https://www.contributor-covenant.org | ||
|
||
For answers to common questions about this code of conduct, see the FAQ at | ||
<https://www.contributor-covenant.org/faq>. Translations are available at | ||
<https://www.contributor-covenant.org/translations>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
# Conventinal Commit Messages | ||
|
||
See how a minor change to your commit message style can make a difference. [Examples](#examples) | ||
|
||
**Have a look at CLI util [git-conventional-commits](https://github.com/qoomon/git-conventional-commits) to ensure this conventions and generate changelogs** | ||
|
||
<img src="https://img.icons8.com/dusk/1600/commit-git.png" width="200" height="200" /> | ||
|
||
## Commit Formats | ||
|
||
### Default | ||
|
||
<pre> | ||
<b><a href="#types"><type></a></b></font>(<b><a href="#scopes"><optional scope></a></b>): <b><a href="#subject"><subject></a></b> | ||
<sub>empty separator line</sub> | ||
<b><a href="#body"><optional body></a></b> | ||
<sub>empty separator line</sub> | ||
<b><a href="#footer"><optional footer></a></b> | ||
</pre> | ||
|
||
### Merge | ||
|
||
<pre> | ||
Merge branch '<b><branch name></b>' | ||
</pre> | ||
<sup>Follows default git merge message</sup> | ||
|
||
### Revert | ||
|
||
<pre> | ||
Revert "<b><commit headline></b>" | ||
<sub>empty separator line</sub> | ||
This reverts commit <b><commit hash></b>. | ||
<b><optinal reason></b> | ||
</pre> | ||
<sup>Follows default git revert message</sup> | ||
|
||
### Types | ||
|
||
API relevant changes | ||
|
||
* `feat` Commits, that adds a new feature | ||
* `fix` Commits, that fixes a bug | ||
* `refactor` Commits, that rewrite/restructure your code, however does not change any behaviour | ||
* `perf` Commits are special `refactor` commits, that improves performance | ||
* `style` Commits, that do not affect the meaning (white-space, formatting, missing semi-colons, etc) | ||
* `test` Commits, that add missing tests or correcting existing tests | ||
* `docs` Commits, that affect documentation only | ||
* `build` Commits, that affect build components like build tool, ci pipeline, dependencies, project version, ... | ||
* `ops` Commits, that affect operational components like infrastructure, deployment, backup, recovery, ... | ||
* `chore` Miscellaneous commits e.g. modifying `.gitignore` | ||
|
||
### Scopes | ||
|
||
The `scope` provides additional contextual information. | ||
|
||
* Is an **optional** part of the format | ||
* Allowed Scopes depends on the specific project | ||
* Don't use issue identifiers as scopes | ||
|
||
### Subject | ||
|
||
The `subject` contains a succinct description of the change. | ||
|
||
* Is a **mandatory** part of the format | ||
* Use the imperative, present tense: "change" not "changed" nor "changes" | ||
* Don't capitalize the first letter | ||
* No dot (.) at the end | ||
|
||
### Body | ||
|
||
The `body` should include the motivation for the change and contrast this with previous behavior. | ||
|
||
* Is an **optional** part of the format | ||
* Use the imperative, present tense: "change" not "changed" nor "changes" | ||
* This is the place to mention issue identifiers and their relations | ||
|
||
### Footer | ||
|
||
The `footer` should contain any information about **Breaking Changes** and is also the place to **reference Issues** that this commit refers to. | ||
|
||
* Is an **optional** part of the format | ||
* **optionally** reference an issue by its id. | ||
* **Breaking Changes** should start with the word `BREAKING CHANGES:` followed by space or two newlines. The rest of the commit message is then used for this. | ||
|
||
### Examples | ||
|
||
```git | ||
feat(shopping cart): add the amazing button | ||
``` | ||
|
||
```git | ||
feat: remove ticket list endpoint | ||
refers to JIRA-1337 | ||
BREAKING CHANGES: ticket enpoints no longer supports list all entites. | ||
``` | ||
|
||
```git | ||
fix: add missing parameter to service call | ||
The error occurred because of <reasons>. | ||
``` | ||
|
||
```git | ||
build(release): bump version to 1.0.0 | ||
``` | ||
|
||
```git | ||
build: update dependencies | ||
``` | ||
|
||
```git | ||
refactor: implement calculation method as recursion | ||
``` | ||
|
||
```git | ||
style: remove empty line | ||
``` | ||
|
||
```git | ||
revert: refactor: implement calculation method as recursion | ||
This reverts commit 221d3ec6ffeead67cee8c730c4a15cf8dc84897a. | ||
``` | ||
|
||
## Git Hook Scripts to ensure commit message header format | ||
|
||
### commit-msg Hook (local) | ||
|
||
* create following file in your local repository folder`.git-hooks/commit-msg` | ||
|
||
```shell | ||
#!/usr/bin/env sh | ||
|
||
commit_message="$1" | ||
# exit with a non zero exit code incase of an invalid commit message | ||
|
||
# use git-conventional-commits, see https://github.com/qoomon/git-conventional-commits | ||
git-conventional-commits commit-msg-hook "$commit_message" | ||
|
||
# or verify $commit_message with your own tooling | ||
# ... | ||
``` | ||
|
||
* ⚠ make `.git-hooks/commit-msg` executable (unix: `chmod +x '.git-hooks/commit-msg'`) | ||
* set git hook directory to `.githooks` `git config core.hooksPath '.git-hooks'` | ||
* commit `.git-hooks` directory if you want to share them with your team, they only need to call the git config command once after cloning the repository | ||
|
||
### pre-receive Hook (server side) | ||
|
||
* create following file in your repository folder `.git/hooks/pre-receive` | ||
|
||
```shell | ||
#!/usr/bin/env sh | ||
|
||
# Pre-receive hook that will block commits with messges that do not follow regex rule | ||
|
||
commit_msg_type_regex='feat|fix|refactor|style|test|docs|build' | ||
commit_msg_scope_regex='.{1,20}' | ||
commit_msg_subject_regex='.{1,100}' | ||
commit_msg_regex="^(${commit_msg_type_regex})(\(${commit_msg_scope_regex}\))?: (${commit_msg_subject_regex})\$" | ||
merge_msg_regex="^Merge branch '.+'\$" | ||
revert_msg_regex="^Revert \".+\"\$" | ||
|
||
zero_commit="0000000000000000000000000000000000000000" | ||
|
||
# Do not traverse over commits that are already in the repository | ||
excludeExisting="--not --all" | ||
|
||
error="" | ||
while read oldrev newrev refname; do | ||
# branch or tag get deleted | ||
if [ "$newrev" = "$zero_commit" ]; then | ||
continue | ||
fi | ||
|
||
# Check for new branch or tag | ||
if [ "$oldrev" = "$zero_commit" ]; then | ||
rev_span=`git rev-list $newrev $excludeExisting` | ||
else | ||
rev_span=`git rev-list $oldrev..$newrev $excludeExisting` | ||
fi | ||
|
||
for commit in $rev_span; do | ||
commit_msg_header=$(git show -s --format=%s $commit) | ||
if ! [[ "$commit_msg_header" =~ (${commit_msg_regex})|(${merge_msg_regex})|(${revert_msg_regex}) ]]; then | ||
echo "$commit" >&2 | ||
echo "ERROR: Invalid commit message format" >&2 | ||
echo "$commit_msg_header" >&2 | ||
error="true" | ||
fi | ||
done | ||
done | ||
|
||
if [ -n "$error" ]; then | ||
exit 1 | ||
fi | ||
``` | ||
|
||
* ⚠ make `.git/hooks/pre-receive` executable (unix: `chmod +x '.git/hooks/pre-receive'`) | ||
|
||
----- | ||
|
||
## References | ||
|
||
* <https://www.conventionalcommits.org/> | ||
* <https://github.com/angular/angular/blob/master/CONTRIBUTING.md> | ||
* <http://karma-runner.github.io/1.0/dev/git-commit-msg.html> | ||
<br> | ||
|
||
* <https://github.com/github/platform-samples/tree/master/pre-receive-hooks> | ||
* <https://github.community/t5/GitHub-Enterprise-Best-Practices/Using-pre-receive-hooks-in-GitHub-Enterprise/ba-p/13863> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Contributing | ||
|
||
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet; | ||
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it; | ||
- Fork the project; | ||
- Start a feature/bugfix branch; | ||
- Commit and push until you are happy with your contribution; | ||
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.; | ||
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. |
Oops, something went wrong.