github_changelog_generator 1.15.0.pre.rc → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE +1 -1
  3. data/README.md +126 -51
  4. data/bin/git-generate-changelog +1 -1
  5. data/lib/github_changelog_generator.rb +10 -6
  6. data/lib/github_changelog_generator/generator/entry.rb +218 -0
  7. data/lib/github_changelog_generator/generator/generator.rb +96 -119
  8. data/lib/github_changelog_generator/generator/generator_fetcher.rb +140 -21
  9. data/lib/github_changelog_generator/generator/generator_processor.rb +40 -10
  10. data/lib/github_changelog_generator/generator/generator_tags.rb +10 -12
  11. data/lib/github_changelog_generator/generator/section.rb +104 -0
  12. data/lib/github_changelog_generator/octo_fetcher.rb +113 -23
  13. data/lib/github_changelog_generator/options.rb +35 -4
  14. data/lib/github_changelog_generator/parser.rb +88 -49
  15. data/lib/github_changelog_generator/parser_file.rb +6 -2
  16. data/lib/github_changelog_generator/task.rb +2 -3
  17. data/lib/github_changelog_generator/version.rb +1 -1
  18. data/man/git-generate-changelog.1 +125 -51
  19. data/man/git-generate-changelog.1.html +145 -89
  20. data/man/git-generate-changelog.html +19 -7
  21. data/man/git-generate-changelog.md +141 -86
  22. data/spec/files/github-changelog-generator.md +114 -114
  23. data/spec/{install-gem-in-bundler.gemfile → install_gem_in_bundler.gemfile} +2 -0
  24. data/spec/spec_helper.rb +1 -5
  25. data/spec/unit/generator/entry_spec.rb +760 -0
  26. data/spec/unit/generator/generator_processor_spec.rb +9 -2
  27. data/spec/unit/generator/generator_tags_spec.rb +5 -21
  28. data/spec/unit/octo_fetcher_spec.rb +204 -197
  29. data/spec/unit/options_spec.rb +24 -0
  30. data/spec/unit/parse_file_spec.rb +2 -2
  31. data/spec/unit/reader_spec.rb +4 -4
  32. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_commits/when_API_is_valid/returns_commits.json +1 -0
  33. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_commits_before/when_API_is_valid/returns_commits.json +1 -1
  34. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid.json +1 -1
  35. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_issue_with_proper_key/values.json +1 -1
  36. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_issues.json +1 -1
  37. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_issues_with_labels.json +1 -1
  38. 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
  39. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_issues_and_pr/when_API_call_is_valid/returns_pull_requests_with_labels.json +1 -1
  40. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_pull_requests/when_API_call_is_valid.json +1 -1
  41. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_pull_requests/when_API_call_is_valid/returns_correct_pull_request_keys.json +1 -1
  42. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_closed_pull_requests/when_API_call_is_valid/returns_pull_requests.json +1 -1
  43. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_commit/when_API_call_is_valid.json +1 -1
  44. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_commit/when_API_call_is_valid/returns_commit.json +1 -1
  45. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_date_of_tag/when_API_call_is_valid.json +1 -1
  46. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_date_of_tag/when_API_call_is_valid/returns_date.json +1 -1
  47. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_events_async/when_API_call_is_valid.json +1 -1
  48. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_fetch_events_async/when_API_call_is_valid/populates_issues.json +1 -1
  49. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_API_call_is_valid.json +1 -1
  50. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_API_call_is_valid/should_return_tags.json +1 -1
  51. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_API_call_is_valid/should_return_tags_count.json +1 -1
  52. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_wrong_token_provided.json +1 -1
  53. data/spec/vcr/GitHubChangelogGenerator_OctoFetcher/_github_fetch_tags/when_wrong_token_provided/should_raise_Unauthorized_error.json +1 -1
  54. metadata +17 -17
  55. data/bin/ghclgen +0 -5
  56. data/lib/github_changelog_generator/generator/generator_generation.rb +0 -181
  57. data/spec/unit/generator/generator_generation_spec.rb +0 -73
@@ -7,7 +7,7 @@ module GitHubChangelogGenerator
7
7
  # This class wraps Options, and knows a list of known options. Others options
8
8
  # will raise exceptions.
9
9
  class Options < SimpleDelegator
10
- # Raised on intializing with unknown keys in the values hash,
10
+ # Raised on initializing with unknown keys in the values hash,
11
11
  # and when trying to store a value on an unknown key.
12
12
  UnsupportedOptionError = Class.new(ArgumentError)
13
13
 
