librelist archives

« back to archive

Download.rb - Shoes 4 and 3.2

Download.rb - Shoes 4 and 3.2

From:
Cecil Coupe
Date:
2014-04-13 @ 06:41
Hi all

   First off, thanks to KCerb for updating the Shoes4 download.rb code. 
I've backported it to Shoes 3.2 and fixed some things that the Shoes4 
folks might want to incorporate. I've attached download.rb and a second 
test (simple-downloader1.rb) that tests the response.status, 
response.headers, and response.body described in the Shoes 3.x manual.  
I'm sure it's not perfect but it's not hateful.

   One thing that might concern us all is that Ruby 2.0.0 is a little 
different that 1.9.3 for open_uri when it reports the content_length.  
The download is the same size but 2.0.0 reports the uncompressed size 
and 1.9.3 reports the inflated size. That screws up the progress bar 
reporting. I'm not sure what to do about that. It doesn't matter all 
that much for small files on a fast connection.

   If nothing else, I've demonstrated how to monkey patch a Shoes native 
C command with a pure Ruby solution. I'll test cross platform and tweak 
it and call it Shoes 3.2b5.

--Cecil

Re: [shoes] Download.rb - Shoes 4 and 3.2

From:
Kc Erb
Date:
2014-04-13 @ 14:59
That's awesome! Strong work!

-KC


On Sun, Apr 13, 2014 at 12:41 AM, Cecil Coupe <ccoupe@cableone.net> wrote:

> Hi all
>
>   First off, thanks to KCerb for updating the Shoes4 download.rb code.
> I've backported it to Shoes 3.2 and fixed some things that the Shoes4 folks
> might want to incorporate. I've attached download.rb and a second test
> (simple-downloader1.rb) that tests the response.status, response.headers,
> and response.body described in the Shoes 3.x manual.  I'm sure it's not
> perfect but it's not hateful.
>
>   One thing that might concern us all is that Ruby 2.0.0 is a little
> different that 1.9.3 for open_uri when it reports the content_length.  The
> download is the same size but 2.0.0 reports the uncompressed size and 1.9.3
> reports the inflated size. That screws up the progress bar reporting. I'm
> not sure what to do about that. It doesn't matter all that much for small
> files on a fast connection.
>
>   If nothing else, I've demonstrated how to monkey patch a Shoes native C
> command with a pure Ruby solution. I'll test cross platform and tweak it
> and call it Shoes 3.2b5.
>
> --Cecil
>



-- 
 "If there is an exception to every rule, then every rule must have at
least one exception; the exception to this one being that it has no
exception."