Merge branch 'feature/verboose-addition' into develop

This commit is contained in:
Petr Korolev 2014-12-15 15:53:36 +02:00
commit 9646b49add

View File

@ -14,7 +14,7 @@ module GitHubChangelogGenerator
attr_accessor :options, :all_tags, :github attr_accessor :options, :all_tags, :github
PER_PAGE_NUMBER = 100 PER_PAGE_NUMBER = 30
def initialize def initialize
@ -356,7 +356,7 @@ module GitHubChangelogGenerator
def get_all_issues def get_all_issues
if @options[:verbose] if @options[:verbose]
puts "Fetching closed issues...\r" print "Fetching closed issues...\r"
end end
response = @github.issues.list user: @options[:user], repo: @options[:project], state: 'closed', filter: 'all', labels: nil response = @github.issues.list user: @options[:user], repo: @options[:project], state: 'closed', filter: 'all', labels: nil
@ -366,7 +366,6 @@ module GitHubChangelogGenerator
response.each_page do |page| response.each_page do |page|
print "Fetching closed issues... #{page_i}\r" print "Fetching closed issues... #{page_i}\r"
page_i += PER_PAGE_NUMBER page_i += PER_PAGE_NUMBER
pull_requests.concat(page)
issues.concat(page) issues.concat(page)
end end
@ -381,6 +380,11 @@ module GitHubChangelogGenerator
puts "Received closed issues: #{issues.count}" puts "Received closed issues: #{issues.count}"
end end
if @options[:verbose]
puts "Filtering issues with labels #{@options[:labels]}#{@options[:add_issues_wo_labels] ? ' and w/o labels' : ''}"
end
filtered_issues = issues.select { |issue| filtered_issues = issues.select { |issue|
#compare is there any labels from @options[:labels] array #compare is there any labels from @options[:labels] array
(issue.labels.map { |label| label.name } & @options[:labels]).any? (issue.labels.map { |label| label.name } & @options[:labels]).any?
@ -395,7 +399,7 @@ module GitHubChangelogGenerator
end end
if @options[:verbose] if @options[:verbose]
puts "Filter issues with labels #{@options[:labels]}#{@options[:add_issues_wo_labels] ? ' and w/o labels' : ''}: #{filtered_issues.count} issues" puts "Filtered issues: #{filtered_issues.count}"
end end
filtered_issues filtered_issues