-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a basic Markdown output formatter - and some basic docs #35
Conversation
|
||
TBD - still in development | ||
* Your project uses `git` | ||
* You use semver formatted `git` tags like `1.2.3` to mark releases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we support parsing things like release-1.2.3
or v1.2.3
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now at least, no. Issue maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README.md
Outdated
You must currently install the tool using: | ||
|
||
```bash | ||
$ composer require roave/api-compare |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
composer require --dev
|
||
This will automatically detect the last minor version tagged, and | ||
compare the API against the current `HEAD`. If any BC breaks are found, | ||
the tool returns a non-zero status, which on most CI systems will cause |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably document that it is 2
README.md
Outdated
documentation for changelogs: | ||
|
||
```bash | ||
$ vendor/bin/api-compare --markdown=bc-breaks.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's please just use STDOUT
. No file writing, please @_@
Running the tool with options: | ||
|
||
```bash | ||
$ vendor/bin/api-compare [--from=] [--to=] [--markdown=] [<sources-path>] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just call it --format=markdown
instead?
attempt to figure out the last minor version released. | ||
* `--to=<revision>` specify manually what the "new" version (e.g. | ||
`1.1.0` or a specific `git` hash). The default value is `HEAD`. | ||
* `--markdown=<filename>` If provided, the tool will generate the list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again: file output should probably be avoided. Better to send everything to STDOUT
* `<sources-path>` if given, you can specify in which directory to | ||
examine for classes. This defaults to `src`. | ||
|
||
## Configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop zis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bcoz empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are currently no configuration options available.
src/Command/ApiCompare.php
Outdated
|
||
$markdownFile = trim((string)$input->getOption('markdown')); | ||
if ($markdownFile !== '') { | ||
$output->write(sprintf('Generating markdown in %s...', $markdownFile)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should write to STDOUT
and STDERR
separately: https://gist.github.com/MattKetmo/3665488
src/Formatter/MarkdownFormatter.php
Outdated
$this->outputFilename = $outputFilename; | ||
} | ||
|
||
public function write(Changes $changes) : void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: string
src/Formatter/MarkdownFormatter.php
Outdated
{ | ||
$arrayOfChanges = $changes->getIterator()->getArrayCopy(); | ||
|
||
file_put_contents( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As of above: to be avoided. Let's rely on standard piping and output redirection techniques instead.
cfe33f6
to
4a2a585
Compare
Fixes #20