@@ -15,20 +15,24 @@ module GitHubChangelogGenerator
15
15
  KNOWN_OPTIONS = %i[
16
16
  add_issues_wo_labels
17
17
  add_pr_wo_labels
18
+ add_sections
18
19
  author
19
20
  base
20
21
  between_tags
22
+ breaking_labels
23
+ breaking_prefix
21
24
  bug_labels
22
25
  bug_prefix
23
26
  cache_file
24
27
  cache_log
25
28
  compare_link
29
+ configure_sections
26
30
  date_format
31
+ deprecated_labels
32
+ deprecated_prefix
27
33
  due_tag
28
34
  enhancement_labels
29
35
  enhancement_prefix
30
- breaking_labels
31
- breaking_prefix
32
36
  exclude_labels
33
37
  exclude_tags
34
38
  exclude_tags_regex
@@ -42,6 +46,7 @@ module GitHubChangelogGenerator
42
46
  include_labels
43
47
  issue_prefix
44
48
  issue_line_labels
49
+ issue_line_body
45
50
  issues
46
51
  max_issues
47
52
  merge_prefix
@@ -50,10 +55,16 @@ module GitHubChangelogGenerator
50
55
  pulls
51
56
  release_branch
52
57
  release_url
58
+ removed_labels
59
+ removed_prefix
53
60
  require
61
+ security_labels
62
+ security_prefix
54
63
  simple_list
55
64
  since_tag
56
65
  ssl_ca_file
66
+ summary_labels
67
+ summary_prefix
57
68
  token
58
69
  unreleased
59
70
  unreleased_label
@@ -95,11 +106,31 @@ module GitHubChangelogGenerator
95
106
  # Pretty-prints a censored options hash, if :verbose.
96
107
  def print_options
97
108
  return unless self[:verbose]
109
+
98
110
  Helper.log.info "Using these options:"
99
- pp(censored_values)
111
+ # For ruby 2.5.0+
112
+ censored_values.each do |key, value|
113
+ print(key.inspect, "=>", value.inspect)
114
+ puts ""
115
+ end
100
116
  puts ""
101
117
  end
102
118
 
119
+ # Boolean method for whether the user is using configure_sections
120
+ def configure_sections?
121
+ !self[:configure_sections].nil? && !self[:configure_sections].empty?
122
+ end
123
+
124
+ # Boolean method for whether the user is using add_sections
125
+ def add_sections?
126
+ !self[:add_sections].nil? && !self[:add_sections].empty?
127
+ end
128
+
129
+ # @return [Boolean] whether write to `:output`
130
+ def write_to_file?
131
+ self[:output].present?
132
+ end
133
+
103
134
  private
104
135
 
105
136
  def values
@@ -2,7 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "optparse"
5
- require "pp"
6
5
  require "github_changelog_generator/version"
7
6
  require "github_changelog_generator/helper"
8
7
 
@@ -38,61 +37,79 @@ module GitHubChangelogGenerator
38
37
  def self.setup_parser(options)
39
38
  OptionParser.new do |opts| # rubocop:disable Metrics/BlockLength
40
39
  opts.banner = "Usage: github_changelog_generator --user USER --project PROJECT [options]"
41
- opts.on("-u", "--user USER", "Username of the owner of target GitHub repo") do |last|
40
+ opts.on("-u", "--user USER", "Username of the owner of target GitHub repo.") do |last|
42
41
  options[:user] = last
43
42
  end
44
- opts.on("-p", "--project PROJECT", "Name of project on GitHub") do |last|
43
+ opts.on("-p", "--project PROJECT", "Name of project on GitHub.") do |last|
45
44
  options[:project] = last
46
45
  end
47
46
  opts.on("-t", "--token [TOKEN]", "To make more than 50 requests per hour your GitHub token is required. You can generate it at: https://github.com/settings/tokens/new") do |last|
48
47
  options[:token] = last
49
48
  end
50
- opts.on("-f", "--date-format FORMAT", "Date format. Default is %Y-%m-%d") do |last|
49
+ opts.on("-f", "--date-format FORMAT", "Date format. Default is %Y-%m-%d.") do |last|
51
50
  options[:date_format] = last
52
51
  end
53
- opts.on("-o", "--output [NAME]", "Output file. Default is CHANGELOG.md") do |last|
52
+ opts.on("-o", "--output [NAME]", "Output file. To print to STDOUT instead, use blank as path. Default is CHANGELOG.md") do |last|
54
53
  options[:output] = last
55
54
  end
56
55
  opts.on("-b", "--base [NAME]", "Optional base file to append generated changes to.") do |last|
57
56
  options[:base] = last
58
57
  end
59
- opts.on("--bugs-label [LABEL]", "Setup custom label for bug-fixes section. Default is \"**Fixed bugs:**\"") do |v|
60
- options[:bug_prefix] = v
58
+ opts.on("--summary-label [LABEL]", "Set up custom label for the release summary section. Default is \"\".") do |v|
59
+ options[:summary_prefix] = v
60
+ end
61
+ opts.on("--breaking-label [LABEL]", "Set up custom label for the breaking changes section. Default is \"**Breaking changes:**\".") do |v|
62
+ options[:breaking_prefix] = v
61
63
  end
62
- opts.on("--enhancement-label [LABEL]", "Setup custom label for enhancements section. Default is \"**Implemented enhancements:**\"") do |v|
64
+ opts.on("--enhancement-label [LABEL]", "Set up custom label for enhancements section. Default is \"**Implemented enhancements:**\".") do |v|
63
65
  options[:enhancement_prefix] = v
64
66
  end
65
- opts.on("--breaking-label [LABEL]", "Setup custom label for the breaking changes section. Default is \"**Breaking changes:**\"") do |v|
66
- options[:breaking_prefix] = v
67
+ opts.on("--bugs-label [LABEL]", "Set up custom label for bug-fixes section. Default is \"**Fixed bugs:**\".") do |v|
68
+ options[:bug_prefix] = v
69
+ end
70
+ opts.on("--deprecated-label [LABEL]", "Set up custom label for the deprecated changes section. Default is \"**Deprecated:**\".") do |v|
71
+ options[:deprecated_prefix] = v
67
72
  end
68
- opts.on("--issues-label [LABEL]", "Setup custom label for closed-issues section. Default is \"**Closed issues:**\"") do |v|
73
+ opts.on("--removed-label [LABEL]", "Set up custom label for the removed changes section. Default is \"**Removed:**\".") do |v|
74
+ options[:removed_prefix] = v
75
+ end
76
+ opts.on("--security-label [LABEL]", "Set up custom label for the security changes section. Default is \"**Security fixes:**\".") do |v|
77
+ options[:security_prefix] = v
78
+ end
79
+ opts.on("--issues-label [LABEL]", "Set up custom label for closed-issues section. Default is \"**Closed issues:**\".") do |v|
69
80
  options[:issue_prefix] = v
70
81
  end
71
- opts.on("--header-label [LABEL]", "Setup custom header label. Default is \"# Change Log\"") do |v|
82
+ opts.on("--header-label [LABEL]", "Set up custom header label. Default is \"# Changelog\".") do |v|
72
83
  options[:header] = v
73
84
  end
74
- opts.on("--front-matter [JSON]", "Add YAML front matter. Formatted as JSON because it's easier to add on the command line") do |v|
85
+ opts.on("--configure-sections [Hash, String]", "Define your own set of sections which overrides all default sections.") do |v|
86
+ options[:configure_sections] = v
87
+ end
88
+ opts.on("--add-sections [Hash, String]", "Add new sections but keep the default sections.") do |v|
89
+ options[:add_sections] = v
90
+ end
91
+ opts.on("--front-matter [JSON]", "Add YAML front matter. Formatted as JSON because it's easier to add on the command line.") do |v|
75
92
  options[:frontmatter] = JSON.parse(v).to_yaml + "---\n"
76
93
  end
77
- opts.on("--pr-label [LABEL]", "Setup custom label for pull requests section. Default is \"**Merged pull requests:**\"") do |v|
94
+ opts.on("--pr-label [LABEL]", "Set up custom label for pull requests section. Default is \"**Merged pull requests:**\".") do |v|
78
95
  options[:merge_prefix] = v
79
96
  end
80
- opts.on("--[no-]issues", "Include closed issues in changelog. Default is true") do |v|
97
+ opts.on("--[no-]issues", "Include closed issues in changelog. Default is true.") do |v|
81
98
  options[:issues] = v
82
99
  end
83
- opts.on("--[no-]issues-wo-labels", "Include closed issues without labels in changelog. Default is true") do |v|
100
+ opts.on("--[no-]issues-wo-labels", "Include closed issues without labels in changelog. Default is true.") do |v|
84
101
  options[:add_issues_wo_labels] = v
85
102
  end
86
- opts.on("--[no-]pr-wo-labels", "Include pull requests without labels in changelog. Default is true") do |v|
103
+ opts.on("--[no-]pr-wo-labels", "Include pull requests without labels in changelog. Default is true.") do |v|
87
104
  options[:add_pr_wo_labels] = v
88
105
  end
89
- opts.on("--[no-]pull-requests", "Include pull-requests in changelog. Default is true") do |v|
106
+ opts.on("--[no-]pull-requests", "Include pull-requests in changelog. Default is true.") do |v|
90
107
  options[:pulls] = v
91
108
  end
92
- opts.on("--[no-]filter-by-milestone", "Use milestone to detect when issue was resolved. Default is true") do |last|
109
+ opts.on("--[no-]filter-by-milestone", "Use milestone to detect when issue was resolved. Default is true.") do |last|
93
110
  options[:filter_issues_by_milestone] = last
94
111
  end
95
- opts.on("--[no-]author", "Add author of pull-request in the end. Default is true") do |author|
112
+ opts.on("--[no-]author", "Add author of pull request at the end. Default is true.") do |author|
96
113
  options[:author] = author
97
114
  end
98
115
  opts.on("--usernames-as-github-logins", "Use GitHub tags instead of Markdown links for the author of an issue or pull-request.") do |v|
@@ -101,67 +118,79 @@ module GitHubChangelogGenerator
101
118
  opts.on("--unreleased-only", "Generate log from unreleased closed issues only.") do |v|
102
119
  options[:unreleased_only] = v
103
120
  end
104
- opts.on("--[no-]unreleased", "Add to log unreleased closed issues. Default is true") do |v|
121
+ opts.on("--[no-]unreleased", "Add to log unreleased closed issues. Default is true.") do |v|
105
122
  options[:unreleased] = v
106
123
  end
107
- opts.on("--unreleased-label [label]", "Setup custom label for unreleased closed issues section. Default is \"**Unreleased:**\"") do |v|
124
+ opts.on("--unreleased-label [label]", "Set up custom label for unreleased closed issues section. Default is \"**Unreleased:**\".") do |v|
108
125
  options[:unreleased_label] = v
109
126
  end
110
- opts.on("--[no-]compare-link", "Include compare link (Full Changelog) between older version and newer version. Default is true") do |v|
127
+ opts.on("--[no-]compare-link", "Include compare link (Full Changelog) between older version and newer version. Default is true.") do |v|
111
128
  options[:compare_link] = v
112
129
  end
113
- opts.on("--include-labels x,y,z", Array, "Only issues with the specified labels will be included in the changelog.") do |list|
130
+ opts.on("--include-labels x,y,z", Array, "Of the labeled issues, only include the ones with the specified labels.") do |list|
114
131
  options[:include_labels] = list
115
132
  end
116
- opts.on("--exclude-labels x,y,z", Array, "Issues with the specified labels will be always excluded from changelog. Default is 'duplicate,question,invalid,wontfix'") do |list|
133
+ opts.on("--exclude-labels x,y,z", Array, "Issues with the specified labels will be excluded from changelog. Default is 'duplicate,question,invalid,wontfix'.") do |list|
117
134
  options[:exclude_labels] = list
118
135
  end
119
- opts.on("--bug-labels x,y,z", Array, 'Issues with the specified labels will be always added to "Fixed bugs" section. Default is \'bug,Bug\'') do |list|
120
- options[:bug_labels] = list
136
+ opts.on("--summary-labels x,y,z", Array, 'Issues with these labels will be added to a new section, called "Release Summary". The section display only body of issues. Default is \'release-summary,summary\'.') do |list|
137
+ options[:summary_labels] = list
138
+ end
139
+ opts.on("--breaking-labels x,y,z", Array, 'Issues with these labels will be added to a new section, called "Breaking changes". Default is \'backwards-incompatible,breaking\'.') do |list|
140
+ options[:breaking_labels] = list
121
141
  end
122
- opts.on("--enhancement-labels x,y,z", Array, 'Issues with the specified labels will be always added to "Implemented enhancements" section. Default is \'enhancement,Enhancement\'') do |list|
142
+ opts.on("--enhancement-labels x,y,z", Array, 'Issues with the specified labels will be added to "Implemented enhancements" section. Default is \'enhancement,Enhancement\'.') do |list|
123
143
  options[:enhancement_labels] = list
124
144
  end
125
- opts.on("--breaking-labels x,y,z", Array, 'Issues with these labels will be added to a new section, called "Breaking Changes". Default is \'backwards-incompatible\'') do |list|
126
- options[:breaking_labels] = list
145
+ opts.on("--bug-labels x,y,z", Array, 'Issues with the specified labels will be added to "Fixed bugs" section. Default is \'bug,Bug\'.') do |list|
146
+ options[:bug_labels] = list
147
+ end
148
+ opts.on("--deprecated-labels x,y,z", Array, 'Issues with the specified labels will be added to a section called "Deprecated". Default is \'deprecated,Deprecated\'.') do |list|
149
+ options[:deprecated_labels] = list
150
+ end
151
+ opts.on("--removed-labels x,y,z", Array, 'Issues with the specified labels will be added to a section called "Removed". Default is \'removed,Removed\'.') do |list|
152
+ options[:removed_labels] = list
153
+ end
154
+ opts.on("--security-labels x,y,z", Array, 'Issues with the specified labels will be added to a section called "Security fixes". Default is \'security,Security\'.') do |list|
155
+ options[:security_labels] = list
127
156
  end
128
157
  opts.on("--issue-line-labels x,y,z", Array, 'The specified labels will be shown in brackets next to each matching issue. Use "ALL" to show all labels. Default is [].') do |list|
129
158
  options[:issue_line_labels] = list
130
159
  end
131
- opts.on("--exclude-tags x,y,z", Array, "Change log will exclude specified tags") do |list|
160
+ opts.on("--exclude-tags x,y,z", Array, "Changelog will exclude specified tags") do |list|
132
161
  options[:exclude_tags] = list
133
162
  end
134
- opts.on("--exclude-tags-regex [REGEX]", "Apply a regular expression on tag names so that they can be excluded, for example: --exclude-tags-regex \".*\+\d{1,}\" ") do |last|
163
+ opts.on("--exclude-tags-regex [REGEX]", "Apply a regular expression on tag names so that they can be excluded, for example: --exclude-tags-regex \".*\+\d{1,}\".") do |last|
135
164
  options[:exclude_tags_regex] = last
136
165
  end
137
- opts.on("--since-tag x", "Change log will start after specified tag") do |v|
166
+ opts.on("--since-tag x", "Changelog will start after specified tag.") do |v|
138
167
  options[:since_tag] = v
139
168
  end
140
- opts.on("--due-tag x", "Change log will end before specified tag") do |v|
169
+ opts.on("--due-tag x", "Changelog will end before specified tag.") do |v|
141
170
  options[:due_tag] = v
142
171
  end
143
- opts.on("--max-issues [NUMBER]", Integer, "Max number of issues to fetch from GitHub. Default is unlimited") do |max|
172
+ opts.on("--max-issues [NUMBER]", Integer, "Maximum number of issues to fetch from GitHub. Default is unlimited.") do |max|
144
173
  options[:max_issues] = max
145
174
  end
146
175
  opts.on("--release-url [URL]", "The URL to point to for release links, in printf format (with the tag as variable).") do |url|
147
176
  options[:release_url] = url
148
177
  end
149
- opts.on("--github-site [URL]", "The Enterprise Github site on which your project is hosted.") do |last|
178
+ opts.on("--github-site [URL]", "The Enterprise GitHub site where your project is hosted.") do |last|
150
179
  options[:github_site] = last
151
180
  end
152
- opts.on("--github-api [URL]", "The enterprise endpoint to use for your Github API.") do |last|
181
+ opts.on("--github-api [URL]", "The enterprise endpoint to use for your GitHub API.") do |last|
153
182
  options[:github_endpoint] = last
154
183
  end
155
- opts.on("--simple-list", "Create simple list from issues and pull requests. Default is false.") do |v|
184
+ opts.on("--simple-list", "Create a simple list from issues and pull requests. Default is false.") do |v|
156
185
  options[:simple_list] = v
157
186
  end
158
187
  opts.on("--future-release [RELEASE-VERSION]", "Put the unreleased changes in the specified release number.") do |future_release|
159
188
  options[:future_release] = future_release
160
189
  end
161
- opts.on("--release-branch [RELEASE-BRANCH]", "Limit pull requests to the release branch, such as master or release") do |release_branch|
190
+ opts.on("--release-branch [RELEASE-BRANCH]", "Limit pull requests to the release branch, such as master or release.") do |release_branch|
162
191
  options[:release_branch] = release_branch
163
192
  end
164
- opts.on("--[no-]http-cache", "Use HTTP Cache to cache Github API requests (useful for large repos) Default is true.") do |http_cache|
193
+ opts.on("--[no-]http-cache", "Use HTTP Cache to cache GitHub API requests (useful for large repos). Default is true.") do |http_cache|
165
194
  options[:http_cache] = http_cache
166
195
  end
167
196
  opts.on("--cache-file [CACHE-FILE]", "Filename to use for cache. Default is github-changelog-http-cache in a temporary directory.") do |cache_file|
@@ -173,17 +202,17 @@ module GitHubChangelogGenerator
173
202
  opts.on("--ssl-ca-file [PATH]", "Path to cacert.pem file. Default is a bundled lib/github_changelog_generator/ssl_certs/cacert.pem. Respects SSL_CA_PATH.") do |ssl_ca_file|
174
203
  options[:ssl_ca_file] = ssl_ca_file
175
204
  end
176
- opts.on("--require x,y,z", Array, "Path to Ruby file(s) to require.") do |paths|
205
+ opts.on("--require x,y,z", Array, "Path to Ruby file(s) to require before generating changelog.") do |paths|
177
206
  options[:require] = paths
178
207
  end
179
- opts.on("--[no-]verbose", "Run verbosely. Default is true") do |v|
208
+ opts.on("--[no-]verbose", "Run verbosely. Default is true.") do |v|
180
209
  options[:verbose] = v
181
210
  end
182
- opts.on("-v", "--version", "Print version number") do |_v|
211
+ opts.on("-v", "--version", "Print version number.") do |_v|
183
212
  puts "Version: #{GitHubChangelogGenerator::VERSION}"
184
213
  exit
185
214
  end
186
- opts.on("-h", "--help", "Displays Help") do
215
+ opts.on("-h", "--help", "Displays Help.") do
187
216
  puts opts
188
217
  exit
189
218
  end
@@ -205,21 +234,31 @@ module GitHubChangelogGenerator
205
234
  unreleased: true,
206
235
  unreleased_label: "Unreleased",
207
236
  compare_link: true,
237
+ exclude_labels: ["duplicate", "question", "invalid", "wontfix", "Duplicate", "Question", "Invalid", "Wontfix", "Meta: Exclude From Changelog"],
238
+ summary_labels: ["Release summary", "release-summary", "Summary", "summary"],
239
+ breaking_labels: ["backwards-incompatible", "Backwards incompatible", "breaking"],
208
240
  enhancement_labels: ["enhancement", "Enhancement", "Type: Enhancement"],
209
241
  bug_labels: ["bug", "Bug", "Type: Bug"],
210
- exclude_labels: ["duplicate", "question", "invalid", "wontfix", "Duplicate", "Question", "Invalid", "Wontfix", "Meta: Exclude From Changelog"],
211
- breaking_labels: %w[backwards-incompatible breaking],
242
+ deprecated_labels: ["deprecated", "Deprecated", "Type: Deprecated"],
243
+ removed_labels: ["removed", "Removed", "Type: Removed"],
244
+ security_labels: ["security", "Security", "Type: Security"],
245
+ configure_sections: {},
246
+ add_sections: {},
212
247
  issue_line_labels: [],
213
248
  max_issues: nil,
214
249
  simple_list: false,
215
250
  ssl_ca_file: nil,
216
251
  verbose: true,
217
- header: "# Change Log",
252
+ header: "# Changelog",
218
253
  merge_prefix: "**Merged pull requests:**",
219
254
  issue_prefix: "**Closed issues:**",
220
- bug_prefix: "**Fixed bugs:**",
221
- enhancement_prefix: "**Implemented enhancements:**",
255
+ summary_prefix: "",
222
256
  breaking_prefix: "**Breaking changes:**",
257
+ enhancement_prefix: "**Implemented enhancements:**",
258
+ bug_prefix: "**Fixed bugs:**",
259
+ deprecated_prefix: "**Deprecated:**",
260
+ removed_prefix: "**Removed:**",
261
+ security_prefix: "**Security fixes:**",
223
262
  http_cache: true,
224
263
  require: []
225
264
  )
