github_changelog_generator 1.16.4 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +52 -16
- data/bin/github_changelog_generator +1 -1
- data/lib/github_changelog_generator/argv_parser.rb +2 -2
- data/lib/github_changelog_generator/file_parser_chooser.rb +27 -0
- data/lib/github_changelog_generator/generator/entry.rb +8 -6
- data/lib/github_changelog_generator/generator/generator.rb +15 -10
- data/lib/github_changelog_generator/generator/generator_fetcher.rb +22 -24
- data/lib/github_changelog_generator/generator/generator_processor.rb +15 -25
- data/lib/github_changelog_generator/generator/generator_tags.rb +24 -34
- data/lib/github_changelog_generator/generator/section.rb +9 -4
- data/lib/github_changelog_generator/octo_fetcher.rb +30 -12
- data/lib/github_changelog_generator/options.rb +12 -2
- data/lib/github_changelog_generator/parser.rb +4 -4
- data/lib/github_changelog_generator/parser_file.rb +0 -24
- data/lib/github_changelog_generator/task.rb +2 -2
- data/lib/github_changelog_generator/version.rb +1 -1
- data/lib/github_changelog_generator.rb +18 -16
- data/man/git-generate-changelog.html +2 -2
- data/spec/github_changelog_generator_spec.rb +32 -0
- data/spec/unit/generator/entry_spec.rb +2 -2
- data/spec/unit/generator/generator_processor_spec.rb +61 -0
- data/spec/unit/generator/generator_spec.rb +151 -0
- data/spec/unit/generator/generator_tags_spec.rb +1 -1
- data/spec/unit/generator/section_spec.rb +9 -0
- data/spec/unit/octo_fetcher_spec.rb +8 -8
- data/spec/unit/{parse_file_spec.rb → parser_file_spec.rb} +35 -15
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_commits/when_API_is_valid/returns_commits.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_commits_before/when_API_is_valid/returns_commits.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_issue_with_proper_key/values.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_issues.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_issues_with_labels.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_pull_request_with_proper_key/values.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_pull_requests_with_labels.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_pull_requests/when_API_call_is_valid/returns_correct_pull_request_keys.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_pull_requests/when_API_call_is_valid/returns_pull_requests.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_pull_requests/when_API_call_is_valid.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_commit/when_API_call_is_valid/returns_commit.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_commit/when_API_call_is_valid.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_date_of_tag/when_API_call_is_valid/returns_date.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_date_of_tag/when_API_call_is_valid.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_events_async/when_API_call_is_valid/populates_issues.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_events_async/when_API_call_is_valid.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_API_call_is_valid/should_return_tags.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_API_call_is_valid/should_return_tags_count.json +1 -1
- data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_API_call_is_valid.json +1 -1
- metadata +12 -9
|
@@ -3,15 +3,18 @@
|
|
|
3
3
|
describe GitHubChangelogGenerator::ParserFile do
|
|
4
4
|
describe ".github_changelog_generator" do
|
|
5
5
|
let(:options) { {} }
|
|
6
|
+
let(:parser) { described_class.new(options, StringIO.new(file)) }
|
|
6
7
|
|
|
7
8
|
context "when the well-known default file does not exist" do
|
|
8
|
-
let(:parser) {
|
|
9
|
+
let(:parser) { described_class.new(options) }
|
|
10
|
+
|
|
9
11
|
subject { parser.parse! }
|
|
12
|
+
|
|
10
13
|
it { is_expected.to be_nil }
|
|
11
14
|
end
|
|
12
15
|
|
|
13
16
|
context "when file is empty" do
|
|
14
|
-
let(:
|
|
17
|
+
let(:file) { "" }
|
|
15
18
|
|
|
16
19
|
it "does not change the options" do
|
|
17
20
|
expect { parser.parse! }.to_not(change { options })
|
|
@@ -19,19 +22,26 @@ describe GitHubChangelogGenerator::ParserFile do
|
|
|
19
22
|
end
|
|
20
23
|
|
|
21
24
|
context "when file is incorrect" do
|
|
22
|
-
let(:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
let(:file) do
|
|
26
|
+
<<~FILE.strip
|
|
27
|
+
unreleased_label=staging
|
|
28
|
+
unreleased: false
|
|
29
|
+
FILE
|
|
26
30
|
end
|
|
31
|
+
|
|
27
32
|
it { expect { parser.parse! }.to raise_error(/line #2/) }
|
|
28
33
|
end
|
|
29
34
|
|
|
30
35
|
context "allows empty lines and comments with semi-colon or pound sign" do
|
|
31
|
-
let(:file)
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
let(:file) do
|
|
37
|
+
"\n \n#{<<~REMAINING.strip}"
|
|
38
|
+
# Comment on first line
|
|
39
|
+
unreleased_label=staging
|
|
40
|
+
; Comment on third line
|
|
41
|
+
unreleased=false
|
|
42
|
+
REMAINING
|
|
34
43
|
end
|
|
44
|
+
|
|
35
45
|
it { expect { parser.parse! }.not_to raise_error }
|
|
36
46
|
end
|
|
37
47
|
|
|
@@ -39,22 +49,32 @@ describe GitHubChangelogGenerator::ParserFile do
|
|
|
39
49
|
let(:default_options) { GitHubChangelogGenerator::Parser.default_options.merge(verbose: false) }
|
|
40
50
|
let(:options) { {}.merge(default_options) }
|
|
41
51
|
let(:options_before_change) { options.dup }
|
|
42
|
-
let(:file)
|
|
43
|
-
|
|
52
|
+
let(:file) do
|
|
53
|
+
<<~FILE.strip
|
|
54
|
+
unreleased_label=staging
|
|
55
|
+
unreleased=false
|
|
56
|
+
header==== Changelog ===
|
|
57
|
+
max_issues=123
|
|
58
|
+
simple-list=true
|
|
59
|
+
FILE
|
|
60
|
+
end
|
|
44
61
|
|
|
45
62
|
it "changes the options" do
|
|
46
63
|
expect { parser.parse! }.to change { options }
|
|
47
64
|
.from(options_before_change)
|
|
48
65
|
.to(options_before_change.merge(unreleased_label: "staging",
|
|
49
66
|
unreleased: false,
|
|
50
|
-
header: "=== Changelog ==="
|
|
67
|
+
header: "=== Changelog ===",
|
|
68
|
+
max_issues: 123,
|
|
69
|
+
simple_list: true))
|
|
51
70
|
end
|
|
52
71
|
|
|
53
72
|
context "turns exclude-labels into an Array", bug: "#327" do
|
|
54
73
|
let(:file) do
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
74
|
+
<<~FILE
|
|
75
|
+
exclude-labels=73a91042-da6f-11e5-9335-1040f38d7f90,7adf83b4-da6f-11e5-ae18-1040f38d7f90
|
|
76
|
+
header_label=# My changelog
|
|
77
|
+
FILE
|
|
58
78
|
end
|
|
59
79
|
|
|
60
80
|
it "reads exclude_labels into an Array" do
|