add a spinner for importers

This commit is contained in:
Neil Lalonde 2015-03-30 12:29:48 -04:00
parent 910571c45a
commit f8080c0138
1 changed files with 6 additions and 0 deletions

View File

@ -644,6 +644,12 @@ class ImportScripts::Base
print "\r%9d / %d (%5.1f%%) " % [current, max, ((current.to_f / max.to_f) * 100).round(1)] print "\r%9d / %d (%5.1f%%) " % [current, max, ((current.to_f / max.to_f) * 100).round(1)]
end end
def print_spinner
@spinner_chars ||= %w{ | / - \\ }
@spinner_chars.push @spinner_chars.shift
print "\b#{@spinner_chars[0]}"
end
def batches(batch_size) def batches(batch_size)
offset = 0 offset = 0
loop do loop do