[Rubygems-developers] Pull Request #2: progress downloader

Luis Lavena luislavena at gmail.com
Sun Sep 26 22:34:20 EDT 2010


On Sun, Sep 26, 2010 at 11:26 PM, James Tucker <jftucker at gmail.com> wrote:
> spinner = %w[|/-\]
> class << spinner; def next; @s||=0; self[@s]; ensure; @s = @s + 1 == size ? 0 : @s + 1; end
> t = Thread.new do
> while true
>        sleep 0.5
>        $stdout.sync = true
>        ui.print "\r#{spinner.next}"
> end
> end
>
>
> # when done:
> t.kill
>
> seems cheap and portable enough, with a bit more work, would this do?
>
> (sorry for bugs, 5 mins whilst wine'd up)
>

Hehe,

I think the spinner will just spin, it will not give you a feedback of
what is going on.

Having a more progress-like bar/status (heck, even a simple
percentage) will be way more useful.

-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry


More information about the Rubygems-developers mailing list