prettify output: display tag fetching status

This commit is contained in:
Petr Korolev 2015-02-18 22:29:30 +02:00
parent 563ddb7f30
commit c8db84a4a5

View File

@ -192,8 +192,8 @@ module GitHubChangelogGenerator
output_filename = "#{@options[:output]}" output_filename = "#{@options[:output]}"
File.open(output_filename, 'w') { |file| file.write(log) } File.open(output_filename, 'w') { |file| file.write(log) }
puts 'Done!'
puts "Done! Generated log placed in #{`pwd`.strip!}/#{output_filename}" puts "Generated log placed in #{`pwd`.strip!}/#{output_filename}"
end end
@ -201,17 +201,30 @@ module GitHubChangelogGenerator
log = '' log = ''
if @options[:verbose] if @options[:verbose]
puts "Fetching tags dates.." print "Fetching tags dates..\r"
end end
# Async fetching tags: # Async fetching tags:
threads = [] threads = []
i = 0
all = @all_tags.count
@all_tags.each { |tag| @all_tags.each { |tag|
# explicit set @tag_times_hash to write data safety. # explicit set @tag_times_hash to write data safety.
threads << Thread.new { self.get_time_of_tag(tag, @tag_times_hash) } threads << Thread.new {
self.get_time_of_tag(tag, @tag_times_hash)
if @options[:verbose]
i+=1
print "Fetching tags dates: #{i+1}/#{all}\r"
end
} }
}
threads.each { |thr| thr.join } threads.each { |thr| thr.join }
if @options[:verbose]
puts 'Fetching tags: Done!'
end
if @options[:verbose] if @options[:verbose]
puts "Sorting tags.." puts "Sorting tags.."
end end