Method: Strobe::CLI::DeployProgress#upload_progress

Defined in:
lib/strobe/cli/deploy_progress.rb

#upload_progress(percentage) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/strobe/cli/deploy_progress.rb', line 10

def upload_progress(percentage)
  width = 50
  left  = ( percentage * width ).round

  return if @current == left

  (@current..left).each do |i|
    arrow = nil
    right = width - i

    if i < width
      right -= 1
      arrow = ">"
    end

    print "Uploading [#{ '=' * i }#{ arrow }#{' ' * right}]\r"
  end

  @current = left
end