From: Austin Ziegler Date: 2004-09-07T11:03:48+09:00 Subject: Re: ruby archiver On Tue, 7 Sep 2004 06:45:28 +0900, Mauricio Fern�ndez wrote: > On Tue, Sep 07, 2004 at 06:26:34AM +0900, Austin Ziegler wrote: > > On Tue, 7 Sep 2004 04:25:10 +0900, Martin DeMello > > wrote: > > > Is there any pure-ruby way to pack multiple files into a single file, > > > and unpack them later? Compression is optional. > > As a matter of fact, you can use either Jamis Buck's tar.rb or my > > forthcoming Archive::Tar::Minitar based on work by Mauricio Fernandez > > (aka batsman). > That code has the nice property of working with IO-like objects and > being able to operate in 'streaming mode' (i.e. no seek/rewind calls), > which means you can compress as you write the tar. > > For instance, in rpa-base, the following is done in one step, with no > intermediate files > > data files, > lots of them =====> tar ====> gzip data.tar.gz > \_____ tar ==> .rpa file > / > metadata =====> gzip metadata.gz > > you add data files to the "inner tar", which outputs to a GZipWriter, > which writes into the outer tar, which is being written to disk. This code is also going to be used in the deployment code for Ruwiki (version forthcoming... I promise), and the only reason that I'm actually making a release is it seemed pretty dumb to be making a RubyGem/RPA release of Ruwiki that then packaged another piece of code that could be set up as an automated dependency. There are other steps that I need to take with the code that may prove generally useful (imagine having a rakefile that can tar the files with the time, date, and permissions that you want -- even if you don't have a 'tar' program handy). If I can ever wrap my head around rake enough, I will end up shifting some packaging code to do this ... but understanding rake isn't something that's working for me right at the moment. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca : as of this email, I have [ 5 ] Gmail invitations