@@ -31,6 +31,7 @@ module GitHubChangelogGenerator
31
31
  # Sets options using configuration file content
32
32
  def parse!
33
33
  return unless @file
34
+
34
35
  @file.each_with_index { |line, i| parse_line!(line, i + 1) }
35
36
  @file.close
36
37
  end
@@ -46,6 +47,7 @@ module GitHubChangelogGenerator
46
47
 
47
48
  def parse_line!(line, line_number)
48
49
  return if non_configuration_line?(line)
50
+
49
51
  option_name, value = extract_pair(line)
50
52
  @options[option_key_for(option_name)] = convert_value(value, option_name)
51
53
  rescue StandardError
@@ -66,8 +68,10 @@ module GitHubChangelogGenerator
66
68
  [key.tr("-", "_").to_sym, value.gsub(/[\n\r]+/, "")]
67
69
  end
68
70
 
69
- KNOWN_ARRAY_KEYS = %i[exclude_labels include_labels bug_labels
70
- enhancement_labels breaking_labels issue_line_labels between_tags exclude_tags]
71
+ KNOWN_ARRAY_KEYS = %i[exclude_labels include_labels
72
+ summary_labels breaking_labels enhancement_labels bug_labels
73
+ deprecated_labels removed_labels security_labels
74
+ issue_line_labels between_tags exclude_tags]
71
75
  KNOWN_INTEGER_KEYS = [:max_issues]
