From f8080c0138b864444b6a74d2ae9b2f8d72a1ca17 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Mon, 30 Mar 2015 12:29:48 -0400 Subject: [PATCH] add a spinner for importers --- script/import_scripts/base.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rb index 2e8c8d33365..201117721a9 100644 --- a/script/import_scripts/base.rb +++ b/script/import_scripts/base.rb @@ -644,6 +644,12 @@ class ImportScripts::Base print "\r%9d / %d (%5.1f%%) " % [current, max, ((current.to_f / max.to_f) * 100).round(1)] end + def print_spinner + @spinner_chars ||= %w{ | / - \\ } + @spinner_chars.push @spinner_chars.shift + print "\b#{@spinner_chars[0]}" + end + def batches(batch_size) offset = 0 loop do