-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from nbish11/master
Massive Refactoring and an official v0.2.0 release
- Loading branch information
Showing
15 changed files
with
844 additions
and
655 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,15 @@ | ||
; This file is for unifying the coding style for different editors and IDEs. | ||
; More information at http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_size = 4 | ||
indent_style = space | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
build | ||
composer.lock | ||
vendor | ||
.idea/ | ||
*.bak |
Large diffs are not rendered by default.
Oops, something went wrong.
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,22 @@ | ||
# Contributor Code of Conduct | ||
|
||
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. | ||
|
||
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery | ||
* Personal attacks | ||
* Trolling or insulting/derogatory comments | ||
* Public or private harassment | ||
* Publishing other's private information, such as physical or electronic addresses, without explicit permission | ||
* Other unethical or unprofessional conduct. | ||
|
||
Project maintainers 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. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. | ||
|
||
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community in a direct capacity. Personal views, beliefs and values of individuals do not necessarily reflect those of the organisation or affiliated individuals and organisations. | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) |
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,26 @@ | ||
# Contributing | ||
Contributions are **welcome** and will be fully **credited**. | ||
|
||
We accept contributions via Pull Requests on [Github](https://github.com/ins0/github-changelog-generator). | ||
|
||
## Pull Requests | ||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). | ||
|
||
- **Add tests!** - Your patch won't be accepted if it doesn't have tests. | ||
|
||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. | ||
|
||
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. | ||
|
||
- **Create feature branches** - Don't ask us to pull from your master branch. | ||
|
||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. | ||
|
||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. | ||
|
||
## Running Tests | ||
```cli | ||
$ composer test | ||
``` | ||
|
||
**Happy coding**! |
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,21 @@ | ||
# The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Marco Rieger <rieger@racecore.de> | ||
|
||
> Permission is hereby granted, free of charge, to any person obtaining a copy | ||
> of this software and associated documentation files (the "Software"), to deal | ||
> in the Software without restriction, including without limitation the rights | ||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
> copies of the Software, and to permit persons to whom the Software is | ||
> furnished to do so, subject to the following conditions: | ||
> | ||
> The above copyright notice and this permission notice shall be included in | ||
> all copies or substantial portions of the Software. | ||
> | ||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
> THE SOFTWARE. |
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 |
---|---|---|
@@ -1,51 +1,95 @@ | ||
# github-changelog-generator | ||
inspired by [https://github.com/skywinder/github-changelog-generator](https://github.com/skywinder/github-changelog-generator) implemented in PHP. | ||
# GitHub ChangelogGenerator | ||
> Creates a markdown changelog for your repository, based on your repository's releases, issues | ||
> and pull-requests. Inspired by [github-changelog-generator][ruby-generator-link] for Ruby. | ||
creates a markdown change log based on release tag versions and github issues. | ||
## Installation | ||
### Composer | ||
```cli | ||
$ composer require ins0/github-changelog-generator | ||
``` | ||
|
||
## usage | ||
## Usage | ||
**Note:** *You can see an example of the output generated, [here](CHANGELOG.md).* | ||
|
||
### cli | ||
``github-changelog-generator.php.bat -u [github_user] -r [repository_name] -t [github_api_token]`` | ||
### PHP | ||
```php | ||
<?php | ||
require_once 'vendor/autoload.php'; | ||
|
||
the token option is optional - without the github api calls are limited and your change log in large projects is may not fully generated | ||
$token = '...'; // The token is not required, but is still recommended. | ||
$repository = new ins0\GitHub\Repository('ins0/github-changelog-generator', $token); | ||
$changelog = new ins0\GitHub\ChangelogGenerator($repository); | ||
|
||
### php | ||
$generator = new GithubChangelogGenerator('*** github_api_token ***'); | ||
$generator->createChangelog($user, $repository); | ||
|
||
if your repository use different labels for ``features`` or ``bugs`` you need to customize the issue mapping like | ||
// The ChangelogGenerator::generate() method does throw | ||
// exceptions, so remember to wrap your code in try/catch blocks. | ||
try { | ||
$handle = fopen('CHANGELOG.md', 'w'); | ||
|
||
$issueLabelMapping = [ | ||
GithubChangelogGenerator::LABEL_TYPE_BUG => [ | ||
'otherLabelForBugs', | ||
'moreLabels', | ||
], | ||
GithubChangelogGenerator::LABEL_TYPE_FEATURE => [ | ||
'otherLabelForFeatures', | ||
'moreLabels', | ||
], | ||
]; | ||
$generator = new GithubChangelogGenerator('*** github_api_token ***', $issueLabelMapping); | ||
$generator->createChangelog($user, $repository, $saveFilePath); | ||
|
||
## example output | ||
if (!$handle) { | ||
throw new RuntimeException('Cannot open file for writing'); | ||
} | ||
|
||
view ``CHANGELOG.md`` for a full change log created from [https://github.com/zendframework/modules.zendframework.com](https://github.com/zendframework/modules.zendframework.com) | ||
// Write markdown output to file | ||
fwrite($handle, $changelog->generate()); | ||
fclose($handle); | ||
} catch (Exception $e) { | ||
// handle exceptions... | ||
} | ||
``` | ||
|
||
# Change Log | ||
If your repository uses labels other than `feature`, `bug` or `enhancement` you can customize them, like so: | ||
```php | ||
require_once 'vendor/autoload.php'; | ||
|
||
## [1.4.1](https://github.com/zendframework/modules.zendframework.com/releases/tag/1.4.1) (2015-03-09T11:24:57Z) | ||
$labelMappings = [ | ||
GithubChangelogGenerator::LABEL_TYPE_ADDED => ['feature', 'anotherFeatureLabel'], | ||
GithubChangelogGenerator::LABEL_TYPE_CHANGED => ['enhancement', 'anotherEnhancementLabel'], | ||
GithubChangelogGenerator::LABEL_TYPE_FIXED => ['bug', 'anotherBugLabel'] | ||
]; | ||
|
||
**New features:** | ||
$changelog = new ins0\GitHub\ChangelogGenerator($repository, $labelMappings); | ||
``` | ||
|
||
- Feature: added google analytics code [\#480](https://github.com/zendframework/modules.zendframework.com/pull/480) | ||
- Enhancement: Assert ModuleController::viewAction() is not dispatched to [\#477](https://github.com/zendframework/modules.zendframework.com/pull/477) | ||
- Enhancement: added hhvm as allow failure [\#475](https://github.com/zendframework/modules.zendframework.com/pull/475) | ||
- Fix: Reset before pulling in changes [\#473](https://github.com/zendframework/modules.zendframework.com/pull/473) | ||
- [WIP] Feature: Flash Messenger Error Messages [\#421](https://github.com/zendframework/modules.zendframework.com/pull/421) | ||
### CLI | ||
```cli | ||
$ php vendor/bin/github-changelog-generator ins0/github-changelog-generator > CHANGELOG.md | ||
``` | ||
|
||
**Fixed bugs:** | ||
## CLI | ||
This command line tool supports output redirection/pipelining, unless the `--file` option is provided. | ||
|
||
- Fix: Do not collect code coverage . . . for now [\#476](https://github.com/zendframework/modules.zendframework.com/pull/476) | ||
- Fix: Do not json_decode API response to associative array [\#474](https://github.com/zendframework/modules.zendframework.com/pull/474) | ||
**Required:** | ||
- `[repository]`**:** *The url to your GitHub repository, without the domain.* **E.g.** `ins0/github-changelog-generator` | ||
|
||
**Boolean:** | ||
- *This tool does not use any boolean flags.* | ||
|
||
**Optional:** | ||
- `--token` (`-t`)**:** *Your GithHub OAUTH token.* | ||
- `--file` (`-f`)**:** *Write output to a file.* | ||
- `--help`**:** *Access the help menu.* | ||
|
||
**Exit Codes:** | ||
- `0`**:** *success* | ||
- `1`**:** *fail* | ||
|
||
## Testing | ||
This library uses the [PHPUnit](https://github.com/sebastianbergmann/phpunit) test suite. | ||
```cli | ||
$ composer test | ||
``` | ||
|
||
## Contributing | ||
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details. | ||
|
||
## Security | ||
If you discover any security related issues, please email rieger@racecore.de instead of using the issue tracker. | ||
|
||
## Credits | ||
- [Marco Rieger](https://github.com/ins0) | ||
- [Nathan Bishop](https://github.com/nbish11) | ||
|
||
## License | ||
The MIT License (MIT). Please see the [LICENSE](LICENSE.md) file for more information. | ||
|
||
[ruby-generator-link]: https://github.com/skywinder/github-changelog-generator |
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,46 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
require_once '../vendor/autoload.php'; | ||
|
||
// define CLI arguments | ||
$cli = new Commando\Command(); | ||
$cli->beepOnError(false); | ||
|
||
// repository | ||
$cli->argument(0) | ||
->referToAs('repository') | ||
->require() | ||
->describedAs('The GitHub repository to generate the changelog for.') | ||
->must(function ($val) { | ||
// cannot begin or end with a slash, and slash can only occur once | ||
return substr_count($val, '/') === 1 && substr($val, 0, 1) !== '/' | ||
&& substr($val, strlen($val) - 1, 1) !== '/'; | ||
}); | ||
|
||
// GitHub token | ||
$cli->flag('t') | ||
->alias('token') | ||
->describedAs('Your GitHub Account\'s OAUTH token.'); | ||
|
||
// file | ||
$cli->flag('f') | ||
->alias('file') | ||
->describedAs('Write the changelog to a file'); | ||
|
||
$repository = new ins0\GitHub\Repository($cli[0], $cli['token']); | ||
$changelog = new ins0\GitHub\ChangelogGenerator($repository); | ||
|
||
try { | ||
// output to CLI or write to file | ||
if ($file = $cli['file']) { | ||
$handle = fopen($file, 'w'); | ||
fwrite($handle, $changelog->generate()); | ||
fclose($handle); | ||
} else { | ||
echo $changelog->generate(); | ||
} | ||
} catch (Exception $e) { | ||
echo "\n", $e->getMessage(), "\n"; | ||
exit(0); | ||
} |
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,51 @@ | ||
{ | ||
"name": "ins0/github-changelog-generator", | ||
"description": "Creates a markdown changelog for your GitHub repository.", | ||
"type": "library", | ||
"keywords": [ | ||
"github", | ||
"changelog", | ||
"markdown", | ||
"generator", | ||
"keepachangelog" | ||
], | ||
"require-dev": { | ||
"phpunit/phpunit": "4.*" | ||
}, | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Marco Rieger", | ||
"email": "rieger@racecore.de", | ||
"homepage": "https://github.com/ins0", | ||
"role": "Developer" | ||
}, | ||
{ | ||
"name": "Nathan Bishop", | ||
"email": "nbish11@hotmail.com", | ||
"homepage": "https://github.com/nbish11", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": "~5.4|~7.0", | ||
"nategood/commando": "^0.2.8" | ||
}, | ||
"bin": [ | ||
"bin/github-changelog-generator" | ||
], | ||
"scripts": { | ||
"test": "phpunit" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"ins0\\GitHub\\": "src" | ||
}, | ||
"classmap": ["github-changelog-generator.php"] | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"ins0\\GitHub\\": "tests" | ||
} | ||
} | ||
} |
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
Oops, something went wrong.