72
76
 
73
77
  def convert_value(value, option_name)
@@ -10,7 +10,6 @@ module GitHubChangelogGenerator
10
10
 
11
11
  OPTIONS = %w[ user project token date_format output
12
12
  bug_prefix enhancement_prefix issue_prefix
13
- breaking_labels issue_line_labels
14
13
  header merge_prefix issues
15
14
  add_issues_wo_labels add_pr_wo_labels
16
15
  pulls filter_issues_by_milestone author
@@ -20,7 +19,7 @@ module GitHubChangelogGenerator
20
19
  between_tags exclude_tags exclude_tags_regex since_tag max_issues
21
20
  github_site github_endpoint simple_list
22
21
  future_release release_branch verbose release_url
23
- base ]
22
+ base configure_sections add_sections]
24
23
 
25
24
  OPTIONS.each do |o|
26
25
  attr_accessor o.to_sym
@@ -38,7 +37,7 @@ module GitHubChangelogGenerator
38
37
  end
39
38
 
40
39
  def define(args, &task_block)
41
- desc "Generate a Change log from GitHub"
40
+ desc "Generate a Changelog from GitHub"
42
41
 
43
42
  yield(*[self, args].slice(0, task_block.arity)) if task_block
44
43
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitHubChangelogGenerator
4
- VERSION = "1.15.0-rc"
4
+ VERSION = "1.15.0"
5
5
  end
