Merge branch 'master' into feature/parse-existing-changelog-file

This commit is contained in:
Enrico Stahn 2015-03-27 00:07:30 +11:00
commit 3ca25bfff0

View File

@ -17,7 +17,7 @@ module GitHubChangelogGenerator
PER_PAGE_NUMBER = 30 PER_PAGE_NUMBER = 30
GH_RATE_LIMIT_EXCEEDED_MSG = 'Warning: GitHub API rate limit exceed (5000 per hour), change log may not ' + GH_RATE_LIMIT_EXCEEDED_MSG = 'Warning: GitHub API rate limit exceed (5000 per hour), change log may not ' +
'contain some issues. You can limit the number of issues fetched using the `--max-issues NUM` argument' 'contain some issues. You can limit the number of issues fetched using the `--max-issues NUM` argument'
def initialize def initialize
@ -95,14 +95,10 @@ module GitHubChangelogGenerator
issue[:actual_date] = issue[:closed_at] issue[:actual_date] = issue[:closed_at]
else else
begin begin
begin commit = @github.git_data.commits.get @options[:user], @options[:project], event[:commit_id]
commit = @github.git_data.commits.get @options[:user], @options[:project], event[:commit_id]
rescue
puts GH_RATE_LIMIT_EXCEEDED_MSG.yellow
end
issue[:actual_date] = commit[:author][:date] issue[:actual_date] = commit[:author][:date]
rescue rescue
puts "Warning: can't fetch commit #{event[:commit_id]} probably it referenced from another repo." puts "Warning: can't fetch commit #{event[:commit_id]} probably it referenced from another repo.".yellow
issue[:actual_date] = issue[:closed_at] issue[:actual_date] = issue[:closed_at]
end end
end end
@ -154,7 +150,7 @@ module GitHubChangelogGenerator
self.fetch_merged_at_pull_requests self.fetch_merged_at_pull_requests
filtered_pull_requests = @pull_requests.select {|pr| pr[:merged_at] != nil } filtered_pull_requests = @pull_requests.select { |pr| pr[:merged_at] != nil }
unless @options[:include_labels].nil? unless @options[:include_labels].nil?
filtered_pull_requests = @pull_requests.select { |issue| filtered_pull_requests = @pull_requests.select { |issue|
@ -286,7 +282,7 @@ module GitHubChangelogGenerator
threads.each { |thr| thr.join } threads.each { |thr| thr.join }
if @options[:verbose] if @options[:verbose]
puts 'Fetching tags: Done!' puts "Fetching tags dates: #{i} Done!"
end end
end end
@ -317,6 +313,11 @@ module GitHubChangelogGenerator
if @options[:verbose] if @options[:verbose]
puts "Found #{tags.count} tags" puts "Found #{tags.count} tags"
end end
if tags.count == 0
puts "Warning: Can't find any tags in repo. Make sure, that you push tags to remote repo via 'git push --tags'".yellow
end
rescue rescue
puts GH_RATE_LIMIT_EXCEEDED_MSG.yellow puts GH_RATE_LIMIT_EXCEEDED_MSG.yellow
end end
@ -624,12 +625,7 @@ module GitHubChangelogGenerator
fetch_events_async(@issues + @pull_requests) fetch_events_async(@issues + @pull_requests)
#to clear line from prev print
print " \r"
if @options[:verbose]
puts 'Fetching events for issues and PR: Done!'
end
end end
def fetch_events_async(issues) def fetch_events_async(issues)
@ -652,6 +648,14 @@ module GitHubChangelogGenerator
threads.each { |thr| thr.join } threads.each { |thr| thr.join }
threads = [] threads = []
} }
#to clear line from prev print
print " \r"
if @options[:verbose]
puts "Fetching events for issues and PR: #{i} Done!"
end
end end
end end