From 57a6de57d60a75749a8345af9807d4abf24b6924 Mon Sep 17 00:00:00 2001 From: Brandon Raabe Date: Fri, 20 Mar 2015 23:44:12 -0700 Subject: new doc formatter event, remove progress bar --- lib/chef/formatters/doc.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/chef/formatters/doc.rb') diff --git a/lib/chef/formatters/doc.rb b/lib/chef/formatters/doc.rb index 489888db8f..7605b93301 100644 --- a/lib/chef/formatters/doc.rb +++ b/lib/chef/formatters/doc.rb @@ -22,6 +22,7 @@ class Chef @failed_audits = 0 @start_time = Time.now @end_time = @start_time + @progress = {} end def elapsed_time @@ -216,6 +217,21 @@ class Chef indent end + def resource_action_progress(resource, current, total, interval) + @progress[resource] ||= 0 + + percent_complete = (current.to_f / total.to_f * 100).to_i + + if percent_complete > @progress[resource] + + @progress[resource] = percent_complete + + if percent_complete % interval == 0 + start_line " - Progress: #{percent_complete}/100 %", :green + end + end + end + # Called when a resource fails, but will retry. def resource_failed_retriable(resource, action, retry_count, exception) end -- cgit v1.2.1