From d5e2a64fd31cab7081b4321ef1850a5253c39a48 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 12 Apr 2010 18:11:32 -0700 Subject: [PATCH] On import/export, hide "parts" of progress (since its simply out of 100) --- lib/vagrant/actions/vm/export.rb | 2 +- lib/vagrant/actions/vm/import.rb | 2 +- lib/vagrant/util/progress_meter.rb | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/vagrant/actions/vm/export.rb b/lib/vagrant/actions/vm/export.rb index 42d04773a..185b06da4 100644 --- a/lib/vagrant/actions/vm/export.rb +++ b/lib/vagrant/actions/vm/export.rb @@ -36,7 +36,7 @@ module Vagrant def export logger.info "Exporting VM to #{ovf_path}..." @runner.vm.export(ovf_path) do |progress| - update_progress(progress, 100) + update_progress(progress, 100, false) end complete_progress diff --git a/lib/vagrant/actions/vm/import.rb b/lib/vagrant/actions/vm/import.rb index ff96fafff..3d3eda02c 100644 --- a/lib/vagrant/actions/vm/import.rb +++ b/lib/vagrant/actions/vm/import.rb @@ -10,7 +10,7 @@ module Vagrant logger.info "Importing base VM (#{@runner.env.box.ovf_file})..." # Use the first argument passed to the action @runner.vm = VirtualBox::VM.import(@runner.env.box.ovf_file) do |progress| - update_progress(progress, 100) + update_progress(progress, 100, false) end complete_progress diff --git a/lib/vagrant/util/progress_meter.rb b/lib/vagrant/util/progress_meter.rb index 5810db641..c15706090 100644 --- a/lib/vagrant/util/progress_meter.rb +++ b/lib/vagrant/util/progress_meter.rb @@ -13,9 +13,10 @@ module Vagrant # # @param [Float] progress Progress # @param [Float] total Total - def update_progress(progress, total) + def update_progress(progress, total, show_parts=true) percent = (progress.to_f / total.to_f) * 100 - print "#{CL_RESET}Progress: #{percent.to_i}% (#{progress} / #{total})" + print "#{CL_RESET}Progress: #{percent.to_i}%" + print " (#{progress} / #{total})" if show_parts $stdout.flush end