phly / keep-a-changelog

Tools for manipulating CHANGELOG.md files in Keep A Changelog format, including tagging and releasing.
https://phly.github.io/keep-a-changelog/
BSD 2-Clause "Simplified" License
181 stars 21 forks source link

PHAR version creates a buggy local config #82

Closed rieschl closed 4 years ago

rieschl commented 4 years ago

Bug Report

Q A
BC Break no
Version 2.9.0

Summary

The issue probably is related to #81

When creating a local config with the PHAR version with keep-a-changelog config:create -l the config file starts with _HumbugBoxaa7bf30d75ed\:

$ cat .keep-a-changelog.ini
_HumbugBoxaa7bf30d75ed\[defaults]
changelog_file = CHANGELOG.md
provider = github
remote = origin

[providers]
github[class] = Phly\KeepAChangelog\Provider\GitHub
gitlab[class] = Phly\KeepAChangelog\Provider\GitLab

How to reproduce

Download the PHAR and execute keep-a-changelog config:create -l.

Expected behaviour

No humbug 🙂

rieschl commented 4 years ago

When debugging #81 I discovered that scoping the PHAR (see #81 for more info) rewrites the constant in the CreateLocalConfigListener from:

    private const TEMPLATE = <<<'EOT'
[defaults]
changelog_file = %s
provider = github
remote = origin

[providers]
github[class] = Phly\KeepAChangelog\Provider\GitHub
gitlab[class] = Phly\KeepAChangelog\Provider\GitLab

EOT;

to

    private const TEMPLATE = <<<'EOT'
_HumbugBoxa35b2ab0d726\[defaults]
changelog_file = %s
provider = github
remote = origin

[providers]
github[class] = Phly\KeepAChangelog\Provider\GitHub
gitlab[class] = Phly\KeepAChangelog\Provider\GitLab

EOT;

It doesn't do that in the global config. I'm not sure why but that seems like a bug in PHP-Scoper to me.