diff --git a/lib/github_changelog_generator.rb b/lib/github_changelog_generator.rb index a1f3203..ad23914 100755 --- a/lib/github_changelog_generator.rb +++ b/lib/github_changelog_generator.rb @@ -176,13 +176,6 @@ module GitHubChangelogGenerator older_tag_time = self.get_time_of_tag(older_tag) newer_tag_time = self.get_time_of_tag(newer_tag) - # if we mix up tags order - lits fix it! - # if older_tag_time < newer_tag_time - # older_tag, newer_tag = newer_tag, older_tag - # older_tag_time, newer_tag_time = newer_tag_time, older_tag_time - # puts "Swap tags!" - # end - newer_tag_name = newer_tag['name'] pull_requests = Array.new(@pull_requests) @@ -265,10 +258,18 @@ module GitHubChangelogGenerator if @options[:pulls] # Generate pull requests: if pull_requests - pull_requests.each { |dict| - merge = "#{@options[:merge_prefix]}#{dict[:title]} [\\##{dict[:number]}](#{dict.html_url})\n\n" - log += "- #{merge}" - } + if @options[:author] + pull_requests.each { |dict| + merge = "#{@options[:merge_prefix]}#{dict[:title]} [\\##{dict[:number]}](#{dict.html_url}) ([#{dict.user.login}](#{dict.user.html_url}))\n\n" + log += "- #{merge}" + } + else + pull_requests.each { |dict| + merge = "#{@options[:merge_prefix]}#{dict[:title]} [\\##{dict[:number]}](#{dict.html_url})\n\n" + log += "- #{merge}" + } + end + end end diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index edfa3ec..adc202c 100644 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -1,11 +1,12 @@ #!/usr/bin/env ruby require 'optparse' +require 'PP' require_relative 'version' module GitHubChangelogGenerator class Parser def self.parse_options - options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* '} + options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* ', :author => true} parser = OptionParser.new { |opts| opts.banner = 'Usage: changelog_generator [options]' @@ -37,6 +38,9 @@ module GitHubChangelogGenerator opts.on('-l', '--last-changes', 'Generate log between last 2 tags only') do |last| options[:last] = last end + opts.on('--[no-]author', 'Add author of pull-request in the end. Default is true') do |author| + options[:last] = author + end opts.on('-f', '--date-format [FORMAT]', 'Date format. Default is %d/%m/%y') do |last| options[:format] = last end