class PhusionPassenger::ProgressBar

def finish

def finish
  @output.write("\n")
  @output.flush
end

def initialize(output = STDOUT)

def initialize(output = STDOUT)
  @output = output
  @tty = output.tty?
  @throbbler_index = 0
end

def set(percentage)

def set(percentage)
  if @tty
    width = (percentage * 50).to_i
    bar   = "*" * width
    space = " " * (50 - width)
    text = sprintf("[%s%s] %s", bar, space, THROBBLER[@throbbler_index])
    @throbbler_index = (@throbbler_index + 1) % THROBBLER.size
    @output.write("#{text}\r")
    @output.flush
  else
    @output.write(".")
    @output.flush
  end
end