Commit Graph

13 Commits

Author SHA1 Message Date
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
Olle Jonsson
5bb4d51b96 Options#print_options: tell don't ask 2017-10-14 21:52:26 +02:00
Olle Jonsson
1fac4efe47 [docs] API docs for Options, Parser
- shorten implementation of print_options
2017-10-14 21:28:02 +02:00
Olle Jonsson
ad0d972ed9 Add option --require to load custom Ruby code (#574) 2017-10-14 21:00:56 +02:00
Tim Meusel
21ec2db39b Add breaking-changes section to changelog (#530)
* add breaking-changes section to changelog

* Clean up parse_by_sections

* Thank you bastelfreak and ekohl!
2017-10-10 20:27:23 +02:00
Olle Jonsson
b36d85eb53 Drop Project-and-Username-finding code (#451)
* Remove Project-and-Username finding code and usages

* Remove "github_remote" option, now unused

* Update README: Usage has changed
2017-10-10 19:53:21 +02:00
Olle Jonsson
874c23c64f Chore: Rubocop 0.49.0 (#516)
* Rubocoping
2017-05-25 00:11:02 +02:00
Olle Jonsson
26b124a67c bundled cacert.pem with --ssl-ca-file PATH option (#480)
* Add a bundled cacert.pem from curl's website
* Using the --ssl-ca-file PATH option overrides ENV var SSL_CA_PATH
* Having none of those allow you to use the default, the bundled cacert.pem
* Octokit's SSL config uses this new setting
* Rake task to update_ssl_ca_file
* Rubocop target 2.2
2017-05-24 23:43:31 +02:00
Olle Jonsson
d334aa01f2 Option parsing: Remove tag1, tag2 cruft (#479) 2017-02-08 21:58:30 +01:00
aih
1fd341d9bf Add option to show selected labels in the issue line: --issue-line-labels 2016-10-26 09:50:54 -07:00
Olle Jonsson
e123466b82 Linting 2016-10-05 23:31:19 +02:00
Olle Jonsson
c1f6fce86c Options: add error class, refactor
- improve readability of specs
  - extract methods
2016-10-05 23:12:48 +02:00
Olle Jonsson
43a6e49055 Options: a class to wrap Hash-accessing options choices
- protects against bad names
2016-10-05 23:10:21 +02:00