Fix #31
This commit is contained in:
@@ -5,20 +5,20 @@ module GitHubChangelogGenerator
|
||||
@options = options
|
||||
end
|
||||
|
||||
def get_string_for_pull_request(pull_request)
|
||||
encapsulated_title = self.encapsulate_string pull_request[:title]
|
||||
def get_string_for_issue(issue)
|
||||
encapsulated_title = self.encapsulate_string issue[:title]
|
||||
|
||||
merge = "#{encapsulated_title} [\\##{pull_request[:number]}](#{pull_request.html_url})"
|
||||
if @options[:author]
|
||||
if pull_request.user.nil?
|
||||
merge += " ({Null user})\n\n"
|
||||
else
|
||||
merge += " ([#{pull_request.user.login}](#{pull_request.user.html_url}))\n\n"
|
||||
merge = "#{encapsulated_title} [\\##{issue[:number]}](#{issue.html_url})"
|
||||
unless issue.pull_request.nil?
|
||||
if @options[:author]
|
||||
if issue.user.nil?
|
||||
merge += " ({Null user})\n\n"
|
||||
else
|
||||
merge += " ([#{issue.user.login}](#{issue.user.html_url}))\n\n"
|
||||
end
|
||||
end
|
||||
else
|
||||
merge += "\n\n"
|
||||
end
|
||||
merge
|
||||
merge += "\n"
|
||||
end
|
||||
|
||||
def encapsulate_string(string)
|
||||
@@ -26,7 +26,7 @@ module GitHubChangelogGenerator
|
||||
string.gsub! '\\', '\\\\'
|
||||
|
||||
encpas_chars = %w(> * _ \( \) [ ])
|
||||
encpas_chars.each{ |char|
|
||||
encpas_chars.each { |char|
|
||||
string.gsub! char, "\\#{char}"
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,27 @@ module GitHubChangelogGenerator
|
||||
class Parser
|
||||
def self.parse_options
|
||||
# :include_labels => %w(bug enhancement),
|
||||
options = {:tag1 => nil, :tag2 => nil, :format => '%Y-%m-%d', :output => 'CHANGELOG.md', :exclude_labels => %w(duplicate question invalid wontfix), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :add_pr_wo_labels => true, :merge_prefix => '*Merged pull requests:* ', :author => true, :filter_issues_by_milestone => true, :compare_link => true, :unreleased => true}
|
||||
hash = {
|
||||
:tag1 => nil,
|
||||
:tag2 => nil,
|
||||
:format => '%Y-%m-%d',
|
||||
:output => 'CHANGELOG.md',
|
||||
:exclude_labels => %w(duplicate question invalid wontfix),
|
||||
:pulls => true,
|
||||
:issues => true,
|
||||
:verbose => true,
|
||||
:add_issues_wo_labels => true,
|
||||
:add_pr_wo_labels => true,
|
||||
:merge_prefix => '#### Merged pull requests:',
|
||||
:issue_prefix => '#### Closed issues:',
|
||||
:bug_prefix => '#### Fixed bugs:',
|
||||
:enhancement_prefix => '#### Implemented enhancements:',
|
||||
:author => true,
|
||||
:filter_issues_by_milestone => true,
|
||||
:compare_link => true,
|
||||
:unreleased => true
|
||||
}
|
||||
options = hash
|
||||
|
||||
parser = OptionParser.new { |opts|
|
||||
opts.banner = 'Usage: changelog_generator [options]'
|
||||
@@ -89,7 +109,7 @@ module GitHubChangelogGenerator
|
||||
match = /(?:.+#{Regexp.escape(github_site)}\/)?(.+)\/(.+)/.match(ARGV[0])
|
||||
|
||||
begin
|
||||
param = match[2].nil?
|
||||
param = match[2].nil?
|
||||
rescue
|
||||
puts "Can't detect user and name from first parameter: '#{ARGV[0]}' -> exit'"
|
||||
exit
|
||||
|
||||
Reference in New Issue
Block a user