This commit is contained in:
Petr Korolev 2015-07-16 14:47:01 +03:00
parent 4de98a7d16
commit e274f9992a
4 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,5 @@
# This configuration was generated by `rubocop --auto-gen-config` # This configuration was generated by `rubocop --auto-gen-config`
# on 2015-06-12 11:23:12 +0300 using RuboCop version 0.31.0. # on 2015-07-16 14:46:25 +0300 using RuboCop version 0.31.0.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
@ -7,7 +7,7 @@
# Offense count: 13 # Offense count: 13
Metrics/AbcSize: Metrics/AbcSize:
Max: 71 Max: 73
# Offense count: 1 # Offense count: 1
Metrics/CyclomaticComplexity: Metrics/CyclomaticComplexity:

View File

@ -56,7 +56,7 @@ module GitHubChangelogGenerator
# @param [String] newer_tag Name of the newer tag. Could be nil for `Unreleased` section # @param [String] newer_tag Name of the newer tag. Could be nil for `Unreleased` section
# @param [String] older_tag_name Older tag, used for the links. Could be nil for last tag. # @param [String] older_tag_name Older tag, used for the links. Could be nil for last tag.
# @return [String] Ready and parsed section # @return [String] Ready and parsed section
def create_log(pull_requests, issues, newer_tag, older_tag_name = nil) def create_log_for_tag(pull_requests, issues, newer_tag, older_tag_name = nil)
newer_tag_link, newer_tag_name, newer_tag_time = detect_link_tag_time(newer_tag) newer_tag_link, newer_tag_name, newer_tag_time = detect_link_tag_time(newer_tag)
github_site = options[:github_site] || "https://github.com" github_site = options[:github_site] || "https://github.com"

View File

@ -8,7 +8,7 @@ module GitHubChangelogGenerator
sort_tags_by_date(@filtered_tags) sort_tags_by_date(@filtered_tags)
fetch_issues_and_pr fetch_issues_and_pr
log = "# Change Log\n\n" log = "#{@options[:header]}\n\n"
if @options[:unreleased_only] if @options[:unreleased_only]
log += generate_log_between_tags(filtered_tags[0], nil) log += generate_log_between_tags(filtered_tags[0], nil)
@ -103,7 +103,7 @@ module GitHubChangelogGenerator
return "" return ""
end end
create_log(filtered_pull_requests, filtered_issues, newer_tag, older_tag_name) create_log_for_tag(filtered_pull_requests, filtered_issues, newer_tag, older_tag_name)
end end
# Apply all filters to issues and pull requests # Apply all filters to issues and pull requests

View File

@ -59,6 +59,9 @@ module GitHubChangelogGenerator
opts.on("--issues-label [LABEL]", "Setup custom label for closed-issues section. Default is \"**Closed issues:**\"") do |v| opts.on("--issues-label [LABEL]", "Setup custom label for closed-issues section. Default is \"**Closed issues:**\"") do |v|
options[:issue_prefix] = v options[:issue_prefix] = v
end end
opts.on("--header-label [LABEL]", "Setup custom header label. Default is \"# Change Log\"") do |v|
options[:header] = v
end
opts.on("--pr-label [LABEL]", "Setup custom label for pull requests section. Default is \"**Merged pull requests:**\"") do |v| opts.on("--pr-label [LABEL]", "Setup custom label for pull requests section. Default is \"**Merged pull requests:**\"") do |v|
options[:merge_prefix] = v options[:merge_prefix] = v
end end
@ -162,6 +165,7 @@ module GitHubChangelogGenerator
max_issues: nil, max_issues: nil,
simple_list: false, simple_list: false,
verbose: true, verbose: true,
header: "# Change Log",
merge_prefix: "**Merged pull requests:**", merge_prefix: "**Merged pull requests:**",
issue_prefix: "**Closed issues:**", issue_prefix: "**Closed issues:**",
bug_prefix: "**Fixed bugs:**", bug_prefix: "**Fixed bugs:**",