@@ -1,28 +1,28 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "GIT\-GENERATE\-CHANGELOG" "1" "October 2017" "" ""
4
+ .TH "GIT\-GENERATE\-CHANGELOG" "1" "May 2018" "" ""
5
5
  .
6
6
  .SH "NAME"
7
- \fBgit\-generate\-changelog\fR \- Generate changelog from github
7
+ \fBgit\-generate\-changelog\fR \- Generate changelog from GitHub
8
8
  .
9
9
  .SH "SYNOPSIS"
10
10
  \fBgit generate\-changelog\fR [\-h|\-\-help] [\-u|\-\-user] [\-p|\-\-project]
11
11
  .
12
12
  .SH "DESCRIPTION"
13
- Automatically generate change log from your tags, issues, labels and pull requests on GitHub\.
13
+ Automatically generate changelog from your tags, issues, labels and pull requests on GitHub\.
14
14
  .
15
15
  .SH "OPTIONS"
16
16
  \-u, \-\-user [USER]
17
17
  .
18
18
  .P
19
- Username of the owner of target GitHub repo
19
+ Username of the owner of target GitHub repo\.
20
20
  .
21
21
  .P
22
22
  \-p, \-\-project [PROJECT]
23
23
  .
24
24
  .P
25
- Name of project on GitHub
25
+ Name of project on GitHub\.
26
26
  .
