[Rubygems-developers] progressbar for remote installs

Jim Weirich jim at weirichhouse.org
Fri Oct 8 23:25:29 EDT 2004


Bill Guindon wrote:
> Well, I'm not familiar with the existing UI modules, but a simple
> wrapper would satisfy the CL and the GUI camps.  Add the progress bar
> to fetch, but with a flag.  Old CL stuff still works, new GUI stuff
> can turn it off.
> 
> def fetch( uri_str, gui=false )
>   unless gui
>      progressbar stuff
>   end
> end
> 
> def fetch_gui( uri_str )
>   fetch( uri_str, true )
> end

I don't think it will be hard.  The library core performs all user 
interaction by saying things like ui.say and ui.ask.  All we need to do 
is add a ui.report_progress(percent) method in the relevant modules. 
The console version can do nothing (or do some funky curser 
updating[1]).  The GUI versions can display a graphical progress bar (or 
whatever).

-- 
-- Jim Weirich    jim at weirichhouse.org     http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

[1] If the console version does cursor addressing, or even backspaces, 
please allow an option to turn it off.  That kind of thing looks 
terrible in a emacs shell window.


More information about the Rubygems-developers mailing list