github_changelog_generator 1.15.0.pre.rc → 1.16.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE +1 -1
  3. data/README.md +134 -81
  4. data/Rakefile +1 -1
  5. data/bin/git-generate-changelog +1 -1
  6. data/lib/github_changelog_generator.rb +10 -6
  7. data/lib/github_changelog_generator/argv_parser.rb +224 -0
  8. data/lib/github_changelog_generator/generator/entry.rb +218 -0
  9. data/lib/github_changelog_generator/generator/generator.rb +120 -121
  10. data/lib/github_changelog_generator/generator/generator_fetcher.rb +138 -23
  11. data/lib/github_changelog_generator/generator/generator_processor.rb +60 -27
  12. data/lib/github_changelog_generator/generator/generator_tags.rb +25 -21
  13. data/lib/github_changelog_generator/generator/section.rb +124 -0
  14. data/lib/github_changelog_generator/helper.rb +1 -1
  15. data/lib/github_changelog_generator/octo_fetcher.rb +250 -96
  16. data/lib/github_changelog_generator/options.rb +39 -4
  17. data/lib/github_changelog_generator/parser.rb +70 -209
  18. data/lib/github_changelog_generator/parser_file.rb +35 -16
  19. data/lib/github_changelog_generator/reader.rb +2 -2
  20. data/lib/github_changelog_generator/ssl_certs/cacert.pem +851 -1680
  21. data/lib/github_changelog_generator/task.rb +4 -4
  22. data/lib/github_changelog_generator/version.rb +1 -1
  23. data/man/git-generate-changelog.1 +160 -74
  24. data/man/git-generate-changelog.1.html +159 -95
  25. data/man/git-generate-changelog.html +36 -24
  26. data/man/git-generate-changelog.md +156 -93
  27. data/spec/files/config_example +5 -0
  28. data/spec/files/github-changelog-generator.md +114 -114
  29. data/spec/{install-gem-in-bundler.gemfile → install_gem_in_bundler.gemfile} +2 -0
  30. data/spec/spec_helper.rb +2 -6
  31. data/spec/unit/generator/entry_spec.rb +766 -0
  32. data/spec/unit/generator/generator_processor_spec.rb +103 -41
  33. data/spec/unit/generator/generator_spec.rb +47 -0
  34. data/spec/unit/generator/generator_tags_spec.rb +51 -24
  35. data/spec/unit/generator/section_spec.rb +34 -0
  36. data/spec/unit/octo_fetcher_spec.rb +247 -197
  37. data/spec/unit/options_spec.rb +24 -0
  38. data/spec/unit/parse_file_spec.rb +2 -2
  39. data/spec/unit/parser_spec.rb +50 -0
  40. data/spec/unit/reader_spec.rb +4 -4
  41. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_commits/when_API_is_valid/returns_commits.json +1 -0
  42. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_commits_before/when_API_is_valid/returns_commits.json +1 -1
  43. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid.json +1 -1
  44. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_issue_with_proper_key/values.json +1 -1
  45. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_issues.json +1 -1
  46. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_issues_with_labels.json +1 -1
  47. 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
  48. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_pull_requests_with_labels.json +1 -1
  49. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_pull_requests/when_API_call_is_valid.json +1 -1
  50. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_pull_requests/when_API_call_is_valid/returns_correct_pull_request_keys.json +1 -1
  51. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_pull_requests/when_API_call_is_valid/returns_pull_requests.json +1 -1
  52. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_commit/when_API_call_is_valid.json +1 -1
  53. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_commit/when_API_call_is_valid/returns_commit.json +1 -1
  54. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_date_of_tag/when_API_call_is_valid.json +1 -1
  55. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_date_of_tag/when_API_call_is_valid/returns_date.json +1 -1
  56. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_events_async/when_API_call_is_valid.json +1 -1
  57. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_events_async/when_API_call_is_valid/populates_issues.json +1 -1
  58. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_API_call_is_valid.json +1 -1
  59. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_API_call_is_valid/should_return_tags.json +1 -1
  60. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_API_call_is_valid/should_return_tags_count.json +1 -1
  61. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_wrong_token_provided.json +1 -1
  62. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_wrong_token_provided/should_raise_Unauthorized_error.json +1 -1
  63. metadata +56 -20
  64. data/bin/ghclgen +0 -5
  65. data/lib/github_changelog_generator/generator/generator_generation.rb +0 -181
  66. data/spec/unit/generator/generator_generation_spec.rb +0 -73
@@ -1,73 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module GitHubChangelogGenerator
4
- describe Generator do
5
- describe "#get_string_for_issue" do
6
- let(:issue) do
7
- { "title" => "Bug in code" }
8
- end
9
-
10
- it "formats an issue according to options" do
11
- expect do
12
- described_class.new.get_string_for_issue(issue)
13
- end.not_to raise_error
14
- end
15
- end
16
-
17
- describe "#parse_by_sections" do
18
- def label(name)
19
- { "name" => name }
20
- end
21
-
22
- def issue(title, labels)
23
- { "title" => "issue #{title}", "labels" => labels.map { |l| label(l) } }
24
- end
25
-
26
- def pr(title, labels)
27
- { "title" => "pr #{title}", "labels" => labels.map { |l| label(l) } }
28
- end
29
-
30
- def get_titles(issues)
31
- issues.map { |issue| issue["title"] }
32
- end
33
-
34
- let(:options) do
35
- {
36
- bug_labels: ["bug"],
37
- enhancement_labels: ["enhancement"],
38
- breaking_labels: ["breaking"]
39
- }
40
- end
41
-
42
- let(:issues) do
43
- [
44
- issue("no labels", []),
45
- issue("enhancement", ["enhancement"]),
46
- issue("bug", ["bug"]),
47
- issue("breaking", ["breaking"]),
48
- issue("all the labels", %w[enhancement bug breaking])
49
- ]
50
- end
51
-
52
- let(:pull_requests) do
53
- [
54
- pr("no labels", []),
55
- pr("enhancement", ["enhancement"]),
56
- pr("bug", ["bug"]),
57
- pr("breaking", ["breaking"]),
58
- pr("all the labels", %w[enhancement bug breaking])
59
- ]
60
- end
61
-
62
- it "works" do
63
- sections = described_class.new(options).parse_by_sections(issues, pull_requests)
64
-
65
- expect(get_titles(sections[:issues])).to eq(["issue no labels"])
66
- expect(get_titles(sections[:enhancements])).to eq(["issue enhancement", "issue all the labels", "pr enhancement", "pr all the labels"])
67
- expect(get_titles(sections[:bugs])).to eq(["issue bug", "pr bug"])
68
- expect(get_titles(sections[:breaking])).to eq(["issue breaking", "pr breaking"])
69
- expect(get_titles(pull_requests)).to eq(["pr no labels"])
70
- end
71
- end
72
- end
73
- end