Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Milestone 1 #10

Merged
merged 16 commits into from
Nov 20, 2020
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## v1.0.0 (Soon)

* Add PhpUnit tests for class Html and MarkDown ([a4890bc](https://github.com/DigiLive/gitChangelog/commit/a4890bc))
* Add code coverage tags ([7ce91b8](https://github.com/DigiLive/gitChangelog/commit/7ce91b8))
* Add formatting of issues ids & hashes to hyperlink ([10816fb](https://github.com/DigiLive/gitChangelog/commit/10816fb))
* Add issue templates ([5bbf5ef](https://github.com/DigiLive/gitChangelog/commit/5bbf5ef), [6d34e1c](https://github.com/DigiLive/gitChangelog/commit/6d34e1c))
* Add setting base content by value or file content. ([93ca694](https://github.com/DigiLive/gitChangelog/commit/93ca694))
* Fix [#7](https://github.com/DigiLive/gitChangelog/issues/7), Fix [#8](https://github.com/DigiLive/gitChangelog/issues/8) ([d4e352e](https://github.com/DigiLive/gitChangelog/commit/d4e352e))
* Fix PhpUnit tests for GitChangelog ([b62ded6](https://github.com/DigiLive/gitChangelog/commit/b62ded6))
* Fix docBlock of GitChangelog::$labels ([1fea85e](https://github.com/DigiLive/gitChangelog/commit/1fea85e))
* Fix html renderer ([c66b572](https://github.com/DigiLive/gitChangelog/commit/c66b572))
* Fix markdown renderer ([ab29669](https://github.com/DigiLive/gitChangelog/commit/ab29669))
* Optimize Git execution and Fix docBlocks ([fc79a58](https://github.com/DigiLive/gitChangelog/commit/fc79a58))

## v0.4.0 (2020-10-28)

* Add separate renderers for GitChangelog ([2df97ee](https://github.com/DigiLive/gitChangelog/commit/2df97ee))
Expand Down
132 changes: 75 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,109 +6,127 @@

Generate a changelog from git commits of the local repository.

This library parses information which is stored in the Git directory in which it is currently located. With this
information, it generates a changelog which can be saved into a file.
This library parses information which is stored in a Git repository. With this
information, it generates a changelog which can be saved to a file. The
information is extracted from the branch which is currently checked out.

Check out this [example](CHANGELOG.md) which is actually the changelog of this repository.
Take a look at this [example](CHANGELOG.md). It is the changelog of the
GitChangelog repository, build by this library.

If you have any questions, comments or ideas concerning this library, Please consult
the [Wiki](https://github.com/DigiLive/gitChangelog/wiki) at first. Create a
new [issue](https://github.com/DigiLive/gitChangelog/issues/new) if your concerns remain unanswered.
If you have any questions, comments or ideas concerning this library, Please
consult the [Wiki](https://github.com/DigiLive/gitChangelog/wiki) at first.
Create a new [issue](https://github.com/DigiLive/gitChangelog/issues/new) if
your concerns remain unanswered.

## Features

### Main

- Choose from different renderers or create your own.
- List Tags and their date.
- List unique commit subjects per tag/release.
- List commit hashes per unique subject (optional).
- Include commit subjects (and hashes) of the HEAD revision (E.g. Unreleased changes).
- Append the content of another file (E.g. An already existing changelog).
- Save the content of the (appended) changelog to file.
* Markdown and Html renderers included.

* Choose included renderers or create your own.

* List Tags and their date.

* List unique commit titles per tag/release.

* List commit hashes per unique title (optional).

* Include commit titles (and hashes) of the HEAD revision (E.g. Unreleased
changes).

* Append other content (E.g. An already existing changelog).

* Save the content of the (appended) changelog to file.

### Other

- Set path to generate a changelog another local repository.
- Set a From- and To tag to limit the changelog.
- Filter subjects by labels<sup>1</sup>.
- Set a header for the changelog (E.g. a title).
- Set a custom subject for the HEAD revision.
- Set a custom date for the HEAD revision (E.g. Next Tag/Release date).
- Set a custom message to indicate there are no commits present.
- In- or exclude merge commits.
- Set an ordering key for sorting tags/releases<sup>2</sup>.
- Set the sort order of tags/releases.
- Set the sort order of subjects.

1. A label is considered to be the first word of a commit subject.
2. Using an invalid key will result in unlisted changes or when enabled, just the changes of the HEAD revision.
* Set path to generate a changelog of another local repository.
* Set a tag range to limit the changelog.
* Filter titles by labels<sup>1</sup>.
* Set a title for the changelog (E.g. a header).
* Set a custom title for the HEAD revision (E.g. Next release version).
* Set a custom date for the HEAD revision (E.g. Next release date).
* Set a custom message to indicate there are no commits present.
* In- or exclude merge commits.
* Set an ordering key for sorting tags/releases<sup>2</sup>.
* Set the sort order of tags/releases.
* Set the sort order of titles.

1. A label is considered to be the first word of a commit title.

2. Using an invalid key will result in unlisted changes or when enabled, just
the changes of the HEAD revision.

#### Markdown Renderer

- Define a custom format for Tag/Release lines.
- Define a custom format for subject lines.
- Define a custom format for singe hashes.
- Define a custom format for hash lines.
* Define a custom format for Tag/Release lines.
* Define a custom format for title lines.
* Format hashes into links to commit view of the remote repository.
* Format issues into links to Issue tracker of the repository.

#### Html Renderer

- Define a custom format for singe hashes.
* Format hashes into links to commit view of the remote repository.
* Format issues into links to Issue tracker of the repository.

## Installation

The preferred method is to install the library with [Composer](http://getcomposer.org).
The preferred method is to install the library
with [Composer](http://getcomposer.org).

```sh
> composer require digilive/git-changelog:^1
```

Alternatively you can download the latest release from [Github](https://github.com/DigiLive/gitChangelog/releases).
Set the version constraint to a value which suits you best.
Alternatively you can download the latest release
from [Github](https://github.com/DigiLive/gitChangelog/releases).

## Example use
## Minimal Example use

```php
<?php

use DigiLive\GitChangelog\Renderers\MarkDown;

// Instantiate composer's auto loader.
require 'Path/To/vendor/autoload.php';
// Use composer's auto loader.
$requiredFile = 'Path/To/vendor/autoload.php';

// Or include the library manually.
// require_once 'Path/To/MarkDown.php';
// $requiredFile = 'Path/To/MarkDown.php';

$markDownLog = new MarkDown();
require_once $requiredFile;

// Generate and save.
try {
$markDownLog->build();
$markDownLog->save('CHANGELOG.md');
} catch (Exception $e) {
exit($e);
}
// Instantiate the library's renderer.
$changelog = new MarkDown();
// Build and save the changelog with all defaults.
$changelog->build();
$changelog->save('CHANGELOG.md');
```

## Notes

- Some settings can be changed directly by setting a public property.
* Some options can be changed directly by setting a public property.
**(Setting a value of an invalid type, might result in unexpected results.)**

- Others have to be set by calling a method.
* Others have to be set by calling a method.

## Commit guidelines

In order to suitable a good changelog, you should follow the following guidelines:
In order to create a good changelog, you should follow the following guidelines:

- Commit messages must have a subject line and may have body copy. These must be separated by a blank line.
* Commit messages **must** have a title line and may have body copy. These must
be separated by a blank line.

- The subject line must not exceed 50 characters.
* The title line **must not** exceed 50 characters.

- The subject line should be capitalized and must not end in a period.
* The title line should be capitalized and **must not** end in a period.

- The subject line must be written in an imperative mood (Fix, not Fixed / Fixes etc.).
* The title line **must** be written in an imperative mood (Fix, not Fixed /
Fixes etc.).

- The body copy must be wrapped at 72 columns.
* The body copy **must** be wrapped at 72 columns.

- The body copy must only contain explanations as to what and why, never how. The latter belongs in documentation and
implementation.
* The body copy **must** only contain explanations as to what and why, never
how. The latter belongs in documentation and implementation.