Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [ANN] rubyzip-0.5.0

Reply
Thread Tools

[ANN] rubyzip-0.5.0

 
 
Thomas
Guest
Posts: n/a
 
      08-22-2003
Just wanted to let you know that I have released a new version of
rubyzip that works with the latest versions of ruby and ruby-zlib.

There are also some other goodies like bug fixes and a new interface
for accessing and manipulating zip archives based on an API similar to
:ir and ::File using ZipFile::dir and ZipFile::file.


In this release I have also changed the method namimg conventions from
camelCase to ruby_style.

Download: http://sourceforge.net/project/showf...group_id=43107
Home: http://rubyzip.sourceforge.net

Cheers,

Thomas


####### Example of the new :ir,::File inspired Zip api

# Instead of invoking methods on Dir and File you
# simply invoke them on zipFileInstance.dir and zipFileInstance.file

require 'zip/zipfilesystem'

Zip::ZipFile.open("myArchive.zip", Zip::ZipFile::CREATE) {
|zipFile|

zipFile.file.open("file.txt", "w") { |os| os.puts "Stuff 1"
}

zipFile.dir.mkdir "someDir"
zipFile.dir.chdir "someDir"

zipFile.file.open("file.txt", "w") { |os| os.puts "Stuff 2" }
zipFile.file.open("file2.txt", "w") { |os| os.puts "Stuff 3" }

puts "file.txt: #{zipFile.file.read('../file.txt')}"
puts "someDir/file.txt: #{zipFile.file.read('file.txt')}"

puts "\nzip contents:"
puts zipFile.entries.join("\n")

puts "\nCurrent dir entries:"
puts zipFile.dir.entries('.').join("\n")
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments