Merge pull request #231 from inaka/master

Add future release option
This commit is contained in:
Petr Korolev 2015-05-13 09:14:34 +03:00
commit f3e484b508
4 changed files with 35 additions and 26 deletions

View File

@ -7,7 +7,7 @@
# Offense count: 21 # Offense count: 21
Metrics/AbcSize: Metrics/AbcSize:
Max: 71 Enabled: false
# Offense count: 2 # Offense count: 2
Metrics/BlockNesting: Metrics/BlockNesting:
@ -25,7 +25,7 @@ Metrics/CyclomaticComplexity:
# Offense count: 28 # Offense count: 28
# Configuration parameters: CountComments. # Configuration parameters: CountComments.
Metrics/MethodLength: Metrics/MethodLength:
Max: 118 Enabled: false
# Offense count: 5 # Offense count: 5
Metrics/PerceivedComplexity: Metrics/PerceivedComplexity:

View File

@ -103,6 +103,7 @@ Type `github_changelog_generator --help` for detailed usage.
--max-issues [NUMBER] Max number of issues to fetch from GitHub. Default is unlimited. --max-issues [NUMBER] Max number of issues to fetch from GitHub. Default is unlimited.
--github-site [URL] The Enterprise Github site on which your project is hosted. --github-site [URL] The Enterprise Github site on which your project is hosted.
--github-api [URL] The enterprise endpoint to use for your Github API. --github-api [URL] The enterprise endpoint to use for your Github API.
--future-release [RELEASE-VERSION] Put the unreleased changes in the specified release number.
-v, --version Print version number -v, --version Print version number
-h, --help Displays Help -h, --help Displays Help

View File

@ -388,8 +388,13 @@ module GitHubChangelogGenerator
# @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(pull_requests, issues, newer_tag, older_tag_name = nil)
newer_tag_time = newer_tag.nil? ? Time.new : @fetcher.get_time_of_tag(newer_tag) newer_tag_time = newer_tag.nil? ? Time.new : @fetcher.get_time_of_tag(newer_tag)
if newer_tag.nil? && @options[:future_release]
newer_tag_name = @options[:future_release]
newer_tag_link = @options[:future_release]
else
newer_tag_name = newer_tag.nil? ? @options[:unreleased_label] : newer_tag["name"] newer_tag_name = newer_tag.nil? ? @options[:unreleased_label] : newer_tag["name"]
newer_tag_link = newer_tag.nil? ? "HEAD" : newer_tag_name newer_tag_link = newer_tag.nil? ? "HEAD" : newer_tag_name
end
github_site = options[:github_site] || "https://github.com" github_site = options[:github_site] || "https://github.com"
project_url = "#{github_site}/#{@options[:user]}/#{@options[:project]}" project_url = "#{github_site}/#{@options[:user]}/#{@options[:project]}"

View File

@ -98,6 +98,9 @@ module GitHubChangelogGenerator
opts.on("--simple-list", "Create simple list from issues and pull requests. Default is false.") do |v| opts.on("--simple-list", "Create simple list from issues and pull requests. Default is false.") do |v|
options[:simple_list] = v options[:simple_list] = v
end end
opts.on("--future-release [RELEASE-VERSION]", "Put the unreleased changes in the specified release number.") do |future_release|
options[:future_release] = future_release
end
opts.on("--[no-]verbose", "Run verbosely. Default is true") do |v| opts.on("--[no-]verbose", "Run verbosely. Default is true") do |v|
options[:verbose] = v options[:verbose] = v
end end