Prettify log output
This commit is contained in:
parent
7cfb182a82
commit
d0defc4c9b
|
@ -149,10 +149,6 @@ module GitHubChangelogGenerator
|
||||||
pr[:merged_at] = fetched_pr[:merged_at]
|
pr[:merged_at] = fetched_pr[:merged_at]
|
||||||
pull_requests.delete(fetched_pr)
|
pull_requests.delete(fetched_pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if @options[:verbose]
|
|
||||||
puts "Fetching merged dates: Done!"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Include issues with labels, specified in :include_labels
|
# Include issues with labels, specified in :include_labels
|
||||||
|
@ -279,7 +275,7 @@ module GitHubChangelogGenerator
|
||||||
threads.each(&:join)
|
threads.each(&:join)
|
||||||
|
|
||||||
if @options[:verbose]
|
if @options[:verbose]
|
||||||
puts "Fetching tags dates: #{i} Done!"
|
puts "Fetching tags dates: #{i}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -81,15 +81,15 @@ module GitHubChangelogGenerator
|
||||||
count_pages = response.count_pages
|
count_pages = response.count_pages
|
||||||
response.each_page do |page|
|
response.each_page do |page|
|
||||||
page_i += PER_PAGE_NUMBER
|
page_i += PER_PAGE_NUMBER
|
||||||
print "Fetching tags... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\r"
|
print_in_same_line("Fetching tags... #{page_i}/#{count_pages * PER_PAGE_NUMBER}")
|
||||||
tags.concat(page)
|
tags.concat(page)
|
||||||
end
|
end
|
||||||
print " \r"
|
print_empty_line
|
||||||
|
|
||||||
if tags.count == 0
|
if tags.count == 0
|
||||||
@logger.warn "Warning: Can't find any tags in repo.\
|
@logger.warn "Warning: Can't find any tags in repo.\
|
||||||
Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
elsif @options[:verbose]
|
else
|
||||||
@logger.info "Found #{tags.count} tags"
|
@logger.info "Found #{tags.count} tags"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -113,20 +113,17 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
count_pages = response.count_pages
|
count_pages = response.count_pages
|
||||||
response.each_page do |page|
|
response.each_page do |page|
|
||||||
page_i += PER_PAGE_NUMBER
|
page_i += PER_PAGE_NUMBER
|
||||||
print "Fetching issues... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\r"
|
print_in_same_line("Fetching issues... #{page_i}/#{count_pages * PER_PAGE_NUMBER}")
|
||||||
issues.concat(page)
|
issues.concat(page)
|
||||||
break if @options[:max_issues] && issues.length >= @options[:max_issues]
|
break if @options[:max_issues] && issues.length >= @options[:max_issues]
|
||||||
end
|
end
|
||||||
|
print_empty_line
|
||||||
|
@logger.info "Received issues: #{issues.count}"
|
||||||
|
|
||||||
rescue
|
rescue
|
||||||
@logger.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
@logger.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
||||||
end
|
end
|
||||||
|
|
||||||
print " \r"
|
|
||||||
|
|
||||||
if @options[:verbose]
|
|
||||||
@logger.info "Received issues: #{issues.count}"
|
|
||||||
end
|
|
||||||
|
|
||||||
# remove pull request from issues:
|
# remove pull request from issues:
|
||||||
issues.partition do |x|
|
issues.partition do |x|
|
||||||
x[:pull_request].nil?
|
x[:pull_request].nil?
|
||||||
|
@ -140,20 +137,30 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
begin
|
begin
|
||||||
response = @github.pull_requests.list @options[:user], @options[:project], state: "closed"
|
response = @github.pull_requests.list @options[:user], @options[:project], state: "closed"
|
||||||
page_i = 0
|
page_i = 0
|
||||||
|
count_pages = response.count_pages
|
||||||
response.each_page do |page|
|
response.each_page do |page|
|
||||||
page_i += PER_PAGE_NUMBER
|
page_i += PER_PAGE_NUMBER
|
||||||
count_pages = response.count_pages
|
log_string = "Fetching merged dates... #{page_i}/#{count_pages * PER_PAGE_NUMBER}"
|
||||||
print "Fetching merged dates... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\r"
|
print_in_same_line(log_string)
|
||||||
pull_requests.concat(page)
|
pull_requests.concat(page)
|
||||||
end
|
end
|
||||||
|
print_empty_line
|
||||||
rescue
|
rescue
|
||||||
@logger.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
@logger.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
||||||
end
|
end
|
||||||
|
|
||||||
print " \r"
|
@logger.info "Fetching merged dates: #{pull_requests.count}"
|
||||||
pull_requests
|
pull_requests
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def print_in_same_line(log_string)
|
||||||
|
print log_string + "\r"
|
||||||
|
end
|
||||||
|
|
||||||
|
def print_empty_line
|
||||||
|
print_in_same_line(" ")
|
||||||
|
end
|
||||||
|
|
||||||
# Fetch event for all issues and add them to :events
|
# Fetch event for all issues and add them to :events
|
||||||
# @param [Array] issues
|
# @param [Array] issues
|
||||||
# @return [Void]
|
# @return [Void]
|
||||||
|
@ -172,7 +179,7 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
@logger.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
@logger.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
|
||||||
end
|
end
|
||||||
issue[:events] = obj.body
|
issue[:events] = obj.body
|
||||||
print "Fetching events for issues and PR: #{i + 1}/#{issues.count}\r"
|
print_in_same_line("Fetching events for issues and PR: #{i + 1}/#{issues.count}")
|
||||||
i += 1
|
i += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -181,11 +188,9 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
|
||||||
end
|
end
|
||||||
|
|
||||||
# to clear line from prev print
|
# to clear line from prev print
|
||||||
print " \r"
|
print_empty_line
|
||||||
|
|
||||||
if @options[:verbose]
|
@logger.info "Fetching events for issues and PR: #{i}"
|
||||||
@logger.info "Fetching events for issues and PR: #{i} Done!"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Try to find tag date in local hash.
|
# Try to find tag date in local hash.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user