maxbrokman / git-change-log
Generate a change log from git commits, separated by release tags
Requires (Dev)
- mockery/mockery: dev-master
- phpunit/phpunit: 4.2.*
- satooshi/php-coveralls: dev-master
This package is not auto-updated.
Last update: 2024-12-17 02:38:42 UTC
README
Git Based Change Log
This package generates a change log style report from git commits. Each tag is listed with its date and any commits included in it tagged with a certain string (!public or @public by default)
Requirements
- PHP must be able to run exec().
- Git must be installed! You should probably have some tags as well...
Code Example
$changeLog = new MaxBrokman\GitChangeLog\ChangeLog( new MaxBrokman\GitChangeLog\Git );
$log = $changeLog->getChangeLog( $page = 1 );
Will return something like
[
{
"tag": "v1",
"date": 1409965746, // utc time
"changesSinceLastTag":
[
{
"commit": "9e9125b", // Short commit hash
"author": "Max Brokman <max.brokman@gmail.com>",
"message": "Commit Message @public"
},
...
]
},
...
]
Installation
With composer, require
"maxbrokman/git-change-log": "0.1.*"
Use Case
I work on an internal project for a large company. Some of our stakeholders want to be kept informed about what is happening with the application. We release several times a day, and this package allows us to provide a list within the application of what has been updated, without having to manually maintain a changelog. We use !public in commit messages to mark them as safe for public (well in our case internal) consumption.
API Reference
To change the pattern used to find public commit messages you may call setPublicMarker( "grep pattern" )
on the instance of MaxBrokman\GitChangeLog\Git you pass to to ChangeLog
To change the number of results per page you may call setPerPage( 100 )
on MaxBrokman\GitChangeLog\ChangeLog
Tests
Tests are run using PHPUnit. Run phpunit
from the root directory.
GitTest.php requires a git repo with a tag v0.0.1
License
The MIT License (MIT)
Copyright (c) 2014 Max Brokman
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.