27
27
  .P
28
28
  \-t, \-\-token [TOKEN]
@@ -34,13 +34,13 @@ To make more than 50 requests per hour your GitHub token is required\. You can g
34
34
  \-f, \-\-date\-format [FORMAT]
35
35
  .
36
36
  .P
37
- Date format\. Default is %Y\-%m\-%d
37
+ Date format\. Default is %Y\-%m\-%d\.
38
38
  .
39
39
  .P
40
40
  \-o, \-\-output [NAME]
41
41
  .
42
42
  .P
43
- Output file\. Default is CHANGELOG\.md
43
+ Output file\. To print to STDOUT instead, use blank as path\. Default is CHANGELOG\.md\.
44
44
  .
45
45
  .P
46
46
  \-b, \-\-base [NAME]
@@ -49,76 +49,118 @@ Output file\. Default is CHANGELOG\.md
49
49
  Optional base file to append generated changes to\.
50
50
  .
51
51
  .P
52
- \-\-bugs\-label [LABEL]
52
+ \-\-summary\-label [LABEL]
53
+ .
54
+ .P
55
+ Set up custom label for the release summary section\. Default is ""\.
56
+ .
57
+ .P
58
+ \-\-breaking\-label [LABEL]
53
59
  .
54
60
  .P
55
- Setup custom label for bug\-fixes section\. Default is "\fBFixed bugs:\fR
61
+ Set up custom label for breaking changes section\. Default is "\fBBreaking changes:\fR"\.
56
62
  .
57
63
  .P
58
64
  \-\-enhancement\-label [LABEL]
59
65
  .
60
66
  .P
61
- Setup custom label for enhancements section\. Default is "\fBImplemented enhancements:\fR"
67
+ Set up custom label for enhancements section\. Default is "\fBImplemented enhancements:\fR"\.
68
+ .
69
+ .P
70
+ \-\-bugs\-label [LABEL]
71
+ .
72
+ .P
73
+ Set up custom label for bug\-fixes section\. Default is "\fBFixed bugs:\fR"\.
74
+ .
75
+ .P
76
+ \-\-deprecated\-label [LABEL]
77
+ .
78
+ .P
79
+ Set up custom label for deprecated section\. Default is "\fBDeprecated:\fR"\.
80
+ .
81
+ .P
82
+ \-\-removed\-label [LABEL]
83
+ .
84
+ .P
85
+ Set up custom label for removed section\. Default is "\fBRemoved:\fR"\.
86
+ .
87
+ .P
88
+ \-\-security\-label [LABEL]
89
+ .
90
+ .P
91
+ Set up custom label for security section\. Default is "\fBSecurity:\fR"\.
62
92
  .
63
93
  .P
64
94
  \-\-issues\-label [LABEL]
65
95
  .
66
96
  .P
67
- Setup custom label for closed\-issues section\. Default is "\fBClosed issues:\fR"
97
+ Set up custom label for closed\-issues section\. Default is "\fBClosed issues:\fR"\.
68
98
  .
69
99
  .P
70
100
  \-\-header\-label [LABEL]
71
101
  .
72
102
  .P
73
- Setup custom header label\. Default is "# Change Log"
103
+ Set up custom header label\. Default is "# Changelog"\.
104
+ .
105
+ .P
106
+ \-\-configure\-sections [HASH, STRING]
107
+ .
108
+ .P
109
+ Define your own set of sections which overrides all default sections\.
110
+ .
111
+ .P
112
+ \-\-add\-sections [HASH, STRING]
113
+ .
114
+ .P
115
+ Add new sections but keep the default sections\.
74
116
  .
75
117
  .P
76
118
  \-\-front\-matter [JSON]
