[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: question about tar in Ruby

Ghelani, Vidhi

2/17/2005 6:58:00 PM

Hi,

I could not find it . I got to the Ruwiki page and I am lost....can you
tell me where exactly it is?

Thanx,
Vidhi.



-----Original Message-----
From: Austin Ziegler [mailto:halostatue@gmail.com]
Sent: Thursday, February 17, 2005 10:18 AM
To: ruby-talk ML
Subject: Re: question about tar in Ruby

On Fri, 18 Feb 2005 02:44:33 +0900, Ghelani, Vidhi
<vidhi.ghelani@intel.com> wrote:
> I am trying to package a .tar.gz file using ruby. I have packaged a
> .tar file using the same ruby code and it works perfectly fine.
However,
> when I use the same code for a .tar.gz file, it give me an error while
> trying to open it . It says that this is not a tar file. I know I need
> to change something in my ruby code.
>
> There are a few things that I changed i.e. 1) the extension from .tar
to
> .tar.gz
>
> However there is a command at the end of the code which does
>
> Tar -cf #.tar.gz file # a folder which contains the
> install and license and everything to do with this file.
>
> Now I know that I need to change the above code, since this is not a
tar
> file. Does anyone know wot to do ??

Yes. Look at Archive::Tar::Minitar on RubyForge under the Ruwiki
project.

-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca




3 Answers

Austin Ziegler

2/17/2005 7:40:00 PM

0

On Fri, 18 Feb 2005 03:58:23 +0900, Ghelani, Vidhi
<vidhi.ghelani@intel.com> wrote:
> I could not find it . I got to the Ruwiki page and I am lost....can you
> tell me where exactly it is?

http://rubyforge.org/frs/?group_id=84&rele...

-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca


Eko Budi Setiyo

2/18/2005 1:23:00 AM

0

Austin Ziegler wrote:

>On Fri, 18 Feb 2005 03:58:23 +0900, Ghelani, Vidhi
><vidhi.ghelani@intel.com> wrote:
>
>
>>I could not find it . I got to the Ruwiki page and I am lost....can you
>>tell me where exactly it is?
>>
>>
>
>http://rubyforge.org/frs/?group_id=84&rele...
>
>-austin
>
>
May be this one will help (part of rubytoday project)

######################################################
# file name tar.rb
#ussage tar.rb abc
#result abc.tar
#

require 'zlib'
require 'archive/tar/minitar'

include Archive::Tar

file = ARGV[0].to_s

if ARGV[1] != nil
tar = File.open(ARGV[1].to_s,'wb')
Minitar.pack(file,tar)
else
tar = File.open(file+'.tar', 'wb')
Minitar.pack(file,tar)
end

######################################################
#file name zip.tar
#usage zip.rb abc.tar
#result abc.tar.gz
#

require 'zlib'

file = ARGV[0].to_s

local = File.new(file,'rb')

if ARGV[1] == nil
fileTo = file+'.gz'
else
fileTo = ARGV[1].to_s
end

Zlib::GzipWriter.open(fileTo) {|gz|
gz.write(local.read)
gz.close
}

local.close
###############################################
All the code is part of ruby today project (tested with unit test)
If you want more (untar.rb unzip.rb) you can download from
http://www.rub.../download/rub...
All the unit test is included in the rubytoday.zip if you want to play
arrount with it



regards
Eko
http://www.rub...

W.

8/3/2010 4:54:00 PM

0

bondy wrote:
> "W."<sciepa@usenet.net> wrote:
>> bondy wrote:
>>> "McInnes"<mcinnes@virgin.net> wrote:
>>>>
>>>
>>>> Cozto p. KLeczkowski taki uprzejmy? Klamliwa kanalie
>>>> nie wyzwie od "idiotow" - tylko "bez snsu"?
>>>> A uczciwego czlowieka - od "idiotow" wyzywa,
>>>
>>> ROTFL
>>> Doktorze Leszku, prosze przeprosic
>>> "pana" Jozefa. Porucznik Dub byl nieuczciwym Idiota. "Pan" Jozef
>>> jest
>>> uczciwym.
>>>
>>> J.
>>
>> Cos sie tu tak rozsiadl dancigerze?
>> Nie jestes u siebie hitlerowcu.
>
> Alez skad, jestem u siebie. Wszystko co polskie sterowane jest przez
> Zydow, a ja naleleze do ich Egzekutywy (patrz J. Ross).
> No, chyba ze Brooklyn zaczal nalezec do Polski, ale to i tak skupia sie
> do jednego.
>
> Czyli -- Krasucki, spierdalaj.
>
> J.

Jezeli ktos ma kumpla Zalka Blooma, to nie znaczy
ze jest przyjacielem Zydow.
Znaczy to tylko, ze jest tak samo glupi jak jego glupi
przyjaciel.