From c8db84a4a5286218bca8ca9e7ffa48fb5b23e387 Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Wed, 18 Feb 2015 22:29:30 +0200 Subject: [PATCH] prettify output: display tag fetching status --- lib/github_changelog_generator.rb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/github_changelog_generator.rb b/lib/github_changelog_generator.rb index 3739ab4..27c3607 100755 --- a/lib/github_changelog_generator.rb +++ b/lib/github_changelog_generator.rb @@ -192,8 +192,8 @@ module GitHubChangelogGenerator output_filename = "#{@options[:output]}" File.open(output_filename, 'w') { |file| file.write(log) } - - puts "Done! Generated log placed in #{`pwd`.strip!}/#{output_filename}" + puts 'Done!' + puts "Generated log placed in #{`pwd`.strip!}/#{output_filename}" end @@ -201,17 +201,30 @@ module GitHubChangelogGenerator log = '' if @options[:verbose] - puts "Fetching tags dates.." + print "Fetching tags dates..\r" end # Async fetching tags: threads = [] + i = 0 + all = @all_tags.count @all_tags.each { |tag| # 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 } + if @options[:verbose] + puts 'Fetching tags: Done!' + end if @options[:verbose] puts "Sorting tags.." end