Skip to content
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

Allow a custom changelog format #640

Closed
wants to merge 2 commits into from
Closed

Allow a custom changelog format #640

wants to merge 2 commits into from

Conversation

sstok
Copy link
Contributor

@sstok sstok commented Oct 20, 2016

Q A
Fixed tickets #540 #514
License MIT

A custom changelog format, this is has been on my wish-list for to long, but I finally came-up
with something that solves my (and others) use-cases 😋

Instead of using a risky unreadable format like %nn (what is nn??)
I decided to use a fully-fledged Template engine, Twig to be exact.

But this is just the start, Gush has always been very opinionated about
which format we use for everything (pull-request merge message, changelog).
With this new system this is finally customizable, and performance is not affected
to much (Twig is lazy loaded).

Not only that, I have a great idea about a new feature (for which I will disclose
some more details soon. In short it's about keeping multiple repositories
common files (README, LICENSE, etc.) in sync (like Sonata-Devkit does).
Which will also use Twig for it's templates.


<comment>
templates:
changelog: [".gush/templates/changelog.twig"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not too fond of this one, keep it simple rather with templates.changelog key, it does not need to redirect to a file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, no problem :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

$output->writeln(sprintf('<info>Found %s commits</info>', count($commits)), OutputInterface::VERBOSITY_DEBUG);

$items = [];

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove line break

Copy link
Contributor Author

@sstok sstok Oct 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to keep language constructs and variable definitions separate for better readability 👍

I actually want to move the try-catch block to it's own function. But that's for a later refactoring 😃

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it makes the code lengthy unnecessarily

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I will change 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@sstok
Copy link
Contributor Author

sstok commented Oct 20, 2016

FYI, I did not enable caching as this doesn't work all the to well with String templates 😉

$twig = new \Twig_Environment($loader, [
'autoescape' => false,
'strict_variables' => true,
'cache' => false, // This may have to be reconsidered
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment can be removed, I did not find any performance problems 😃

@sstok sstok closed this Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants