HUB
Sign inSign up
changelog-parser logo

agaveapi/changelog-parser

By agaveapi

•Updated about 10 years ago

Microservice for fetching changelogs from a remote url, parsing them, and returning as json.

Image
0

1.3K

agaveapi/changelog-parser repository overview

⁠Changelog Parser

Latest Stable Version Latest Unstable Version Build Status Code Coverage Scrutinizer Code Quality Total Downloads License

⁠Introduction

This library is meant to parse changelog files and convert its data to different formats.

It would be used to get dynamically data from a changelog file to inform users about the different versions and their changes.

With this library it is easy to use changelog data in any way.

⁠Installation

You can use composer to set the library as your project dependency

composer require kern046/changelog-parser

⁠Usage

To use this library, you can create an instance of the changelog manager

use ChangelogParser\Manager\ChangelogManager;

$changelogManager = new ChangelogManager();

To get the last version data of your changelog file, write the following code :

// The second parameter is optional, default is 'json'
$changelogManager->getLastVersion('CHANGELOG.md', 'json');

To get a changelog from a remote URL, write the following code:

// The second parameter is optional, default is 'json'
$changelogManager->getLastVersion('http://example.com/CHANGELOG.md', 'json');

To get all data contained in the changelog file, use the following method :

// The second parameter is optional, default is 'json'
$changelogManager->getAllVersions('CHANGELOG.md', 'json');

The results of these functions are cached.

The default cache validity time is one hour.

You can modify it using the following way :

$cacheManager = $changelogManager->getCacheManager();
// The first argument is the validity time in seconds
// In the current example, the cache validity time is one day
$cacheManager->setCacheTime(60 * 60 * 24);

⁠API

This parser may be run as an API. Simply copy the repository to your web server and reference the example directory. For convenience, a Docker Compose file is included. Running the following command will start a Docker container with the changelog-parser API running at [http://<docker_host>:8888

docker-compose up -d

The API accepts three query parameters:

NameTypeDescription
sourceurlA valid URL to the changelog you wish to parse.
forcebooleanTrue if the cache should be flushed and the changelog fetched and regenerated.
latestbooleanTrue if only the latest entry in the changelog should be returned.
Tag summary
Recent tags
Content type
Image
Digest
Size
31.4 MB
Last updated
about 10 years ago
docker pull agaveapi/changelog-parser:latest