Merge pull request #62 from mnaberez/ziprequire_notes

Ziprequire notes
This commit is contained in:
Alexander Simonov 2012-09-01 13:04:42 -07:00
commit c7c4aaba62
2 changed files with 12 additions and 12 deletions

14
NEWS
View File

@ -8,6 +8,10 @@ even though there is actually a comment.
Fixed: "Unitialized constant NullInputStream" error Fixed: "Unitialized constant NullInputStream" error
= Version 0.9.5
Removed support for loading ruby in zip files (ziprequire.rb).
= Version 0.9.4 = Version 0.9.4
Changed ZipOutputStream.put_next_entry signature (API CHANGE!). Now Changed ZipOutputStream.put_next_entry signature (API CHANGE!). Now
@ -103,11 +107,11 @@ Fixed ZipFile.get_output_stream bug.
List of changes: List of changes:
* Ruby 1.8.0 and ruby-zlib 0.6.0 compatibility * Ruby 1.8.0 and ruby-zlib 0.6.0 compatibility
* Changed method names from camelCase to rubys underscore style. * Changed method names from camelCase to rubys underscore style.
* Installs to zip/ subdir instead of directly to site_ruby * Installs to zip/ subdir instead of directly to site_ruby
* Added ZipFile.directory and ZipFile.file - each method return an * Added ZipFile.directory and ZipFile.file - each method return an
object that can be used like Dir and File only for the contents of the object that can be used like Dir and File only for the contents of the
zip file. zip file.
* Added sample application zipfind which works like Find.find, only * Added sample application zipfind which works like Find.find, only
Zip::ZipFind.find traverses into zip archives too. Zip::ZipFind.find traverses into zip archives too.
@ -122,11 +126,11 @@ modules from a zip file, in a fashion similar to jar files in
Java. Added gtkRubyzip, another sample application. Implemented Java. Added gtkRubyzip, another sample application. Implemented
ZipInputStream.lineno and ZipInputStream.rewind ZipInputStream.lineno and ZipInputStream.rewind
Bug fixes: Bug fixes:
* Read and write date and time information correctly for zip entries. * Read and write date and time information correctly for zip entries.
* Fixed read() using separate buffer, causing mix of gets/readline/read to * Fixed read() using separate buffer, causing mix of gets/readline/read to
cause problems. cause problems.
= Version 0.4.2 = Version 0.4.2

View File

@ -22,12 +22,12 @@ gem 'rubyzip'
```ruby ```ruby
require 'rubygems' require 'rubygems'
require 'zip/zip' require 'zip/zip'
folder = "Users/me/Desktop/stuff_to_zip" folder = "Users/me/Desktop/stuff_to_zip"
input_filenames = ['image.jpg', 'description.txt', 'stats.csv'] input_filenames = ['image.jpg', 'description.txt', 'stats.csv']
zipfile_name = "/Users/me/Desktop/archive.zip" zipfile_name = "/Users/me/Desktop/archive.zip"
Zip::ZipFile.open(zipfile_name, Zip::ZipFile::CREATE) do |zipfile| Zip::ZipFile.open(zipfile_name, Zip::ZipFile::CREATE) do |zipfile|
input_filenames.each do |filename| input_filenames.each do |filename|
# Two arguments: # Two arguments:
@ -59,10 +59,6 @@ Zip::ZipFileSystem API. Using this API files can be read from and
written to the archive in much the same manner as ruby's builtin written to the archive in much the same manner as ruby's builtin
classes allows files to be read from and written to the file system. classes allows files to be read from and written to the file system.
rubyzip also features the
zip/ziprequire.rb[link:files/lib/zip/ziprequire_rb.html] module which
allows ruby to load ruby modules from zip archives.
For details about the specific behaviour of classes and methods refer For details about the specific behaviour of classes and methods refer
to the test suite. Finally you can generate the rdoc documentation or to the test suite. Finally you can generate the rdoc documentation or
visit http://rubyzip.sourceforge.net. visit http://rubyzip.sourceforge.net.