Commit Graph

115 Commits

Author SHA1 Message Date
Olle Jonsson
941a92e96d RuboCop linting 2017-12-29 16:17:02 +01:00
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
Saugat Acharya
d9cf6ffd94 Make 'change log' a single word (#579) 2017-12-13 22:06:00 +01: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
Florian Thomas
64f4cd07c9 filter tags correctly when since_tag is set to most recent tag (#566)
* filter tags correctly when `since_tag` is set to most recent tag
Before this fix [`filtered_tags`](https://github.com/skywinder/github-changelog-generator/blob/master/lib/github_changelog_generator/generator/generator_generation.rb#L132)
was empty which caused a fallback to the last tag in the sorted_tags array (which is the oldest tag).
There for no issues and PRs were filtered in that case.

fixes #555
fixes #304
2017-10-05 23:15:06 +02:00
Hunter Haugen
a287bd872b
Rebase, pass rubocop, remove between-tags references
This is a rebase and resubmission of #453
2017-07-27 15:51:49 -07:00
Tom Duffield
0ca7371306
Add tests for label filtering
Signed-off-by: Tom Duffield <tom@chef.io>
2017-07-27 10:41:52 -07:00
Tom Duffield
ce63f648ac
include default options in tags tests
Signed-off-by: Tom Duffield <tom@chef.io>
2017-07-27 10:39:38 -07:00
Tom Duffield
174baec266
Use first SHA for last tag
Rather than having the last tag be an empty husk, generate a full
changelog link using the first sha from the repository.

Signed-off-by: Tom Duffield <tom@chef.io>
2017-07-27 10:37:49 -07:00
Tom Duffield
f57b4c283d
Rename tag section mapping test
Signed-off-by: Tom Duffield <tom@chef.io>
2017-07-27 10:37:44 -07:00
Tom Duffield
ee5a507f76
Filter excluded tags within the section map builder
Because we need might need excluded tags to build compare links, the
section map generator needs to have access to those tags. But, we don't
want excluded tags to have section headers. So instead, we'll create
another copy of the list that doesn't have tags excluded.

Signed-off-by: Tom Duffield <tom@chef.io>
2017-07-27 10:37:38 -07:00
Tom Duffield
66177c58e3
DRY up the tests and address Rubocop feedback
Signed-off-by: Tom Duffield <tom@chef.io>
2017-07-27 10:37:32 -07:00
Tom Duffield
d6c26ef4a9
Generate mapping that will match expectations
This change neccesitated changing the behavior or the
`filter_since_tag`. Since we want our compare links to include the since
tag, we need to keep that tag in the filtered list. Instead, we detect
that the tag is the since tag and filter it out. This will prevent the
since_tag header from being duplicated when pulling from a base.

The same goes for the first tag listed in between_tags. We don't want an
empty section header for this.

Signed-off-by: Tom Duffield <tom@chef.io>
2017-07-27 10:37:26 -07:00
Tom Duffield
c718930fb1
Add initial tests for tag_section_mapping
Before we do anything, let's get a solid expectation of what we want our
section headers to look like.

Signed-off-by: Tom Duffield <tom@chef.io>
2017-07-27 10:36:11 -07:00
Olle Jonsson
6ad5aa106d Bug: require ActiveSupport core_ext blank (#520) 2017-05-25 14:07:34 +02:00
Lucas Huang
e9ee9556ce remove --between_tags option (#501) 2017-05-25 00:29:31 +02:00
Olle Jonsson
874c23c64f Chore: Rubocop 0.49.0 (#516)
* Rubocoping
2017-05-25 00:11:02 +02:00
Olle Jonsson
1e9e72f1a5 Update to latest CodeClimate (#478)
* Update to latest CodeClimate
* SpecHelper: drop CodeClimate formatter
2017-02-08 21:09:23 +01:00
Andrew Waage
15d0b63b45 assert exactly x times 2016-10-19 14:33:05 -07:00
Andrew Waage
77ecafa978 using retriable gem 2016-10-19 14:30:43 -07:00
Andrew Waage
7b8c667447 style 2016-10-07 18:37:36 -07:00
Andrew Waage
074b467251 added specs and refactor a bit 2016-10-07 16:58:38 -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
Olle Jonsson
828d639348 Spec: Test a url helper function (#428) 2016-10-01 19:23:48 +02:00
Olle Jonsson
1cbd8c30dc VCR: Try to use frobnitz as default token 2016-09-29 23:09:05 +02:00
Olle Jonsson
d8b34169a3 Linting 2016-09-29 23:09:04 +02:00
Olle Jonsson
88bcb872a6 VCR to censor ENV['CHANGELOG_GITHUB_TOKEN'] 2016-09-29 23:09:04 +02:00
Olle Jonsson
da0024cbdf GeneratorTagsSpec: change name of a test 2016-09-29 23:09:04 +02:00
Olle Jonsson
8769ced74e OctoFetcher spec: The new assignees field 2016-09-29 23:09:04 +02:00
Olle Jonsson
49b62a9d23 Style: use the short form for RSpec metadata 2016-09-29 23:09:04 +02:00
Olle Jonsson
1177f09ca5 Drop Hashie dependency 2016-09-29 23:09:04 +02:00
Olle Jonsson
ad44c035f0 WIP Remove github_api gem, smaller dependencies
- use VCR with metadata instead of macros
  - upgrade colorize gem
2016-09-29 23:09:04 +02:00
Andrew Waage
ef9867c122 fixing rubocop and removing original fetcher 2016-09-29 23:09:04 +02:00
Andrew Waage
71c5348bdb made old fetcher compatible 2016-09-29 23:09:04 +02:00
Andrew Waage
a17931f3d4 fixing specs 2016-09-29 23:09:04 +02:00
Andrew Waage
2347cc4220 added specs for the new octo_fetcher. Also had to refactor a bit to deal with hashes and arrays instead of objects 2016-09-29 23:09:04 +02:00
Andrew Waage
8277aa4319 added VCR and specs for original fetcher 2016-09-29 23:09:04 +02:00
Olle Jonsson
725194acc0 SimpleCov config: Ignore gemfiles folder 2016-09-27 21:40:23 +02:00
Olle Jonsson
5c21fc980f Rubocop setting: avoid copping the universe 2016-09-22 19:04:35 +02:00
Olle Jonsson
91b5abc477 Spec: avoid warning when stubbing ARGV 2016-09-01 20:47:31 +02:00
Petr Korolev
37a7430d81 add test 2016-07-21 17:48:47 +03:00
Petr Korolev
430d6f5bd9 add missing test 2016-07-21 17:47:53 +03:00
John Keiser
c0c8bb5653 Don't constrain runtime deps.
Since we are a development dependency of many projects,
constraining our runtime deps can cause their Gemfiles to downgrade
dependencies they share with us, which is never desirable.
2016-07-21 17:47:52 +03:00
Olle Jonsson
cc653b6b21 linting 2016-04-18 16:53:45 +02:00
Olle Jonsson
9ce5c76d4a Linting 2016-04-18 16:53:25 +02:00
Olle Jonsson
86ca388ecf Spec: Smaller help functions 2016-04-18 16:53:25 +02:00
Olle Jonsson
9c6068f026 Avoid nil bug in detect_since_tag 2016-04-18 16:53:25 +02:00