77
119
  .
78
120
  .P
79
- Add YAML front matter\. Formatted as JSON because it\'s easier to add on the command line
121
+ Add YAML front matter\. Formatted as JSON because it\'s easier to add on the command line\.
80
122
  .
81
123
  .P
82
124
  \-\-pr\-label [LABEL]
83
125
  .
84
126
  .P
85
- Setup custom label for pull requests section\. Default is "\fBMerged pull requests:\fR"
127
+ Set up custom label for pull requests section\. Default is "\fBMerged pull requests:\fR"\.
86
128
  .
87
129
  .P
88
130
  \-\-[no\-]issues
89
131
  .
90
132
  .P
91
- Include closed issues in changelog\. Default is true
133
+ Include closed issues in changelog\. Default is true\.
92
134
  .
93
135
  .P
94
136
  \-\-[no\-]issues\-wo\-labels
95
137
  .
96
138
  .P
97
- Include closed issues without labels in changelog\. Default is true
139
+ Include closed issues without labels in changelog\. Default is true\.
98
140
  .
99
141
  .P
100
142
  \-\-[no\-]pr\-wo\-labels
101
143
  .
102
144
  .P
103
- Include pull requests without labels in changelog\. Default is true
145
+ Include pull requests without labels in changelog\. Default is true\.
104
146
  .
105
147
  .P
106
148
  \-\-[no\-]pull\-requests
107
149
  .
108
150
  .P
109
- Include pull\-requests in changelog\. Default is true
151
+ Include pull\-requests in changelog\. Default is true\.
110
152
  .
111
153
  .P
112
154
  \-\-[no\-]filter\-by\-milestone
113
155
  .
114
156
  .P
115
- Use milestone to detect when issue was resolved\. Default is true
157
+ Use milestone to detect when issue was resolved\. Default is true\.
116
158
  .
117
159
  .P
118
160
  \-\-[no\-]author
119
161
  .
120
162
  .P
121
- Add author of pull\-request in the end\. Default is true
163
+ Add author of pull request at the end\. Default is true\.
122
164
  .
123
165
  .P
124
166
  \-\-usernames\-as\-github\-logins
@@ -136,73 +178,109 @@ Generate log from unreleased closed issues only\.
136
178
  \-\-[no\-]unreleased
137
179
  .
138
180
  .P
139
- Add to log unreleased closed issues\. Default is true
181
+ Add to log unreleased closed issues\. Default is true\.
140
182
  .
141
183
  .P
142
184
  \-\-unreleased\-label [label]
143
185
  .
144
186
  .P
145
- Setup custom label for unreleased closed issues section\. Default is "\fBUnreleased:\fR"
187
+ Set up custom label for unreleased closed issues section\. Default is "\fBUnreleased:\fR"\.
146
188
  .
147
189
  .P
148
190
  \-\-[no\-]compare\-link
149
191
  .
150
192
  .P
151
- Include compare link (Full Changelog) between older version and newer version\. Default is true
193
+ Include compare link (Full Changelog) between older version and newer version\. Default is true\.
152
194
  .
153
195
  .P
154
196
  \-\-include\-labels x,y,z
155
197
  .
156
198
  .P
157
- Only issues with the specified labels will be included in the changelog\.
199
+ Of the labeled issues, only include the ones with the specified labels\.
158
200
  .
159
201
  .P
160
202
  \-\-exclude\-labels x,y,z
161
203
  .
162
204
  .P
163
- Issues with the specified labels will be always excluded from changelog\. Default is \'duplicate,question,invalid,wontfix\'
205
+ Issues with the specified labels will be excluded from changelog\. Default is \'duplicate,question,invalid,wontfix\'\.
164
206
  .
165
207
  .P
166
- \-\-bug\-labels x,y,z
208
+ \-\-summary\-labels x,y,z
167
209
  .
168
210
  .P
169
- Issues with the specified labels will be always added to "Fixed bugs" section\. Default is \'bug,Bug\'
211
+ Issues with these labels will be added to a new section, called "Release Summary"\. The section display only body of issues\. Default is \'Release summary,release\-summary,Summary,summary\'\.
212
+ .
213
+ .P
214
+ \-\-breaking\-labels x,y,z
215
+ .
216
+ .P
217
+ Issues with these labels will be added to a new section, called "Breaking changes"\. Default is \'backwards\-incompatible,breaking\'\.
170
218
  .
171
219
  .P
172
220
  \-\-enhancement\-labels x,y,z
173
221
  .
174
222
  .P
175
- Issues with the specified labels will be always added to "Implemented enhancements" section\. Default is \'enhancement,Enhancement\'
223
+ Issues with the specified labels will be added to "Implemented enhancements" section\. Default is \'enhancement,Enhancement\'\.
224
+ .
225
+ .P
226
+ \-\-bug\-labels x,y,z
227
+ .
228
+ .P
229
+ Issues with the specified labels will be added to "Fixed bugs" section\. Default is \'bug,Bug\'\.
230
+ .
231
+ .P
232
+ \-\-deprecated\-labels x,y,z
233
+ .
234
+ .P
235
+ Issues with the specified labels will be added to a section called "Deprecated"\. Default is \'deprecated,Deprecated\'\.
236
+ .
237
+ .P
238
+ \-\-removed\-labels x,y,z
239
+ .
240
+ .P
241
+ Issues with the specified labels will be added to a section called "Removed"\. Default is \'removed,Removed\'\.
242
+ .
243
+ .P
244
+ \-\-security\-labels x,y,z
245
+ .
246
+ .P
247
+ Issues with the specified labels will be added to a section called "Security fixes"\. Default is \'security,Security\'\.
248
+ .
249
+ .P
250
+ \-\-issue\-line\-labels x,y,z
251
+ .
252
+ .P
253
+ The specified labels will be shown in brackets next to each matching issue\. Use "ALL" to show all labels\. Default is []\.
176
254
  .
