github-changelog-generator/lib/github_changelog_generator
Eric Putnam 587557e1ac
Refactor generation code and allow custom sections
There's a lot in this PR.
- Added a Section class to more easily make the other changes and
  hopefully add flexibility for the future
- Added an option called `configure_sections` that allows you create
  your own custom sections. It blows away all other sections and uses
only the ones you give it.
- Added an option called `add_sections` that allows you to add_sections
  to the default section set
- Added an option called `include_merged` that can be used when
  configure_sections is defined. Configure sections blows away any and
all default sections so to get this one back, you have to set this
option.
- Added tests for this stuff

@HAIL9000 was a co-author. Because of a little git snafu, I accidentally
squashed all of our work into one so it looks like it was just me.

---

Refactor details:

Before this change, the code in generator.rb and generator_generation.rb was conflated and
method call flow went back and forth between the two files seemingly
randomly. They also both defined the exact same class, which is
un-ruby-ish. I tried to separate methods used for the whole changelog
generation from methods used for specific parts of the changelog and
move them into specific classes.

I reasoned that a changelog is a series of "entries" of all tagged
releases plus an extra entry for the unreleased entry. Each entry is
comprised of a header and a series of "sections" for that entry. Each
section is comprized of a list of issues and/or pull requests for that
entry. So the log contains entries, entries contain sections, and
sections contain issues & prs. I have structured the classes around this idea.

- lib/github_changelog_generator/generator/generator.rb is for code
related to generating the entire changelog.
- lib/github_changelog_generator/generator/entry.rb is for code related
to generating entries.
- lib/github_changelog_generator/generator/section.rb is for code
relating to geneating entry sections.

Issues and PRs are already special objects, so it doesn't make sense to
break those out into their own class.
2017-12-14 16:13:41 -08:00
..
generator Refactor generation code and allow custom sections 2017-12-14 16:13:41 -08:00
ssl_certs bundled cacert.pem with --ssl-ca-file PATH option (#480) 2017-05-24 23:43:31 +02:00
helper.rb Chore: Rubocop 0.49.0 (#516) 2017-05-25 00:11:02 +02:00
octo_fetcher.rb Make 'change log' a single word (#579) 2017-12-13 22:06:00 +01:00
options.rb Refactor generation code and allow custom sections 2017-12-14 16:13:41 -08:00
parser_file.rb Add breaking-changes section to changelog (#530) 2017-10-10 20:27:23 +02:00
parser.rb Refactor generation code and allow custom sections 2017-12-14 16:13:41 -08:00
reader.rb Chore: Rubocop 0.49.0 (#516) 2017-05-25 00:11:02 +02:00
task.rb Refactor generation code and allow custom sections 2017-12-14 16:13:41 -08:00
version.rb v1.15.0-rc 2017-10-29 18:59:21 +01:00