This is a refactor of the internals of the application in order to accomplish several goals:
Define providers based on the behaviors consumed: generating issue and patch links, and creating releases.
Making configuration a first-class citizen, instead of a tacked-on extra. In particular, it now has a clear hierarchy for overrides: global (now in $XDG_CONFIG_HOME), local (./.keep-a-changelog.ini), and command-line options. Each config type is a single file, with all relevant data. Local configuration CANNOT store tokens (these should only be saved in global configuration or the environment, for use with options). Config currently covers:
the changelog file name
the remote name (which remote to push tags to)
the package name (relevant for local config only)
the preferred provider name
and, for providers:
the provider class name
the provider token (global config only)
alternate URL to use with provider (e.g. GitHub Enterprise users, private GitLab installs)
Rewrite all command internals such that they now use an event bus. Specifically, the patch requires psr/event-dispatcher, and implements both a dispatcher and a listener provider. Each command triggers a specific event, marshaling the event from command arguments and options, and checks for success status, using that to report script exit status.
This approach makes marshaling configuration simpler (each config-aware command has an event that is config-aware, and composes a listener for marshaling configuration), and allows greater re-use between the various commands; in many cases, the only listener specific to a given command will be the final one in the stack. Additionally, it makes understanding the workflow easier; maintainers can look at the listener list for a given event to see the workflow, and inspect the individual listeners to understand what the do. Many are just a few lines of code at this time.
Expands the EntryCommand to allow specifying issues as well as patches.
Expands the version:show command to allow omitting the version, which then displays the latest version present.
Expands configuration commands. The app now exposes:
config:create [--global|--local] for creating either the global or local configuration file (or both!)
config:remove [--global|--local] for removing either the global or local configuration file (or both!)
config:edit [--global|--local] for editing either the global or local configuration file (but NOT both)
config:show [--global|--local] for showing the global, local, or merged configuration files. This WILL NOT show tokens.
Expands the version:edit command to allow specifying a version to edit (you can edit ANY version, not just the latest, now!)
release no longer requires the package argument. It can now be specified in the local configuration file, passed via the --package option, or auto-discovered based on the presence of a composer.json or package.json with a name entry.
In the process, I have also removed the following commands:
new is now changelog:new
ready is now changelog:ready
edit is now version:edit
Almost every class has either been renamed or removed at this time, making this a BC break both for users as well as those extending the package. As such, it will target a new major version (v2).
TODO
[x] Complete testing. I started testing, but there was so much changing as I added more events and listeners that, at a certain point, I had to stop. Now that the code has stabilized, and I've verified that all commands work generally as expected, I plan to go back to unit testing.
[x] Pre-Release support. For releases marked alpha, beta, RC, or dev, I plan to alter the providers to create pre-releases, if they support the concept.
[x] Documentation. I need to document the various commands, but also the config system and format, as well as how to extend with your own providers.
Trying it out
For those who want to use this branch and test it, I suggest:
$ git clone git://github.com:weierophinney/keep-a-changelog.git
$ cd keep-a-changelog
$ composer install
and then aliasing keep-a-changelog to the binary in that checkout (bin/keep-a-changelog).
This is a refactor of the internals of the application in order to accomplish several goals:
Define providers based on the behaviors consumed: generating issue and patch links, and creating releases.
Making configuration a first-class citizen, instead of a tacked-on extra. In particular, it now has a clear hierarchy for overrides: global (now in
$XDG_CONFIG_HOME
), local (./.keep-a-changelog.ini
), and command-line options. Each config type is a single file, with all relevant data. Local configuration CANNOT store tokens (these should only be saved in global configuration or the environment, for use with options). Config currently covers:Rewrite all command internals such that they now use an event bus. Specifically, the patch requires psr/event-dispatcher, and implements both a dispatcher and a listener provider. Each command triggers a specific event, marshaling the event from command arguments and options, and checks for success status, using that to report script exit status.
This approach makes marshaling configuration simpler (each config-aware command has an event that is config-aware, and composes a listener for marshaling configuration), and allows greater re-use between the various commands; in many cases, the only listener specific to a given command will be the final one in the stack. Additionally, it makes understanding the workflow easier; maintainers can look at the listener list for a given event to see the workflow, and inspect the individual listeners to understand what the do. Many are just a few lines of code at this time.
Expands the EntryCommand to allow specifying issues as well as patches.
Expands the
version:show
command to allow omitting the version, which then displays the latest version present.Expands configuration commands. The app now exposes:
config:create [--global|--local]
for creating either the global or local configuration file (or both!)config:remove [--global|--local]
for removing either the global or local configuration file (or both!)config:edit [--global|--local]
for editing either the global or local configuration file (but NOT both)config:show [--global|--local]
for showing the global, local, or merged configuration files. This WILL NOT show tokens.Expands the
version:edit
command to allow specifying a version to edit (you can edit ANY version, not just the latest, now!)release
no longer requires thepackage
argument. It can now be specified in the local configuration file, passed via the--package
option, or auto-discovered based on the presence of acomposer.json
orpackage.json
with aname
entry.In the process, I have also removed the following commands:
new
is nowchangelog:new
ready
is nowchangelog:ready
edit
is nowversion:edit
Almost every class has either been renamed or removed at this time, making this a BC break both for users as well as those extending the package. As such, it will target a new major version (v2).
TODO
[x] Complete testing. I started testing, but there was so much changing as I added more events and listeners that, at a certain point, I had to stop. Now that the code has stabilized, and I've verified that all commands work generally as expected, I plan to go back to unit testing.
[x] Pre-Release support. For releases marked alpha, beta, RC, or dev, I plan to alter the providers to create pre-releases, if they support the concept.
[x] Documentation. I need to document the various commands, but also the config system and format, as well as how to extend with your own providers.
Trying it out
For those who want to use this branch and test it, I suggest:
and then aliasing
keep-a-changelog
to the binary in that checkout (bin/keep-a-changelog
).