177
255
  .P
178
256
  \-\-exclude\-tags x,y,z
179
257
  .
180
258
  .P
181
- Change log will exclude specified tags
259
+ Changelog will exclude specified tags\.
182
260
  .
183
261
  .P
184
262
  \-\-exclude\-tags\-regex [REGEX]
185
263
  .
186
264
  .P
187
- Apply a regular expression on tag names so that they can be excluded, for example: \-\-exclude\-tags\-regex "\.*+\ed{1,}"
265
+ Apply a regular expression on tag names so that they can be excluded, for example: \-\-exclude\-tags\-regex "\.*+\ed{1,}"\.
188
266
  .
189
267
  .P
190
268
  \-\-since\-tag x
191
269
  .
192
270
  .P
193
- Change log will start after specified tag
271
+ Changelog will start after specified tag\.
194
272
  .
195
273
  .P
196
274
  \-\-due\-tag x
197
275
  .
198
276
  .P
199
- Change log will end before specified tag
277
+ Changelog will end before specified tag\.
200
278
  .
201
279
  .P
202
280
  \-\-max\-issues [NUMBER]
203
281
  .
204
282
  .P
205
- Max number of issues to fetch from GitHub\. Default is unlimited
283
+ Maximum number of issues to fetch from GitHub\. Default is unlimited\.
206
284
  .
207
285
  .P
208
286
  \-\-release\-url [URL]
@@ -214,19 +292,19 @@ The URL to point to for release links, in printf format (with the tag as variabl
214
292
  \-\-github\-site [URL]
215
293
  .
216
294
  .P
217
- The Enterprise Github site on which your project is hosted\.
295
+ The Enterprise GitHub site where your project is hosted\.
218
296
  .
219
297
  .P
220
298
  \-\-github\-api [URL]
221
299
  .
222
300
  .P
223
- The enterprise endpoint to use for your Github API\.
301
+ The enterprise endpoint to use for your GitHub API\.
224
302
  .
225
303
  .P
226
304
  \-\-simple\-list
227
305
  .
228
306
  .P
229
- Create simple list from issues and pull requests\. Default is false\.
307
+ Create a simple list from issues and pull requests\. Default is false\.
230
308
  .
231
309
  .P
232
310
  \-\-future\-release [RELEASE\-VERSION]
@@ -238,13 +316,13 @@ Put the unreleased changes in the specified release number\.
238
316
  \-\-release\-branch [RELEASE\-BRANCH]
239
317
  .
240
318
  .P
241
- Limit pull requests to the release branch, such as master or release
319
+ Limit pull requests to the release branch, such as master or release\.
242
320
  .
243
321
  .P
244
322
  \-\-http\-cache
245
323
  .
246
324
  .P
247
- Use HTTP Cache to cache Github API requests (useful for large repos) Default is true\.
325
+ Use HTTP Cache to cache GitHub API requests (useful for large repos)\. Default is true\.
248
326
  .
249
327
  .P
250
328
  \-\-[no\-]cache\-file [CACHE\-FILE]
@@ -258,16 +336,9 @@ Filename to use for cache\. Default is github\-changelog\-http\-cache in a tempo
258
336
  .P
259
337
  Filename to use for cache log\. Default is github\-changelog\-logger\.log in a temporary directory\.
260
338
  .
261
- .IP "" 4
262
- .
263
- .nf
264
-
339
+ .P
265
340
  \-\-ssl\-ca\-file [PATH]
266
341
  .
267
- .fi
268
- .
269
- .IP "" 0
270
- .
271
342
  .P
272
343
  Path to cacert\.pem file\. Default is a bundled lib/github_changelog_generator/ssl_certs/cacert\.pem\. Respects SSL_CA_PATH\.
273
344
  .
@@ -281,19 +352,22 @@ Paths to Ruby file(s) to require before generating changelog\.
281
352
  \-\-[no\-]verbose
282
353
  .
283
354
  .P
284
- Run verbosely\. Default is true
355
+ Run verbosely\. Default is true\.
285
356
  .
286
357
  .P
287
358
  \-v, \-\-version
288
359
  .
289
360
  .P
290
- Print version number
361
+ Print version number\.
291
362
  .
292
363
  .P
293
364
  \-h, \-\-help
294
365
  .
295
366
  .P
296
- Displays Help
367
+ Displays Help\.
368
+ .
369
+ .SH "REBASED COMMITS"
370
+ GitHub pull requests that have been merged whose merge commit SHA has been modified through rebasing, cherry picking, or some other method may be tracked via a special comment on GitHub\. Git commit SHAs found in comments on pull requests matching the regular expression \fB/rebased commit: ([0\-9a\-f]{40})/i\fR will be used in place of the original merge SHA when being added to the changelog\.
297
371
  .
298
372
  .SH "EXAMPLES"
299
373
  .
@@ -301,7 +375,7 @@ Displays Help
301
375
  Written by Petr Korolev sky4winder@gmail\.com
302
376
  .
303
377
  .SH "REPORTING BUGS"
304
- <\fIhttps://github\.com/skywinder/github\-changelog\-generator/issues\fR>
378
+ <\fIhttps://github\.com/github-changelog-generator/github\-changelog\-generator/issues\fR>
305
379
  .
306
380
  .SH "SEE ALSO"
307
- <\fIhttps://github\.com/skywinder/github\-changelog\-generator/\fR>
381
+ <\fIhttps://github\.com/github-changelog-generator/github\-changelog\-generator/\fR>