Upgraded rubyzip to 0.5.8
This commit is contained in:
parent
ee876a2907
commit
f776807dff
|
@ -1,3 +1,9 @@
|
|||
* TODO:
|
||||
BlueCloth is back (RedCloth didn't do Markdown well enough to replace it).
|
||||
|
||||
* SVN trunk:
|
||||
Handling of line breaks in Textile is as in 0.9 (inserts <br/> tag).
|
||||
Upgraded rubyzip to version 0.5.8
|
||||
* 0.10.0:
|
||||
Ported to ActionPack
|
||||
RedCloth 3.0.3
|
||||
|
|
|
@ -38,7 +38,7 @@ unless defined? ADDITIONAL_LOAD_PATHS
|
|||
vendor/rails/actionwebservice/lib
|
||||
vendor/madeleine-0.7.1/lib
|
||||
vendor/RedCloth-3.0.3/lib
|
||||
vendor/rubyzip-0.5.6
|
||||
vendor/rubyzip-0.5.8/lib
|
||||
).map { |dir| "#{File.expand_path(File.join(RAILS_ROOT, dir))}"
|
||||
}.delete_if { |dir| not File.exist?(dir) }
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ spec = Gem::Specification.new do |s|
|
|||
|
||||
s.add_dependency('madeleine', '= 0.7.1')
|
||||
s.add_dependency('RedCloth', '= 3.0.3')
|
||||
s.add_dependency('rubyzip', '= 0.5.5')
|
||||
s.add_dependency('rubyzip', '= 0.5.8')
|
||||
s.add_dependency('rails', '= 0.11.1')
|
||||
s.requirements << 'none'
|
||||
s.require_path = 'lib'
|
||||
|
|
49
vendor/rubyzip-0.5.6/README
vendored
49
vendor/rubyzip-0.5.6/README
vendored
|
@ -1,49 +0,0 @@
|
|||
= rubyzip
|
||||
|
||||
rubyzip is a ruby library for reading and writing zip (pkzip format)
|
||||
files, with the restriction that only uncompressed and deflated zip
|
||||
entries are supported. All this library does is handling of the zip
|
||||
file format. the actual compression/decompression is handled by
|
||||
zlib. zlib is accessible from ruby thanks to ruby/zlib (see below)
|
||||
|
||||
To run the unit tests you need to have rubyunit or test::unit
|
||||
installed.
|
||||
|
||||
= Install
|
||||
|
||||
ruby install.rb
|
||||
|
||||
|
||||
= Prerequisites
|
||||
|
||||
This library requires ruby/zlib version 0.5.0 or newer. ruby/zlib is
|
||||
included in most recent ruby distributions.
|
||||
|
||||
* zlib http://www.gzip.org/zlib/
|
||||
* ruby-zlib: http://www.blue.sky.or.jp/atelier/ruby/
|
||||
|
||||
|
||||
= Documentation
|
||||
|
||||
The samples/ directory is a good place to start to get a feel for
|
||||
using the library. For details about the specific behaviour of classes
|
||||
and methods refer to the test suite. Finally you can generate the rdoc
|
||||
documentation or visit http://rubyzip.sourceforge.net/doc.
|
||||
|
||||
|
||||
= License
|
||||
|
||||
rubyzip is distributed under the same license as ruby. See
|
||||
http://www.ruby-lang.org/en/LICENSE.txt
|
||||
|
||||
|
||||
= Project Home
|
||||
|
||||
http://rubyzip.sourceforge.net
|
||||
|
||||
|
||||
= Author
|
||||
|
||||
Thomas Sondergaard (thomas at thomassondergaard.com)
|
||||
|
||||
extra-field support contributed by Tatsuki Sugiura (sugi at nemui.org)
|
20
vendor/rubyzip-0.5.6/rubyzip.gemspec
vendored
20
vendor/rubyzip-0.5.6/rubyzip.gemspec
vendored
|
@ -1,20 +0,0 @@
|
|||
$:.unshift '../lib'
|
||||
require 'rubygems'
|
||||
|
||||
spec = Gem::Specification.new do |s|
|
||||
s.name = 'rubyzip'
|
||||
s.version = "0.5.5"
|
||||
s.author = "Thomas Sondergaard"
|
||||
s.email = "thomas(at)thomassondergaard.com"
|
||||
s.homepage = "http://rubyzip.sourceforge.net/"
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.summary = "rubyzip is a ruby module for reading and writing zip files"
|
||||
s.files = Dir.glob("{samples,zip,docs}/**/*").delete_if {|item| item.include?("CVS") || item.include?("rdoc")}
|
||||
s.require_path = '.'
|
||||
s.autorequire = 'zip/zip'
|
||||
end
|
||||
|
||||
if $0==__FILE__
|
||||
Gem::Builder.new(spec).build
|
||||
end
|
||||
|
487
vendor/rubyzip-0.5.6/ChangeLog → vendor/rubyzip-0.5.8/ChangeLog
vendored
Executable file → Normal file
487
vendor/rubyzip-0.5.6/ChangeLog → vendor/rubyzip-0.5.8/ChangeLog
vendored
Executable file → Normal file
|
@ -1,7 +1,132 @@
|
|||
2005-03-17 18:11 thomas
|
||||
|
||||
* NEWS, README, lib/zip/zip.rb: [no log message]
|
||||
|
||||
2005-03-17 18:04 thomas
|
||||
|
||||
* install.rb: Fixed install.rb
|
||||
|
||||
2005-03-03 18:38 thomas
|
||||
|
||||
* Rakefile: [no log message]
|
||||
|
||||
2005-02-27 16:23 thomas
|
||||
|
||||
* lib/zip/ziprequire.rb: Added documentation to ziprequire
|
||||
|
||||
2005-02-27 16:17 thomas
|
||||
|
||||
* README, TODO, lib/zip/ziprequire.rb: Added documentation to
|
||||
ziprequire
|
||||
|
||||
2005-02-27 15:02 thomas
|
||||
|
||||
* Rakefile, test/ziptest.rb: [no log message]
|
||||
|
||||
2005-02-19 21:30 thomas
|
||||
|
||||
* lib/zip/ioextras.rb, lib/zip/stdrubyext.rb,
|
||||
lib/zip/tempfile_bugfixed.rb, lib/zip/zip.rb,
|
||||
lib/zip/ziprequire.rb, test/ioextrastest.rb,
|
||||
test/stdrubyexttest.rb, test/zipfilesystemtest.rb,
|
||||
test/ziprequiretest.rb, test/ziptest.rb: Added more rdoc and
|
||||
changed the remaining tests to Test::Unit
|
||||
|
||||
2005-02-19 20:28 thomas
|
||||
|
||||
* lib/zip/: ioextras.rb, zip.rb: Added documentation to
|
||||
ZipInputStream and ZipOutputStream
|
||||
|
||||
2005-02-18 10:27 thomas
|
||||
|
||||
* README: [no log message]
|
||||
|
||||
2005-02-17 23:21 thomas
|
||||
|
||||
* README, Rakefile: Added ppackage (publish package) task to
|
||||
Rakefile
|
||||
|
||||
2005-02-17 22:49 thomas
|
||||
|
||||
* README, Rakefile, TODO: Added pdoc (publish doc) task to Rakefile
|
||||
|
||||
2005-02-17 21:27 thomas
|
||||
|
||||
* README, Rakefile, TODO, lib/zip/stdrubyext.rb, lib/zip/zip.rb,
|
||||
lib/zip/zipfilesystem.rb: Added a bunch of documentation
|
||||
|
||||
2005-02-17 09:47 thomas
|
||||
|
||||
* test/ziptest.rb: [no log message]
|
||||
|
||||
2005-02-16 20:04 thomas
|
||||
|
||||
* NEWS, README, Rakefile: Improved documentation and added rdoc
|
||||
task to Rakefile
|
||||
|
||||
2005-02-16 19:01 thomas
|
||||
|
||||
* NEWS, Rakefile, lib/zip/zip.rb: [no log message]
|
||||
|
||||
2005-02-16 18:47 thomas
|
||||
|
||||
* Rakefile, samples/example.rb, samples/example_filesystem.rb,
|
||||
samples/gtkRubyzip.rb, samples/write_simple.rb,
|
||||
samples/zipfind.rb, test/.cvsignore, test/gentestfiles.rb:
|
||||
Improvements to Rakefile
|
||||
|
||||
2005-02-15 23:35 thomas
|
||||
|
||||
* NEWS, TODO: [no log message]
|
||||
|
||||
2005-02-15 23:26 thomas
|
||||
|
||||
* Rakefile, rubyzip.gemspec: Now uses Rake to build gem
|
||||
|
||||
2005-02-15 22:52 thomas
|
||||
|
||||
* Rakefile: [no log message]
|
||||
|
||||
2005-02-15 22:39 thomas
|
||||
|
||||
* lib/zip/zip.rb, test/.cvsignore, test/ziptest.rb, NEWS: Fixed
|
||||
compatibility issue with ruby 1.8.2. Migrated test suite to
|
||||
Test::Unit
|
||||
|
||||
2005-02-15 22:10 thomas
|
||||
|
||||
* NEWS, lib/zip/ioextras.rb, lib/zip/stdrubyext.rb,
|
||||
lib/zip/tempfile_bugfixed.rb, lib/zip/zip.rb,
|
||||
lib/zip/zipfilesystem.rb, lib/zip/ziprequire.rb, test/.cvsignore,
|
||||
test/file1.txt, test/file1.txt.deflatedData, test/file2.txt,
|
||||
test/gentestfiles.rb, test/ioextrastest.rb,
|
||||
test/notzippedruby.rb, test/rubycode.zip, test/rubycode2.zip,
|
||||
test/stdrubyexttest.rb, test/testDirectory.bin,
|
||||
test/zipWithDirs.zip, test/zipfilesystemtest.rb,
|
||||
test/ziprequiretest.rb, test/ziptest.rb, test/data/.cvsignore,
|
||||
test/data/file1.txt, test/data/file1.txt.deflatedData,
|
||||
test/data/file2.txt, test/data/notzippedruby.rb,
|
||||
test/data/rubycode.zip, test/data/rubycode2.zip,
|
||||
test/data/testDirectory.bin, test/data/zipWithDirs.zip: Changed
|
||||
directory structure
|
||||
|
||||
2005-02-13 22:44 thomas
|
||||
|
||||
* Rakefile, TODO: [no log message]
|
||||
|
||||
2005-02-13 22:38 thomas
|
||||
|
||||
* rubyzip.gemspec: [no log message]
|
||||
|
||||
2005-02-13 21:53 thomas
|
||||
|
||||
* install.rb: Made install.rb independent of the current path
|
||||
(fixes bug reported by Drew Robinson)
|
||||
|
||||
2004-12-12 11:22 thomas
|
||||
|
||||
* NEWS, TODO, samples/write_simple.rb, zip/zip.rb: Fixed 'version
|
||||
needed to extract'-field wrong in local headers
|
||||
* NEWS, TODO, samples/write_simple.rb: Fixed 'version needed to
|
||||
extract'-field wrong in local headers
|
||||
|
||||
2004-05-02 15:17 thomas
|
||||
|
||||
|
@ -9,68 +134,65 @@
|
|||
|
||||
2004-04-02 07:25 thomas
|
||||
|
||||
* NEWS, zip/zip.rb: Fix for FreeBSD 4.9
|
||||
* NEWS: Fix for FreeBSD 4.9
|
||||
|
||||
2004-03-28 15:23 thomas
|
||||
2004-03-29 00:28 thomas
|
||||
|
||||
* zip/zip.rb: Use RUBY_VERSION not VERSION constant
|
||||
* NEWS: [no log message]
|
||||
|
||||
2004-03-28 14:51 thomas
|
||||
2004-03-28 17:59 thomas
|
||||
|
||||
* zip/zip.rb: Only use bugfixed Tempfile implementation if the ruby
|
||||
version hasnt been fixed (contributed by Nobu Nakada)
|
||||
|
||||
2004-03-28 14:46 thomas
|
||||
|
||||
* zip/tempfile_bugfixed.rb: Compatibility with DelegateClass in
|
||||
ruby version 1.8.1 and newer
|
||||
* NEWS: [no log message]
|
||||
|
||||
2004-03-27 16:09 thomas
|
||||
|
||||
* test/stdrubyexttest.rb, zip/stdrubyext.rb: Patch for
|
||||
stdrubyext.rb from Nobu Nakada
|
||||
* test/stdrubyexttest.rb: Patch for stdrubyext.rb from Nobu Nakada
|
||||
|
||||
2004-03-27 15:30 thomas
|
||||
|
||||
* test/ioextrastest.rb, test/stdrubyexttest.rb, zip/ioextras.rb:
|
||||
converted some files to unix line-endings
|
||||
* test/: ioextrastest.rb, stdrubyexttest.rb: converted some files
|
||||
to unix line-endings
|
||||
|
||||
2004-03-25 16:34 thomas
|
||||
|
||||
* NEWS, install.rb, zip/tempfile_bugfixed.rb, zip/zip.rb:
|
||||
Significantly reduced memory footprint when modifying zip files
|
||||
* NEWS, install.rb: Significantly reduced memory footprint when
|
||||
modifying zip files
|
||||
|
||||
2004-03-16 18:20 thomas
|
||||
|
||||
* install.rb, test/alltests.rb, test/ioextrastest.rb,
|
||||
test/stdrubyexttest.rb, test/ziptest.rb, zip/ioextras.rb,
|
||||
zip/zip.rb: IO utility classes moved to new file ioextras.rb.
|
||||
Tests moved to new file ioextrastest.rb
|
||||
test/stdrubyexttest.rb, test/ziptest.rb: IO utility classes moved
|
||||
to new file ioextras.rb. Tests moved to new file ioextrastest.rb
|
||||
|
||||
2004-02-27 13:21 thomas
|
||||
|
||||
* NEWS, zip/zip.rb: Optimization to avoid decompression and
|
||||
recompression
|
||||
* NEWS: Optimization to avoid decompression and recompression
|
||||
|
||||
2004-01-30 16:17 thomas
|
||||
|
||||
* NEWS: [no log message]
|
||||
|
||||
2004-01-30 16:07 thomas
|
||||
|
||||
* README, test/zipfilesystemtest.rb, test/ziptest.rb,
|
||||
zip/stdrubyext.rb, zip/zip.rb, zip/zipfilesystem.rb: Applied
|
||||
* README, test/zipfilesystemtest.rb, test/ziptest.rb: Applied
|
||||
extra-field patch
|
||||
|
||||
2003-12-13 16:57 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2003-12-10 00:25 thomas
|
||||
|
||||
* test/ziptest.rb: (Temporary) fix to bug reported by Takashi Sano
|
||||
|
||||
2003-10-03 11:05 thomas
|
||||
|
||||
* zip/: stdrubyext.rb, zip.rb: Thanks to Clifford Heath for
|
||||
noticing that Time.to_binary_dos_date and time were reversed
|
||||
|
||||
2003-08-23 09:42 thomas
|
||||
|
||||
* test/ziptest.rb, zip/zip.rb, NEWS: Fixed ZipFile.get_ouput_stream
|
||||
bug - data was never written to zip
|
||||
* test/ziptest.rb, NEWS: Fixed ZipFile.get_ouput_stream bug - data
|
||||
was never written to zip
|
||||
|
||||
2003-08-21 16:05 thomas
|
||||
|
||||
* install.rb: [no log message]
|
||||
|
||||
2003-08-21 16:01 thomas
|
||||
|
||||
|
@ -86,10 +208,12 @@
|
|||
zipfilesystem.rb, zipfilesystemtest.rb, ziprequire.rb,
|
||||
ziprequiretest.rb, ziptest.rb, samples/example.rb,
|
||||
samples/example_filesystem.rb, samples/gtkRubyzip.rb,
|
||||
samples/zipfind.rb, zip/stdrubyext.rb, zip/zip.rb,
|
||||
zip/zipfilesystem.rb, zip/ziprequire.rb: Moved all production
|
||||
source files to zip/ so they are in the same dir as when they are
|
||||
installed
|
||||
samples/zipfind.rb: Moved all production source files to zip/ so
|
||||
they are in the same dir as when they are installed
|
||||
|
||||
2003-08-21 15:31 thomas
|
||||
|
||||
* NEWS, TODO, alltests.rb: [no log message]
|
||||
|
||||
2003-08-21 15:26 thomas
|
||||
|
||||
|
@ -108,6 +232,10 @@
|
|||
* zip.rb, ziptest.rb: Fixed mkdir bug. ZipFile.mkdir didn't work if
|
||||
the zipfile doesn't exist already
|
||||
|
||||
2003-08-21 15:05 thomas
|
||||
|
||||
* ziptest.rb: [no log message]
|
||||
|
||||
2003-08-21 14:53 thomas
|
||||
|
||||
* TODO, zipfilesystemtest.rb: Globbing test placeholder commented
|
||||
|
@ -123,12 +251,28 @@
|
|||
* zipfilesystem.rb, zipfilesystemtest.rb: Implemented DirFsIterator
|
||||
and tests
|
||||
|
||||
2003-08-20 22:50 thomas
|
||||
|
||||
* NEWS, TODO: [no log message]
|
||||
|
||||
2003-08-20 22:45 thomas
|
||||
|
||||
* zipfilesystemtest.rb: [no log message]
|
||||
|
||||
2003-08-20 22:44 thomas
|
||||
|
||||
* zipfilesystem.rb, zipfilesystemtest.rb: Implemented
|
||||
ZipFsDir.foreach, ZipFsDir.entries now reimplemented in terms of
|
||||
it
|
||||
|
||||
2003-08-20 22:25 thomas
|
||||
|
||||
* README: [no log message]
|
||||
|
||||
2003-08-20 18:08 thomas
|
||||
|
||||
* zipfilesystem.rb, zipfilesystemtest.rb: [no log message]
|
||||
|
||||
2003-08-20 17:30 thomas
|
||||
|
||||
* zipfilesystem.rb: All access from ZipFsFile and ZipFsDir to
|
||||
|
@ -205,6 +349,10 @@
|
|||
* simpledist.rb: Moved simpledist to a separate repository called
|
||||
'misc'
|
||||
|
||||
2003-08-13 16:31 thomas
|
||||
|
||||
* NEWS: [no log message]
|
||||
|
||||
2003-08-13 16:29 thomas
|
||||
|
||||
* stdrubyext.rb, zip.rb, zipfilesystem.rb, zipfilesystemtest.rb,
|
||||
|
@ -274,6 +422,22 @@
|
|||
|
||||
* NEWS, zip.rb: ruby-zlib 0.6.0 compatibility fix
|
||||
|
||||
2002-12-22 20:12 thomas
|
||||
|
||||
* zip.rb: [no log message]
|
||||
|
||||
2002-09-16 22:11 thomas
|
||||
|
||||
* NEWS: [no log message]
|
||||
|
||||
2002-09-15 17:16 thomas
|
||||
|
||||
* samples/zipfind.rb: [no log message]
|
||||
|
||||
2002-09-15 00:02 thomas
|
||||
|
||||
* samples/zipfind.rb: [no log message]
|
||||
|
||||
2002-09-14 22:59 thomas
|
||||
|
||||
* samples/zipfind.rb: Added simple zipfind script
|
||||
|
@ -296,11 +460,19 @@
|
|||
|
||||
* zipfilesystemtest.rb: Improved ZipFsFile.delete/unlink test
|
||||
|
||||
2002-09-12 00:12 thomas
|
||||
|
||||
* test/.cvsignore: [no log message]
|
||||
|
||||
2002-09-12 00:10 thomas
|
||||
|
||||
* zipfilesystem.rb, zipfilesystemtest.rb: Implemented
|
||||
ZipFsFile.delete/unlink
|
||||
|
||||
2002-09-11 22:22 thomas
|
||||
|
||||
* alltests.rb: [no log message]
|
||||
|
||||
2002-09-11 22:18 thomas
|
||||
|
||||
* NEWS, zip.rb, zipfilesystem.rb, zipfilesystemtest.rb: Fixed
|
||||
|
@ -317,12 +489,20 @@
|
|||
|
||||
* NEWS: Updated NEWS file
|
||||
|
||||
2002-09-10 23:26 thomas
|
||||
|
||||
* zip.rb: [no log message]
|
||||
|
||||
2002-09-10 22:39 thomas
|
||||
|
||||
* NEWS, zip.rb, ziptest.rb: Fix bug: rewind should reset lineno.
|
||||
Fix bug: Deflater.read uses separate buffer from produceInput
|
||||
(feeding gets/readline etc)
|
||||
|
||||
2002-09-09 23:48 thomas
|
||||
|
||||
* .cvsignore: [no log message]
|
||||
|
||||
2002-09-09 22:55 uid26649
|
||||
|
||||
* zip.rb, ziptest.rb: Implemented ZipInputStream.rewind and
|
||||
|
@ -334,6 +514,10 @@
|
|||
AbstractInputStream and AbstractOutputStream now lie about being
|
||||
kind_of?(IO)
|
||||
|
||||
2002-09-08 16:38 thomas
|
||||
|
||||
* zipfilesystemtest.rb: [no log message]
|
||||
|
||||
2002-09-08 16:07 thomas
|
||||
|
||||
* filearchive.rb, filearchivetest.rb, zip.rb, ziptest.rb: Moved
|
||||
|
@ -451,6 +635,10 @@
|
|||
zipfilesystem.rb, zipfilesystemtest.rb, ziprequire.rb,
|
||||
ziptest.rb: Implemented ZipFileSystem::ZipFsFile.size
|
||||
|
||||
2002-07-26 16:41 thomas
|
||||
|
||||
* zipfilesystem.rb, zipfilesystemtest.rb: [no log message]
|
||||
|
||||
2002-07-26 16:40 thomas
|
||||
|
||||
* test/zipWithDirs.zip: Changed zipWithDirs.zip so all the entries
|
||||
|
@ -466,6 +654,18 @@
|
|||
* test/zipWithDirs.zip: Added a zip file for testing with a
|
||||
directory structure
|
||||
|
||||
2002-07-22 21:40 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-07-22 17:49 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-07-21 18:20 thomas
|
||||
|
||||
* NEWS: [no log message]
|
||||
|
||||
2002-07-21 18:12 thomas
|
||||
|
||||
* TODO: Updated TODO with a refactoring idea for FileArchive
|
||||
|
@ -493,10 +693,22 @@
|
|||
code for creating test files for FileArchive.add tests. Added
|
||||
fileutils.rb, which is borrowed from ruby 1.7.2
|
||||
|
||||
2002-07-20 16:07 thomas
|
||||
|
||||
* filearchive.rb, filearchivetest.rb: [no log message]
|
||||
|
||||
2002-07-20 16:05 thomas
|
||||
|
||||
* filearchivetest.rb: Added tests for String extensions
|
||||
|
||||
2002-07-20 02:20 thomas
|
||||
|
||||
* alltests.rb, ziprequiretest.rb, ziptest.rb: [no log message]
|
||||
|
||||
2002-07-20 00:42 thomas
|
||||
|
||||
* install.rb: [no log message]
|
||||
|
||||
2002-07-20 00:42 thomas
|
||||
|
||||
* TODO: Updated TODO
|
||||
|
@ -506,10 +718,43 @@
|
|||
* filearchive.rb, filearchivetest.rb: All FileArchive.extract tests
|
||||
run
|
||||
|
||||
2002-07-19 23:11 thomas
|
||||
|
||||
* filearchive.rb, filearchivetest.rb: [no log message]
|
||||
|
||||
2002-07-19 19:41 thomas
|
||||
|
||||
* filearchivetest.rb: [no log message]
|
||||
|
||||
2002-07-19 19:06 thomas
|
||||
|
||||
* filearchive.rb, filearchivetest.rb: [no log message]
|
||||
|
||||
2002-07-19 18:48 thomas
|
||||
|
||||
* filearchive.rb, filearchivetest.rb, zip.rb: [no log message]
|
||||
|
||||
2002-07-08 13:41 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-06-11 19:47 thomas
|
||||
|
||||
* filearchive.rb, filearchivetest.rb, zip.rb, ziptest.rb: [no log
|
||||
message]
|
||||
|
||||
2002-05-25 00:41 thomas
|
||||
|
||||
* simpledist.rb: Added hackish script for creating dist files
|
||||
|
||||
2002-04-30 21:22 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-04-30 21:16 thomas
|
||||
|
||||
* filearchive.rb, filearchivetest.rb: [no log message]
|
||||
|
||||
2002-04-30 20:40 thomas
|
||||
|
||||
* filearchive.rb, filearchivetest.rb: Improved testing and wrote
|
||||
|
@ -564,6 +809,10 @@
|
|||
a 'glob pattern' given a list of files - Next step is to use this
|
||||
module in ZipFile
|
||||
|
||||
2002-04-01 22:55 thomas
|
||||
|
||||
* NEWS: [no log message]
|
||||
|
||||
2002-04-01 21:16 thomas
|
||||
|
||||
* TODO, zip.rb, ziprequire.rb: Added ziprequire.rb which contains a
|
||||
|
@ -571,17 +820,33 @@
|
|||
can load ruby modules from a zip file. Needs unit tests and
|
||||
polish.
|
||||
|
||||
2002-03-31 01:13 thomas
|
||||
|
||||
* README: [no log message]
|
||||
|
||||
2002-03-30 16:14 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-03-30 01:52 thomas
|
||||
|
||||
* .cvsignore, README, zip.rb: Added rdoc markup (only #:nodoc:all
|
||||
modifiers) to zip.rb. Made README 'RDoc compliant'
|
||||
|
||||
2002-03-29 23:29 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-03-29 23:26 thomas
|
||||
|
||||
* example.rb, samples/.cvsignore, samples/example.rb,
|
||||
samples/gtkRubyzip.rb: Moved example.rb to samples/. Added
|
||||
another sample gtkRubyzip.rb
|
||||
|
||||
2002-03-29 20:12 thomas
|
||||
|
||||
* NEWS, TODO: [no log message]
|
||||
|
||||
2002-03-29 20:06 thomas
|
||||
|
||||
* .cvsignore, file1.txt, file1.txt.deflatedData, testDirectory.bin,
|
||||
|
@ -591,6 +856,10 @@
|
|||
manually created test data files into it. Changed ziptest.rb so
|
||||
it runs in test/ directory
|
||||
|
||||
2002-03-29 19:43 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-03-29 18:15 thomas
|
||||
|
||||
* NEWS, zip.rb, ziptest.rb: Don't decompress and recompress zip
|
||||
|
@ -601,6 +870,22 @@
|
|||
* zip.rb: Performance optimization: Only write new ZipFile, if it
|
||||
has been changed. The test suite runs in half the time now.
|
||||
|
||||
2002-03-28 22:12 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-03-23 17:31 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-03-22 22:47 thomas
|
||||
|
||||
* NEWS: [no log message]
|
||||
|
||||
2002-03-22 22:25 thomas
|
||||
|
||||
* NEWS, TODO: [no log message]
|
||||
|
||||
2002-03-22 22:18 thomas
|
||||
|
||||
* ziptest.rb: Found the tests that didn't use blocks to make sure
|
||||
|
@ -627,10 +912,22 @@
|
|||
the remainder of the line including the pipe character and the
|
||||
following zip -z 4 entry.zip command
|
||||
|
||||
2002-03-21 22:18 thomas
|
||||
|
||||
* NEWS: [no log message]
|
||||
|
||||
2002-03-21 22:12 thomas
|
||||
|
||||
* NEWS, README, TODO, install.rb: Added install.rb
|
||||
|
||||
2002-03-21 21:45 thomas
|
||||
|
||||
* ziptest.rb: [no log message]
|
||||
|
||||
2002-03-21 20:54 thomas
|
||||
|
||||
* NEWS, TODO: [no log message]
|
||||
|
||||
2002-03-21 20:34 thomas
|
||||
|
||||
* .cvsignore, TODO, zip.rb, ziptest.rb: Added
|
||||
|
@ -641,6 +938,10 @@
|
|||
* zip.rb, ziptest.rb: Extraction of directory entries is now
|
||||
supported
|
||||
|
||||
2002-03-20 21:59 thomas
|
||||
|
||||
* NEWS: [no log message]
|
||||
|
||||
2002-03-20 21:24 thomas
|
||||
|
||||
* COPYING, README, README.txt: Removed COPYING, renamed README.txt
|
||||
|
@ -651,6 +952,10 @@
|
|||
* example.rb: Fixed example.rb added example that shows zip file
|
||||
manipulation with Zip::ZipFile
|
||||
|
||||
2002-03-20 21:00 thomas
|
||||
|
||||
* .cvsignore: [no log message]
|
||||
|
||||
2002-03-20 20:56 thomas
|
||||
|
||||
* TODO, zip.rb, ziptest.rb: Directories can now be added (not
|
||||
|
@ -669,6 +974,10 @@
|
|||
* zip.rb, ziptest.rb: ZipError is now a subclass of StandardError
|
||||
instead of RuntimeError. ZipError now has several subclasses.
|
||||
|
||||
2002-03-19 22:26 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-03-19 22:19 thomas
|
||||
|
||||
* TODO, ziptest.rb: Unit test ZipFile.getInputStream with block
|
||||
|
@ -683,11 +992,19 @@
|
|||
* TODO, zip.rb, ziptest.rb: Added unit tests for rename to existing
|
||||
entry
|
||||
|
||||
2002-03-19 20:42 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-03-19 20:40 thomas
|
||||
|
||||
* TODO, zip.rb, ziptest.rb: Unit test calling ZipFile.extract with
|
||||
block
|
||||
|
||||
2002-03-18 21:06 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-03-18 21:05 thomas
|
||||
|
||||
* zip.rb, ziptest.rb: ZipFile#commit now reinitializes ZipFile.
|
||||
|
@ -704,6 +1021,10 @@
|
|||
|
||||
* zip.rb: Removed method that was never called
|
||||
|
||||
2002-03-17 22:33 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-03-17 22:25 thomas
|
||||
|
||||
* ziptest.rb: Run tests with =true as default
|
||||
|
@ -713,25 +1034,69 @@
|
|||
* NEWS, TODO, zip.rb, ziptest.rb: Now runs with -w switch without
|
||||
warnings
|
||||
|
||||
2002-03-17 21:10 thomas
|
||||
|
||||
* .cvsignore: [no log message]
|
||||
|
||||
2002-03-17 21:04 thomas
|
||||
|
||||
* zip.rb, ziptest.rb: Down to one failing test
|
||||
|
||||
2002-03-17 20:36 thomas
|
||||
|
||||
* zip.rb, ziptest.rb: [no log message]
|
||||
|
||||
2002-03-17 17:22 thomas
|
||||
|
||||
* TODO, zip.rb, ziptest.rb: [no log message]
|
||||
|
||||
2002-02-25 19:42 thomas
|
||||
|
||||
* TODO: Added more todos
|
||||
|
||||
2002-02-23 15:51 thomas
|
||||
|
||||
* zip.rb: [no log message]
|
||||
|
||||
2002-02-23 15:30 thomas
|
||||
|
||||
* zip.rb, ziptest.rb: [no log message]
|
||||
|
||||
2002-02-23 14:16 thomas
|
||||
|
||||
* zip.rb, ziptest.rb: [no log message]
|
||||
|
||||
2002-02-03 18:47 thomas
|
||||
|
||||
* ziptest.rb: [no log message]
|
||||
|
||||
2002-02-02 15:58 thomas
|
||||
|
||||
* example.rb, zip.rb, ziptest.rb: [no log message]
|
||||
|
||||
2002-02-02 00:16 thomas
|
||||
|
||||
* .cvsignore: [no log message]
|
||||
|
||||
2002-02-02 00:14 thomas
|
||||
|
||||
* example.rb, zip.rb, ziptest.rb: Renamed SimpleZipFile to
|
||||
BasicZipFile
|
||||
|
||||
2002-02-02 00:09 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-02-02 00:01 thomas
|
||||
|
||||
* ziptest.rb: More test cases - all of them failing, so now there
|
||||
are 18 failing test cases. Three more test cases to implement,
|
||||
then it is time for the production code
|
||||
|
||||
2002-02-01 21:49 thomas
|
||||
|
||||
* ziptest.rb: [no log message]
|
||||
|
||||
2002-02-01 21:34 thomas
|
||||
|
||||
* ziptest.rb: Also run SimpleZipFile tests for ZipFile.
|
||||
|
@ -742,6 +1107,14 @@
|
|||
The new ZipFile will have many more methods that are useful for
|
||||
managing archives.
|
||||
|
||||
2002-01-29 20:30 thomas
|
||||
|
||||
* TODO: [no log message]
|
||||
|
||||
2002-01-26 00:18 thomas
|
||||
|
||||
* NEWS: [no log message]
|
||||
|
||||
2002-01-26 00:14 thomas
|
||||
|
||||
* ziptest.rb: In unit test: work around ruby/cygwin weirdness. You
|
||||
|
@ -753,20 +1126,44 @@
|
|||
* ziptest.rb: Fixed test that failed on windows because of CRLF
|
||||
line ending
|
||||
|
||||
2002-01-25 23:58 thomas
|
||||
|
||||
* ziptest.rb: [no log message]
|
||||
|
||||
2002-01-25 23:29 thomas
|
||||
|
||||
* .cvsignore, example.rb, zip.rb: Fixed bug reading from empty
|
||||
deflated entry in zip file
|
||||
|
||||
2002-01-25 23:01 thomas
|
||||
|
||||
* .cvsignore: [no log message]
|
||||
|
||||
2002-01-25 22:56 thomas
|
||||
|
||||
* ziptest.rb: [no log message]
|
||||
|
||||
2002-01-25 22:51 thomas
|
||||
|
||||
* NEWS, README.txt, zip.rb, ziptest.rb: Zip write support is now
|
||||
fully functional in the form of ZipOutputStream.
|
||||
|
||||
2002-01-25 21:12 thomas
|
||||
|
||||
* zip.rb, ziptest.rb: [no log message]
|
||||
|
||||
2002-01-25 20:37 thomas
|
||||
|
||||
* zip.rb, ziptest.rb: [no log message]
|
||||
|
||||
2002-01-20 16:00 thomas
|
||||
|
||||
* zip.rb, ziptest.rb: Added Deflater and DeflaterTest.
|
||||
|
||||
2002-01-20 00:39 thomas
|
||||
|
||||
* .cvsignore: [no log message]
|
||||
|
||||
2002-01-20 00:23 thomas
|
||||
|
||||
* .cvsignore: Added .cvsignore file
|
||||
|
@ -797,6 +1194,10 @@
|
|||
|
||||
* README.txt: License now same as rubys, not just GPL
|
||||
|
||||
2002-01-06 00:19 thomas
|
||||
|
||||
* README.txt: [no log message]
|
||||
|
||||
2002-01-05 23:09 thomas
|
||||
|
||||
* NEWS, README.txt: Updated NEWS file
|
||||
|
@ -818,6 +1219,18 @@
|
|||
* zip.rb: Changed references to Inflate to Zlib::inflate for
|
||||
compatibility with ruby-zlib-0.5
|
||||
|
||||
2002-01-05 19:28 thomas
|
||||
|
||||
* README.txt, zip.rb, ziptest.rb: [no log message]
|
||||
|
||||
2002-01-05 01:52 thomas
|
||||
|
||||
* example.rb, NEWS: [no log message]
|
||||
|
||||
2002-01-05 01:37 thomas
|
||||
|
||||
* COPYING, README.txt: [no log message]
|
||||
|
||||
2002-01-05 01:31 thomas
|
||||
|
||||
* ziptest.rb: Fixed problem with test file creation
|
41
vendor/rubyzip-0.5.6/NEWS → vendor/rubyzip-0.5.8/NEWS
vendored
Executable file → Normal file
41
vendor/rubyzip-0.5.6/NEWS → vendor/rubyzip-0.5.8/NEWS
vendored
Executable file → Normal file
|
@ -1,32 +1,43 @@
|
|||
= Version 0.5.6 =
|
||||
= Version 0.5.8
|
||||
|
||||
Fixed install script.
|
||||
|
||||
= Version 0.5.7
|
||||
|
||||
install.rb no longer assumes it is being run from the toplevel source
|
||||
dir. Directory structure changed to reflect common ruby library
|
||||
project structure. Migrated from RubyUnit to Test::Unit format. Now
|
||||
uses Rake to build source packages and gems and run unit tests.
|
||||
|
||||
= Version 0.5.6
|
||||
|
||||
Fix for FreeBSD 4.9 which returns Errno::EFBIG instead of
|
||||
Errno::EINVAL for some invalid seeks. Fixed 'version needed to
|
||||
extract'-field incorrect in local headers.
|
||||
|
||||
= Version 0.5.5 =
|
||||
= Version 0.5.5
|
||||
|
||||
Fix for a problem with writing zip files that concerns only ruby 1.8.1.
|
||||
|
||||
= Version 0.5.4 =
|
||||
= Version 0.5.4
|
||||
|
||||
Significantly reduced memory footprint when modifying zip files.
|
||||
|
||||
= Version 0.5.3 =
|
||||
= Version 0.5.3
|
||||
|
||||
Added optimization to avoid decompressing and recompressing individual
|
||||
entries when modifying a zip archive.
|
||||
|
||||
= Version 0.5.2 =
|
||||
= Version 0.5.2
|
||||
|
||||
Fixed ZipFile corruption bug in ZipFile class. Added basic unix
|
||||
extra-field support.
|
||||
|
||||
= Version 0.5.1 =
|
||||
= Version 0.5.1
|
||||
|
||||
Fixed ZipFile.get_output_stream bug.
|
||||
|
||||
= Version 0.5.0 =
|
||||
= Version 0.5.0
|
||||
|
||||
List of changes:
|
||||
* Ruby 1.8.0 and ruby-zlib 0.6.0 compatibility
|
||||
|
@ -42,7 +53,7 @@ Bug fixes:
|
|||
* AbstractInputStream.each_line with non-default separator
|
||||
|
||||
|
||||
= Version 0.5.0a =
|
||||
= Version 0.5.0a
|
||||
|
||||
Source reorganized. Added ziprequire, which can be used to load ruby
|
||||
modules from a zip file, in a fashion similar to jar files in
|
||||
|
@ -55,15 +66,15 @@ Bug fixes:
|
|||
* Fixed read() using separate buffer, causing mix of gets/readline/read to
|
||||
cause problems.
|
||||
|
||||
= Version 0.4.2 =
|
||||
= Version 0.4.2
|
||||
|
||||
Performance optimizations. Test suite runs in half the time.
|
||||
|
||||
= Version 0.4.1 =
|
||||
= Version 0.4.1
|
||||
|
||||
Windows compatibility fixes.
|
||||
|
||||
= Version 0.4.0 =
|
||||
= Version 0.4.0
|
||||
|
||||
Zip::ZipFile is now mutable and provides a more convenient way of
|
||||
modifying zip archives than Zip::ZipOutputStream. Operations for
|
||||
|
@ -75,18 +86,18 @@ Runs without warnings with -w switch.
|
|||
Install script install.rb added.
|
||||
|
||||
|
||||
= Version 0.3.1 =
|
||||
= Version 0.3.1
|
||||
|
||||
Rudimentary support for writing zip archives.
|
||||
|
||||
|
||||
= Version 0.2.2 =
|
||||
= Version 0.2.2
|
||||
|
||||
Fixed and extended unit test suite. Updated to work with ruby/zlib
|
||||
0.5. It doesn't work with earlier versions of ruby/zlib.
|
||||
|
||||
|
||||
= Version 0.2.0 =
|
||||
= Version 0.2.0
|
||||
|
||||
Class ZipFile added. Where ZipInputStream is used to read the
|
||||
individual entries in a zip file, ZipFile reads the central directory
|
||||
|
@ -94,6 +105,6 @@ in the zip archive, so you can get to any entry in the zip archive
|
|||
without having to skipping through all the preceeding entries.
|
||||
|
||||
|
||||
= Version 0.1.0 =
|
||||
= Version 0.1.0
|
||||
|
||||
First working version of ZipInputStream.
|
70
vendor/rubyzip-0.5.8/README
vendored
Normal file
70
vendor/rubyzip-0.5.8/README
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
= rubyzip
|
||||
|
||||
rubyzip is a ruby library for reading and writing zip files.
|
||||
|
||||
= Install
|
||||
|
||||
If you have rubygems you can install rubyzip directly from the gem
|
||||
repository
|
||||
|
||||
gem install rubyzip
|
||||
|
||||
Otherwise obtain the source (see below) and run
|
||||
|
||||
ruby install.rb
|
||||
|
||||
To run the unit tests you need to have test::unit installed
|
||||
|
||||
rake test
|
||||
|
||||
|
||||
= Documentation
|
||||
|
||||
There is more than one way to access or create a zip archive with
|
||||
rubyzip. The basic API is modeled after the classes in
|
||||
java.util.zip from the Java SDK. This means there are classes such
|
||||
as Zip::ZipInputStream, Zip::ZipOutputStream and
|
||||
Zip::ZipFile. Zip::ZipInputStream provides a basic interface for
|
||||
iterating through the entries in a zip archive and reading from the
|
||||
entries in the same way as from a regular File or IO
|
||||
object. ZipOutputStream is the corresponding basic output
|
||||
facility. Zip::ZipFile provides a mean for accessing the archives
|
||||
central directory and provides means for accessing any entry without
|
||||
having to iterate through the archive. Unlike Java's
|
||||
java.util.zip.ZipFile rubyzip's Zip::ZipFile is mutable, which means
|
||||
it can be used to change zip files as well.
|
||||
|
||||
Another way to access a zip archive with rubyzip is to use rubyzip's
|
||||
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
|
||||
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
|
||||
to the test suite. Finally you can generate the rdoc documentation or
|
||||
visit http://rubyzip.sourceforge.net.
|
||||
|
||||
= License
|
||||
|
||||
rubyzip is distributed under the same license as ruby. See
|
||||
http://www.ruby-lang.org/en/LICENSE.txt
|
||||
|
||||
|
||||
= Website and Project Home
|
||||
|
||||
http://rubyzip.sourceforge.net
|
||||
|
||||
http://sourceforge.net/projects/rubyzip
|
||||
|
||||
== Download (tarballs and gems)
|
||||
|
||||
http://sourceforge.net/project/showfiles.php?group_id=43107&package_id=35377
|
||||
|
||||
= Authors
|
||||
|
||||
Thomas Sondergaard (thomas at sondergaard.cc)
|
||||
|
||||
extra-field support contributed by Tatsuki Sugiura (sugi at nemui.org)
|
110
vendor/rubyzip-0.5.8/Rakefile
vendored
Normal file
110
vendor/rubyzip-0.5.8/Rakefile
vendored
Normal file
|
@ -0,0 +1,110 @@
|
|||
# Rakefile for RubyGems -*- ruby -*-
|
||||
|
||||
require 'rubygems'
|
||||
require 'rake/clean'
|
||||
require 'rake/testtask'
|
||||
require 'rake/packagetask'
|
||||
require 'rake/gempackagetask'
|
||||
require 'rake/rdoctask'
|
||||
require 'rake/contrib/sshpublisher'
|
||||
require 'net/ftp'
|
||||
|
||||
PKG_NAME = 'rubyzip'
|
||||
PKG_VERSION = File.read('lib/zip/zip.rb').match(/\s+VERSION\s*=\s*'(.*)'/)[1]
|
||||
|
||||
PKG_FILES = FileList.new
|
||||
|
||||
PKG_FILES.add %w{ README NEWS TODO ChangeLog install.rb Rakefile }
|
||||
PKG_FILES.add %w{ samples/*.rb }
|
||||
PKG_FILES.add %w{ test/*.rb }
|
||||
PKG_FILES.add %w{ test/data/* }
|
||||
PKG_FILES.exclude "test/data/generated"
|
||||
PKG_FILES.add %w{ lib/**/*.rb }
|
||||
|
||||
def clobberFromCvsIgnore(path)
|
||||
CLOBBER.add File.readlines(path+'/.cvsignore').map {
|
||||
|f| File.join(path, f.chomp)
|
||||
}
|
||||
end
|
||||
|
||||
clobberFromCvsIgnore '.'
|
||||
clobberFromCvsIgnore 'samples'
|
||||
clobberFromCvsIgnore 'test'
|
||||
clobberFromCvsIgnore 'test/data'
|
||||
|
||||
task :default => [:test]
|
||||
|
||||
desc "Run unit tests"
|
||||
task :test do
|
||||
ruby %{-C test alltests.rb}
|
||||
end
|
||||
|
||||
# Shortcuts for test targets
|
||||
task :ut => [:test]
|
||||
|
||||
spec = Gem::Specification.new do |s|
|
||||
s.name = PKG_NAME
|
||||
s.version = PKG_VERSION
|
||||
s.author = "Thomas Sondergaard"
|
||||
s.email = "thomas(at)sondergaard.cc"
|
||||
s.homepage = "http://rubyzip.sourceforge.net/"
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.summary = "rubyzip is a ruby module for reading and writing zip files"
|
||||
s.files = PKG_FILES.to_a #Dir.glob("{samples,lib,test,docs}/**/*").delete_if {|item| item.include?("CVS") || item.include?("rdoc") || item =~ /~$/ }
|
||||
s.require_path = 'lib'
|
||||
s.autorequire = 'zip/zip'
|
||||
end
|
||||
|
||||
Rake::GemPackageTask.new(spec) do |pkg|
|
||||
pkg.need_zip = true
|
||||
pkg.need_tar = true
|
||||
end
|
||||
|
||||
Rake::RDocTask.new do |rd|
|
||||
rd.main = "README"
|
||||
rd.rdoc_files.add %W{ lib/zip/*.rb README NEWS TODO ChangeLog }
|
||||
rd.options << "--title 'rubyzip documentation' --webcvs http://cvs.sourceforge.net/viewcvs.py/rubyzip/rubyzip/"
|
||||
# rd.options << "--all"
|
||||
end
|
||||
|
||||
desc "Publish documentation"
|
||||
task :pdoc => [:rdoc] do
|
||||
Rake::SshFreshDirPublisher.
|
||||
new("thomas@rubyzip.sourceforge.net", "rubyzip/htdocs", "html").upload
|
||||
end
|
||||
|
||||
desc "Publish package"
|
||||
task :ppackage => [:package] do
|
||||
Net::FTP.open("upload.sourceforge.net",
|
||||
"ftp",
|
||||
ENV['USER']+"@"+ENV['HOSTNAME']) {
|
||||
|ftpclient|
|
||||
ftpclient.chdir "incoming"
|
||||
Dir['pkg/*.{tgz,zip,gem}'].each {
|
||||
|e|
|
||||
ftpclient.putbinaryfile(e, File.basename(e))
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
desc "Generate the ChangeLog file"
|
||||
task :ChangeLog do
|
||||
puts "Updating ChangeLog"
|
||||
system %{cvs2cl}
|
||||
end
|
||||
|
||||
desc "Make a release"
|
||||
task :release => [:tag_release, :pdoc, :ppackage] do
|
||||
end
|
||||
|
||||
desc "Make a release tag"
|
||||
task :tag_release do
|
||||
tag = "release-#{PKG_VERSION.gsub('.','-')}"
|
||||
|
||||
puts "Checking for tag '#{tag}'"
|
||||
if (Regexp.new("^\\s+#{tag}") =~ `cvs log README`)
|
||||
abort "Tag '#{tag}' already exists"
|
||||
end
|
||||
puts "Tagging module with '#{tag}'"
|
||||
system("cvs tag #{tag}")
|
||||
end
|
5
vendor/rubyzip-0.5.6/TODO → vendor/rubyzip-0.5.8/TODO
vendored
Executable file → Normal file
5
vendor/rubyzip-0.5.6/TODO → vendor/rubyzip-0.5.8/TODO
vendored
Executable file → Normal file
|
@ -1,10 +1,9 @@
|
|||
* Fix problem with mixing AbstractInputStream::gets and AbstractInputStream::red
|
||||
|
||||
* Fix problem with mixing AbstractInputStream::gets and AbstractInputStream::read
|
||||
* Implement ZipFsDir.glob
|
||||
* ZipFile.checkIntegrity method
|
||||
* non-MSDOS permission attributes
|
||||
** See mail from Ned Konz to ruby-talk subj. "Re: SV: [ANN] Archive 0.2"
|
||||
* Packager version, required unpacker version in zip headers
|
||||
** See mail from Ned Konz to ruby-talk subj. "Re: SV: [ANN] Archive 0.2"
|
||||
* implement small gui app on top, to exercise library and to discover
|
||||
what features should be added to rubyzip next.
|
||||
* implement storing attributes and ownership information
|
7
vendor/rubyzip-0.5.6/install.rb → vendor/rubyzip-0.5.8/install.rb
vendored
Executable file → Normal file
7
vendor/rubyzip-0.5.6/install.rb → vendor/rubyzip-0.5.8/install.rb
vendored
Executable file → Normal file
|
@ -12,10 +12,11 @@ files = %w{ stdrubyext.rb ioextras.rb zip.rb zipfilesystem.rb ziprequire.rb temp
|
|||
|
||||
INSTALL_DIR = File.join(CONFIG["sitelibdir"], "zip")
|
||||
File.makedirs(INSTALL_DIR)
|
||||
Dir.chdir "zip"
|
||||
|
||||
SOURCE_DIR = File.join(File.dirname($0), "lib/zip")
|
||||
|
||||
files.each {
|
||||
|filename|
|
||||
installPath = File.join(INSTALL_DIR, filename)
|
||||
File::install(filename, installPath, 0644, true)
|
||||
File::install(File.join(SOURCE_DIR, filename), installPath, 0644, true)
|
||||
}
|
||||
Dir.chdir ".."
|
7
vendor/rubyzip-0.5.6/zip/ioextras.rb → vendor/rubyzip-0.5.8/lib/zip/ioextras.rb
vendored
Executable file → Normal file
7
vendor/rubyzip-0.5.6/zip/ioextras.rb → vendor/rubyzip-0.5.8/lib/zip/ioextras.rb
vendored
Executable file → Normal file
|
@ -1,4 +1,6 @@
|
|||
module IOExtras
|
||||
module IOExtras #:nodoc:
|
||||
|
||||
# Implements kind_of? in order to pretend to be an IO object
|
||||
module FakeIO
|
||||
def kind_of?(object)
|
||||
object == IO || super
|
||||
|
@ -66,7 +68,8 @@ module IOExtras
|
|||
end
|
||||
|
||||
|
||||
#relies on <<
|
||||
# Implements many of the output convenience methods of IO.
|
||||
# relies on <<
|
||||
module AbstractOutputStream
|
||||
include FakeIO
|
||||
|
10
vendor/rubyzip-0.5.6/zip/stdrubyext.rb → vendor/rubyzip-0.5.8/lib/zip/stdrubyext.rb
vendored
Executable file → Normal file
10
vendor/rubyzip-0.5.6/zip/stdrubyext.rb → vendor/rubyzip-0.5.8/lib/zip/stdrubyext.rb
vendored
Executable file → Normal file
|
@ -16,7 +16,7 @@ module Enumerable #:nodoc:all
|
|||
end
|
||||
|
||||
unless Object.method_defined?(:object_id)
|
||||
class Object
|
||||
class Object #:nodoc:all
|
||||
# Using object_id which is the new thing, so we need
|
||||
# to make that work in versions prior to 1.8.0
|
||||
alias object_id id
|
||||
|
@ -24,7 +24,7 @@ unless Object.method_defined?(:object_id)
|
|||
end
|
||||
|
||||
unless File.respond_to?(:read)
|
||||
class File
|
||||
class File # :nodoc:all
|
||||
# singleton method read does not exist in 1.6.x
|
||||
def self.read(fileName)
|
||||
open(fileName) { |f| f.read }
|
||||
|
@ -32,7 +32,7 @@ unless File.respond_to?(:read)
|
|||
end
|
||||
end
|
||||
|
||||
class String
|
||||
class String #:nodoc:all
|
||||
def starts_with(aString)
|
||||
rindex(aString, 0) == 0
|
||||
end
|
||||
|
@ -50,7 +50,7 @@ class String
|
|||
end
|
||||
end
|
||||
|
||||
class Time
|
||||
class Time #:nodoc:all
|
||||
|
||||
#MS-DOS File Date and Time format as used in Interrupt 21H Function 57H:
|
||||
#
|
||||
|
@ -95,7 +95,7 @@ class Time
|
|||
end
|
||||
end
|
||||
|
||||
class Module
|
||||
class Module #:nodoc:all
|
||||
def forward_message(forwarder, *messagesToForward)
|
||||
methodDefs = messagesToForward.map {
|
||||
|msg|
|
4
vendor/rubyzip-0.5.6/zip/tempfile_bugfixed.rb → vendor/rubyzip-0.5.8/lib/zip/tempfile_bugfixed.rb
vendored
Executable file → Normal file
4
vendor/rubyzip-0.5.6/zip/tempfile_bugfixed.rb → vendor/rubyzip-0.5.8/lib/zip/tempfile_bugfixed.rb
vendored
Executable file → Normal file
|
@ -1,13 +1,13 @@
|
|||
#
|
||||
# tempfile - manipulates temporary files
|
||||
#
|
||||
# $Id: tempfile_bugfixed.rb,v 1.1 2005/01/07 23:08:02 alexeyv Exp $
|
||||
# $Id: tempfile_bugfixed.rb,v 1.2 2005/02/19 20:30:33 thomas Exp $
|
||||
#
|
||||
|
||||
require 'delegate'
|
||||
require 'tmpdir'
|
||||
|
||||
module BugFix
|
||||
module BugFix #:nodoc:all
|
||||
|
||||
# A class for managing temporary files. This library is written to be
|
||||
# thread safe.
|
207
vendor/rubyzip-0.5.6/zip/zip.rb → vendor/rubyzip-0.5.8/lib/zip/zip.rb
vendored
Executable file → Normal file
207
vendor/rubyzip-0.5.6/zip/zip.rb → vendor/rubyzip-0.5.8/lib/zip/zip.rb
vendored
Executable file → Normal file
|
@ -11,7 +11,7 @@ if Tempfile.superclass == SimpleDelegator
|
|||
Tempfile = BugFix::Tempfile
|
||||
end
|
||||
|
||||
module Zlib
|
||||
module Zlib #:nodoc:all
|
||||
if ! const_defined? :MAX_WBITS
|
||||
MAX_WBITS = Zlib::Deflate.MAX_WBITS
|
||||
end
|
||||
|
@ -19,6 +19,8 @@ end
|
|||
|
||||
module Zip
|
||||
|
||||
VERSION = '0.5.8'
|
||||
|
||||
RUBY_MINOR_VERSION = RUBY_VERSION.split(".")[1].to_i
|
||||
|
||||
# Ruby 1.7.x compatibility
|
||||
|
@ -27,9 +29,53 @@ module Zip
|
|||
# not so in 1.7.x
|
||||
EMPTY_FILE_RETURNS_EMPTY_STRING_FIRST = RUBY_MINOR_VERSION != 7
|
||||
|
||||
# ZipInputStream is the basic class for reading zip entries in a
|
||||
# zip file. It is possible to create a ZipInputStream object directly,
|
||||
# passing the zip file name to the constructor, but more often than not
|
||||
# the ZipInputStream will be obtained from a ZipFile (perhaps using the
|
||||
# ZipFileSystem interface) object for a particular entry in the zip
|
||||
# archive.
|
||||
#
|
||||
# A ZipInputStream inherits IOExtras::AbstractInputStream in order
|
||||
# to provide an IO-like interface for reading from a single zip
|
||||
# entry. Beyond methods for mimicking an IO-object it contains
|
||||
# the method get_next_entry for iterating through the entries of
|
||||
# an archive. get_next_entry returns a ZipEntry object that describes
|
||||
# the zip entry the ZipInputStream is currently reading from.
|
||||
#
|
||||
# Example that creates a zip archive with ZipOutputStream and reads it
|
||||
# back again with a ZipInputStream.
|
||||
#
|
||||
# require 'zip/zip'
|
||||
#
|
||||
# Zip::ZipOutputStream::open("my.zip") {
|
||||
# |io|
|
||||
#
|
||||
# io.put_next_entry("first_entry.txt")
|
||||
# io.write "Hello world!"
|
||||
#
|
||||
# io.put_next_entry("adir/first_entry.txt")
|
||||
# io.write "Hello again!"
|
||||
# }
|
||||
#
|
||||
#
|
||||
# Zip::ZipInputStream::open("my.zip") {
|
||||
# |io|
|
||||
#
|
||||
# while (entry = io.get_next_entry)
|
||||
# puts "Contents of #{entry.name}: '#{io.read}'"
|
||||
# end
|
||||
# }
|
||||
#
|
||||
# java.util.zip.ZipInputStream is the original inspiration for this
|
||||
# class.
|
||||
|
||||
class ZipInputStream
|
||||
include IOExtras::AbstractInputStream
|
||||
|
||||
# Opens the indicated zip file. An exception is thrown
|
||||
# if the specified offset in the specified filename is
|
||||
# not a local zip entry header.
|
||||
def initialize(filename, offset = 0)
|
||||
super()
|
||||
@archiveIO = File.open(filename, "rb")
|
||||
|
@ -42,6 +88,9 @@ module Zip
|
|||
@archiveIO.close
|
||||
end
|
||||
|
||||
# Same as #initialize but if a block is passed the opened
|
||||
# stream is passed to the block and closed when the block
|
||||
# returns.
|
||||
def ZipInputStream.open(filename)
|
||||
return new(filename) unless block_given?
|
||||
|
||||
|
@ -51,12 +100,17 @@ module Zip
|
|||
zio.close if zio
|
||||
end
|
||||
|
||||
# Returns a ZipEntry object. It is necessary to call this
|
||||
# method on a newly created ZipInputStream before reading from
|
||||
# the first entry in the archive. Returns nil when there are
|
||||
# no more entries.
|
||||
def get_next_entry
|
||||
@archiveIO.seek(@currentEntry.next_header_offset,
|
||||
IO::SEEK_SET) if @currentEntry
|
||||
open_entry
|
||||
end
|
||||
|
||||
# Rewinds the stream to the beginning of the current entry
|
||||
def rewind
|
||||
return if @currentEntry.nil?
|
||||
@lineno = 0
|
||||
|
@ -65,6 +119,13 @@ module Zip
|
|||
open_entry
|
||||
end
|
||||
|
||||
# Modeled after IO.read
|
||||
def read(numberOfBytes = nil)
|
||||
@decompressor.read(numberOfBytes)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def open_entry
|
||||
@currentEntry = ZipEntry.read_local_entry(@archiveIO)
|
||||
if (@currentEntry == nil)
|
||||
|
@ -82,10 +143,6 @@ module Zip
|
|||
return @currentEntry
|
||||
end
|
||||
|
||||
def read(numberOfBytes = nil)
|
||||
@decompressor.read(numberOfBytes)
|
||||
end
|
||||
protected
|
||||
def produce_input
|
||||
@decompressor.produce_input
|
||||
end
|
||||
|
@ -505,11 +562,31 @@ module Zip
|
|||
end
|
||||
|
||||
|
||||
# ZipOutputStream is the basic class for writing zip files. It is
|
||||
# possible to create a ZipOutputStream object directly, passing
|
||||
# the zip file name to the constructor, but more often than not
|
||||
# the ZipOutputStream will be obtained from a ZipFile (perhaps using the
|
||||
# ZipFileSystem interface) object for a particular entry in the zip
|
||||
# archive.
|
||||
#
|
||||
# A ZipOutputStream inherits IOExtras::AbstractOutputStream in order
|
||||
# to provide an IO-like interface for writing to a single zip
|
||||
# entry. Beyond methods for mimicking an IO-object it contains
|
||||
# the method put_next_entry that closes the current entry
|
||||
# and creates a new.
|
||||
#
|
||||
# Please refer to ZipInputStream for example code.
|
||||
#
|
||||
# java.util.zip.ZipOutputStream is the original inspiration for this
|
||||
# class.
|
||||
|
||||
class ZipOutputStream
|
||||
include IOExtras::AbstractOutputStream
|
||||
|
||||
attr_accessor :comment
|
||||
|
||||
# Opens the indicated zip file. If a file with that name already
|
||||
# exists it will be overwritten.
|
||||
def initialize(fileName)
|
||||
super()
|
||||
@fileName = fileName
|
||||
|
@ -521,6 +598,9 @@ module Zip
|
|||
@comment = nil
|
||||
end
|
||||
|
||||
# Same as #initialize but if a block is passed the opened
|
||||
# stream is passed to the block and closed when the block
|
||||
# returns.
|
||||
def ZipOutputStream.open(fileName)
|
||||
return new(fileName) unless block_given?
|
||||
zos = new(fileName)
|
||||
|
@ -529,6 +609,7 @@ module Zip
|
|||
zos.close if zos
|
||||
end
|
||||
|
||||
# Closes the stream and writes the central directory to the zip file
|
||||
def close
|
||||
return if @closed
|
||||
finalize_current_entry
|
||||
|
@ -538,6 +619,8 @@ module Zip
|
|||
@closed = true
|
||||
end
|
||||
|
||||
# Closes the current entry and opens a new for writing.
|
||||
# +entry+ can be a ZipEntry object or a string.
|
||||
def put_next_entry(entry, level = Zlib::DEFAULT_COMPRESSION)
|
||||
raise ZipError, "zip stream is closed" if @closed
|
||||
newEntry = entry.kind_of?(ZipEntry) ? entry : ZipEntry.new(@fileName, entry.to_s)
|
||||
|
@ -613,6 +696,7 @@ module Zip
|
|||
end
|
||||
|
||||
public
|
||||
# Modeled after IO.<<
|
||||
def << (data)
|
||||
@compressor << data
|
||||
end
|
||||
|
@ -678,7 +762,7 @@ module Zip
|
|||
end
|
||||
|
||||
|
||||
class ZipEntrySet
|
||||
class ZipEntrySet #:nodoc:all
|
||||
include Enumerable
|
||||
|
||||
def initialize(anEnumerable = [])
|
||||
|
@ -733,7 +817,7 @@ module Zip
|
|||
end
|
||||
|
||||
|
||||
class ZipCentralDirectory #:nodoc:all
|
||||
class ZipCentralDirectory
|
||||
include Enumerable
|
||||
|
||||
END_OF_CENTRAL_DIRECTORY_SIGNATURE = 0x06054b50
|
||||
|
@ -742,23 +826,24 @@ module Zip
|
|||
|
||||
attr_reader :comment
|
||||
|
||||
# Returns an Enumerable containing the entries.
|
||||
def entries
|
||||
@entrySet.entries
|
||||
end
|
||||
|
||||
def initialize(entries = ZipEntrySet.new, comment = "")
|
||||
def initialize(entries = ZipEntrySet.new, comment = "") #:nodoc:
|
||||
super()
|
||||
@entrySet = entries.kind_of?(ZipEntrySet) ? entries : ZipEntrySet.new(entries)
|
||||
@comment = comment
|
||||
end
|
||||
|
||||
def write_to_stream(io)
|
||||
def write_to_stream(io) #:nodoc:
|
||||
offset = io.tell
|
||||
@entrySet.each { |entry| entry.write_c_dir_entry(io) }
|
||||
write_e_o_c_d(io, offset)
|
||||
end
|
||||
|
||||
def write_e_o_c_d(io, offset)
|
||||
def write_e_o_c_d(io, offset) #:nodoc:
|
||||
io <<
|
||||
[END_OF_CENTRAL_DIRECTORY_SIGNATURE,
|
||||
0 , # @numberOfThisDisk
|
||||
|
@ -772,13 +857,13 @@ module Zip
|
|||
end
|
||||
private :write_e_o_c_d
|
||||
|
||||
def cdir_size
|
||||
def cdir_size #:nodoc:
|
||||
# does not include eocd
|
||||
@entrySet.inject(0) { |value, entry| entry.cdir_header_size + value }
|
||||
end
|
||||
private :cdir_size
|
||||
|
||||
def read_e_o_c_d(io)
|
||||
def read_e_o_c_d(io) #:nodoc:
|
||||
buf = get_e_o_c_d(io)
|
||||
@numberOfThisDisk = ZipEntry::read_zip_short(buf)
|
||||
@numberOfDiskWithStartOfCDir = ZipEntry::read_zip_short(buf)
|
||||
|
@ -791,7 +876,7 @@ module Zip
|
|||
raise ZipError, "Zip consistency problem while reading eocd structure" unless buf.size == 0
|
||||
end
|
||||
|
||||
def read_central_directory_entries(io)
|
||||
def read_central_directory_entries(io) #:nodoc:
|
||||
begin
|
||||
io.seek(@cdirOffset, IO::SEEK_SET)
|
||||
rescue Errno::EINVAL
|
||||
|
@ -803,12 +888,12 @@ module Zip
|
|||
}
|
||||
end
|
||||
|
||||
def read_from_stream(io)
|
||||
def read_from_stream(io) #:nodoc:
|
||||
read_e_o_c_d(io)
|
||||
read_central_directory_entries(io)
|
||||
end
|
||||
|
||||
def get_e_o_c_d(io)
|
||||
def get_e_o_c_d(io) #:nodoc:
|
||||
begin
|
||||
io.seek(-MAX_END_OF_CENTRAL_DIRECTORY_STRUCTURE_SIZE, IO::SEEK_END)
|
||||
rescue Errno::EINVAL
|
||||
|
@ -826,15 +911,18 @@ module Zip
|
|||
return buf
|
||||
end
|
||||
|
||||
# For iterating over the entries.
|
||||
def each(&proc)
|
||||
@entrySet.each(&proc)
|
||||
end
|
||||
|
||||
# Returns the number of entries in the central directory (and
|
||||
# consequently in the zip archive).
|
||||
def size
|
||||
@entrySet.size
|
||||
end
|
||||
|
||||
def ZipCentralDirectory.read_from_stream(io)
|
||||
def ZipCentralDirectory.read_from_stream(io) #:nodoc:
|
||||
cdir = new
|
||||
cdir.read_from_stream(io)
|
||||
return cdir
|
||||
|
@ -842,7 +930,7 @@ module Zip
|
|||
return nil
|
||||
end
|
||||
|
||||
def == (other)
|
||||
def == (other) #:nodoc:
|
||||
return false unless other.kind_of?(ZipCentralDirectory)
|
||||
@entrySet.entries.sort == other.entries.sort && comment == other.comment
|
||||
end
|
||||
|
@ -856,19 +944,64 @@ module Zip
|
|||
class ZipCompressionMethodError < ZipError; end
|
||||
class ZipEntryNameError < ZipError; end
|
||||
|
||||
# ZipFile is modeled after java.util.zip.ZipFile from the Java SDK.
|
||||
# The most important methods are those inherited from
|
||||
# ZipCentralDirectory for accessing information about the entries in
|
||||
# the archive and methods such as get_input_stream and
|
||||
# get_output_stream for reading from and writing entries to the
|
||||
# archive. The class includes a few convenience methods such as
|
||||
# #extract for extracting entries to the filesystem, and #remove,
|
||||
# #replace, #rename and #mkdir for making simple modifications to
|
||||
# the archive.
|
||||
#
|
||||
# Modifications to a zip archive are not committed until #commit or
|
||||
# #close is called. The method #open accepts a block following
|
||||
# the pattern from File.open offering a simple way to
|
||||
# automatically close the archive when the block returns.
|
||||
#
|
||||
# The following example opens zip archive <code>my.zip</code>
|
||||
# (creating it if it doesn't exist) and adds an entry
|
||||
# <code>first.txt</code> and a directory entry <code>a_dir</code>
|
||||
# to it.
|
||||
#
|
||||
# require 'zip/zip'
|
||||
#
|
||||
# Zip::ZipFile.open("my.zip", Zip::ZipFile::CREATE) {
|
||||
# |zipfile|
|
||||
# zipfile.get_output_stream("first.txt") { |f| f.puts "Hello from ZipFile" }
|
||||
# zipfile.mkdir("a_dir")
|
||||
# }
|
||||
#
|
||||
# The next example reopens <code>my.zip</code> writes the contents of
|
||||
# <code>first.txt</code> to standard out and deletes the entry from
|
||||
# the archive.
|
||||
#
|
||||
# require 'zip/zip'
|
||||
#
|
||||
# Zip::ZipFile.open("my.zip", Zip::ZipFile::CREATE) {
|
||||
# |zipfile|
|
||||
# puts zipfile.read("first.txt")
|
||||
# zipfile.remove("first.txt")
|
||||
# }
|
||||
#
|
||||
# ZipFileSystem offers an alternative API that emulates ruby's
|
||||
# interface for accessing the filesystem, ie. the File and Dir classes.
|
||||
|
||||
class ZipFile < ZipCentralDirectory
|
||||
|
||||
CREATE = 1
|
||||
|
||||
attr_reader :name
|
||||
|
||||
# Opens a zip archive. Pass true as the second parameter to create
|
||||
# a new archive if it doesn't exist already.
|
||||
def initialize(fileName, create = nil)
|
||||
super()
|
||||
@name = fileName
|
||||
@comment = ""
|
||||
if (File.exists?(fileName))
|
||||
File.open(name, "rb") { |f| read_from_stream(f) }
|
||||
elsif (create == ZipFile::CREATE)
|
||||
elsif (create)
|
||||
@entrySet = ZipEntrySet.new
|
||||
else
|
||||
raise ZipError, "File #{fileName} not found"
|
||||
|
@ -877,6 +1010,9 @@ module Zip
|
|||
@storedEntries = @entrySet.dup
|
||||
end
|
||||
|
||||
# Same as #new. If a block is passed the ZipFile object is passed
|
||||
# to the block and is automatically closed afterwards just as with
|
||||
# ruby's builtin File.open method.
|
||||
def ZipFile.open(fileName, create = nil)
|
||||
zf = ZipFile.new(fileName, create)
|
||||
if block_given?
|
||||
|
@ -890,8 +1026,15 @@ module Zip
|
|||
end
|
||||
end
|
||||
|
||||
# Returns the zip files comment, if it has one
|
||||
attr_accessor :comment
|
||||
|
||||
# Iterates over the contents of the ZipFile. This is more efficient
|
||||
# than using a ZipInputStream since this methods simply iterates
|
||||
# through the entries in the central directory structure in the archive
|
||||
# whereas ZipInputStream jumps through the entire archive accessing the
|
||||
# local entry headers (which contain the same information as the
|
||||
# central directory).
|
||||
def ZipFile.foreach(aZipFileName, &block)
|
||||
ZipFile.open(aZipFileName) {
|
||||
|zipFile|
|
||||
|
@ -899,10 +1042,16 @@ module Zip
|
|||
}
|
||||
end
|
||||
|
||||
# Returns an input stream to the specified entry. If a block is passed
|
||||
# the stream object is passed to the block and the stream is automatically
|
||||
# closed afterwards just as with ruby's builtin File.open method.
|
||||
def get_input_stream(entry, &aProc)
|
||||
get_entry(entry).get_input_stream(&aProc)
|
||||
end
|
||||
|
||||
# Returns an output stream to the specified entry. If a block is passed
|
||||
# the stream object is passed to the block and the stream is automatically
|
||||
# closed afterwards just as with ruby's builtin File.open method.
|
||||
def get_output_stream(entry, &aProc)
|
||||
newEntry = entry.kind_of?(ZipEntry) ? entry : ZipEntry.new(@name, entry.to_s)
|
||||
if newEntry.directory?
|
||||
|
@ -914,14 +1063,17 @@ module Zip
|
|||
zipStreamableEntry.get_output_stream(&aProc)
|
||||
end
|
||||
|
||||
# Returns the name of the zip archive
|
||||
def to_s
|
||||
@name
|
||||
end
|
||||
|
||||
# Returns a string containing the contents of the specified entry
|
||||
def read(entry)
|
||||
get_input_stream(entry) { |is| is.read }
|
||||
end
|
||||
|
||||
# Convenience method for adding the contents of a file to the archive
|
||||
def add(entry, srcPath, &continueOnExistsProc)
|
||||
continueOnExistsProc ||= proc { false }
|
||||
check_entry_exists(entry, continueOnExistsProc, "add")
|
||||
|
@ -933,21 +1085,26 @@ module Zip
|
|||
end
|
||||
end
|
||||
|
||||
# Removes the specified entry.
|
||||
def remove(entry)
|
||||
@entrySet.delete(get_entry(entry))
|
||||
end
|
||||
|
||||
# Renames the specified entry.
|
||||
def rename(entry, newName, &continueOnExistsProc)
|
||||
foundEntry = get_entry(entry)
|
||||
check_entry_exists(newName, continueOnExistsProc, "rename")
|
||||
foundEntry.name=newName
|
||||
end
|
||||
|
||||
# Replaces the specified entry with the contents of srcPath (from
|
||||
# the file system).
|
||||
def replace(entry, srcPath)
|
||||
check_file(srcPath)
|
||||
add(remove(entry), srcPath)
|
||||
end
|
||||
|
||||
# Extracts entry to file destPath.
|
||||
def extract(entry, destPath, &onExistsProc)
|
||||
onExistsProc ||= proc { false }
|
||||
foundEntry = get_entry(entry)
|
||||
|
@ -958,6 +1115,8 @@ module Zip
|
|||
end
|
||||
end
|
||||
|
||||
# Commits changes that has been made since the previous commit to
|
||||
# the zip archive.
|
||||
def commit
|
||||
return if ! commit_required?
|
||||
on_success_replace(name) {
|
||||
|
@ -973,14 +1132,19 @@ module Zip
|
|||
initialize(name)
|
||||
end
|
||||
|
||||
# Closes the zip file committing any changes that has been made.
|
||||
def close
|
||||
commit
|
||||
end
|
||||
|
||||
# Returns true if any changes has been made to this archive since
|
||||
# the previous commit
|
||||
def commit_required?
|
||||
return @entrySet != @storedEntries || @create == ZipFile::CREATE
|
||||
end
|
||||
|
||||
# Searches for entry with the specified name. Returns nil if
|
||||
# no entry is found. See also get_entry
|
||||
def find_entry(entry)
|
||||
@entrySet.detect {
|
||||
|e|
|
||||
|
@ -988,6 +1152,8 @@ module Zip
|
|||
}
|
||||
end
|
||||
|
||||
# Searches for an entry just as find_entry, but throws Errno::ENOENT
|
||||
# if no entry is found.
|
||||
def get_entry(entry)
|
||||
selectedEntry = find_entry(entry)
|
||||
unless selectedEntry
|
||||
|
@ -996,6 +1162,7 @@ module Zip
|
|||
return selectedEntry
|
||||
end
|
||||
|
||||
# Creates a directory
|
||||
def mkdir(entryName, permissionInt = 0) #permissionInt ignored
|
||||
if find_entry(entryName)
|
||||
raise Errno::EEXIST, "File exists - #{entryName}"
|
||||
|
@ -1256,8 +1423,8 @@ module Zip
|
|||
register_map
|
||||
|
||||
def initialize(binstr = nil)
|
||||
@uid = nil
|
||||
@gid = nil
|
||||
@uid = 0
|
||||
@gid = 0
|
||||
binstr and merge(binstr)
|
||||
end
|
||||
attr_accessor :uid, :gid
|
59
vendor/rubyzip-0.5.6/zip/zipfilesystem.rb → vendor/rubyzip-0.5.8/lib/zip/zipfilesystem.rb
vendored
Executable file → Normal file
59
vendor/rubyzip-0.5.6/zip/zipfilesystem.rb → vendor/rubyzip-0.5.8/lib/zip/zipfilesystem.rb
vendored
Executable file → Normal file
|
@ -1,9 +1,42 @@
|
|||
require 'zip/zip'
|
||||
|
||||
module Zip
|
||||
|
||||
# The ZipFileSystem API provides an API for accessing entries in
|
||||
# a zip archive that is similar to ruby's builtin File and Dir
|
||||
# classes.
|
||||
#
|
||||
# Requiring 'zip/zipfilesystem' includes this module in ZipFile
|
||||
# making the methods in this module available on ZipFile objects.
|
||||
#
|
||||
# Using this API the following example creates a new zip file
|
||||
# <code>my.zip</code> containing a normal entry with the name
|
||||
# <code>first.txt</code>, a directory entry named <code>mydir</code>
|
||||
# and finally another normal entry named <code>second.txt</code>
|
||||
#
|
||||
# require 'zip/zipfilesystem'
|
||||
#
|
||||
# Zip::ZipFile.open("my.zip", Zip::ZipFile::CREATE) {
|
||||
# |zipfile|
|
||||
# zipfile.file.open("first.txt", "w") { |f| f.puts "Hello world" }
|
||||
# zipfile.dir.mkdir("mydir")
|
||||
# zipfile.file.open("mydir/second.txt", "w") { |f| f.puts "Hello again" }
|
||||
# }
|
||||
#
|
||||
# Reading is as easy as writing, as the following example shows. The
|
||||
# example writes the contents of <code>first.txt</code> from zip archive
|
||||
# <code>my.zip</code> to standard out.
|
||||
#
|
||||
# require 'zip/zipfilesystem'
|
||||
#
|
||||
# Zip::ZipFile.open("my.zip") {
|
||||
# |zipfile|
|
||||
# puts zipfile.file.read("first.txt")
|
||||
# }
|
||||
|
||||
module ZipFileSystem
|
||||
|
||||
def initialize
|
||||
def initialize # :nodoc:
|
||||
mappedZip = ZipFileNameMapper.new(self)
|
||||
@zipFsDir = ZipFsDir.new(mappedZip)
|
||||
@zipFsFile = ZipFsFile.new(mappedZip)
|
||||
|
@ -11,14 +44,26 @@ module Zip
|
|||
@zipFsFile.dir = @zipFsDir
|
||||
end
|
||||
|
||||
# Returns a ZipFsDir which is much like ruby's builtin Dir (class)
|
||||
# object, except it works on the ZipFile on which this method is
|
||||
# invoked
|
||||
def dir
|
||||
@zipFsDir
|
||||
end
|
||||
|
||||
# Returns a ZipFsFile which is much like ruby's builtin File (class)
|
||||
# object, except it works on the ZipFile on which this method is
|
||||
# invoked
|
||||
def file
|
||||
@zipFsFile
|
||||
end
|
||||
|
||||
# Instances of this class are normally accessed via the accessor
|
||||
# ZipFile::file. An instance of ZipFsFile behaves like ruby's
|
||||
# builtin File (class) object, except it works on ZipFile entries.
|
||||
#
|
||||
# The individual methods are not documented due to their
|
||||
# similarity with the methods in File
|
||||
class ZipFsFile
|
||||
|
||||
attr_writer :dir
|
||||
|
@ -198,7 +243,7 @@ module Zip
|
|||
@mappedZip.get_entry(fileName).size
|
||||
end
|
||||
|
||||
# nil for not found and nil for directories
|
||||
# Returns nil for not found and nil for directories
|
||||
def size?(fileName)
|
||||
entry = @mappedZip.find_entry(fileName)
|
||||
return (entry == nil || entry.directory?) ? nil : entry.size
|
||||
|
@ -367,6 +412,12 @@ module Zip
|
|||
end
|
||||
end
|
||||
|
||||
# Instances of this class are normally accessed via the accessor
|
||||
# ZipFile::dir. An instance of ZipFsDir behaves like ruby's
|
||||
# builtin Dir (class) object, except it works on ZipFile entries.
|
||||
#
|
||||
# The individual methods are not documented due to their
|
||||
# similarity with the methods in Dir
|
||||
class ZipFsDir
|
||||
|
||||
def initialize(mappedZip)
|
||||
|
@ -441,7 +492,7 @@ module Zip
|
|||
|
||||
end
|
||||
|
||||
class ZipFsDirIterator
|
||||
class ZipFsDirIterator # :nodoc:all
|
||||
include Enumerable
|
||||
|
||||
def initialize(arrayOfFileNames)
|
||||
|
@ -481,7 +532,7 @@ module Zip
|
|||
|
||||
# All access to ZipFile from ZipFsFile and ZipFsDir goes through a
|
||||
# ZipFileNameMapper, which has one responsibility: ensure
|
||||
class ZipFileNameMapper
|
||||
class ZipFileNameMapper # :nodoc:all
|
||||
include Enumerable
|
||||
|
||||
def initialize(zipFile)
|
33
vendor/rubyzip-0.5.6/zip/ziprequire.rb → vendor/rubyzip-0.5.8/lib/zip/ziprequire.rb
vendored
Executable file → Normal file
33
vendor/rubyzip-0.5.6/zip/ziprequire.rb → vendor/rubyzip-0.5.8/lib/zip/ziprequire.rb
vendored
Executable file → Normal file
|
@ -1,6 +1,35 @@
|
|||
# With ziprequire you can load ruby modules from a zip file. This means
|
||||
# ruby's module include path can include zip-files.
|
||||
#
|
||||
# The following example creates a zip file with a single entry
|
||||
# <code>log/simplelog.rb</code> that contains a single function
|
||||
# <code>simpleLog</code>:
|
||||
#
|
||||
# require 'zip/zipfilesystem'
|
||||
#
|
||||
# Zip::ZipFile.open("my.zip", true) {
|
||||
# |zf|
|
||||
# zf.file.open("log/simplelog.rb", "w") {
|
||||
# |f|
|
||||
# f.puts "def simpleLog(v)"
|
||||
# f.puts ' Kernel.puts "INFO: #{v}"'
|
||||
# f.puts "end"
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# To use the ruby module stored in the zip archive simply require
|
||||
# <code>zip/ziprequire</code> and include the <code>my.zip</code> zip
|
||||
# file in the module search path. The following command shows one
|
||||
# way to do this:
|
||||
#
|
||||
# ruby -rzip/ziprequire -Imy.zip -e " require 'log/simplelog'; simpleLog 'Hello world' "
|
||||
|
||||
#$: << 'data/rubycode.zip' << 'data/rubycode2.zip'
|
||||
|
||||
|
||||
require 'zip/zip'
|
||||
|
||||
class ZipList
|
||||
class ZipList #:nodoc:all
|
||||
def initialize(zipFileList)
|
||||
@zipFileList = zipFileList
|
||||
end
|
||||
|
@ -23,7 +52,7 @@ class ZipList
|
|||
end
|
||||
|
||||
|
||||
module Kernel
|
||||
module Kernel #:nodoc:all
|
||||
alias :oldRequire :require
|
||||
|
||||
def require(moduleName)
|
2
vendor/rubyzip-0.5.6/samples/example.rb → vendor/rubyzip-0.5.8/samples/example.rb
vendored
Executable file → Normal file
2
vendor/rubyzip-0.5.6/samples/example.rb → vendor/rubyzip-0.5.8/samples/example.rb
vendored
Executable file → Normal file
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
$: << ".."
|
||||
$: << "../lib"
|
||||
system("zip example.zip example.rb gtkRubyzip.rb")
|
||||
|
||||
require 'zip/zip'
|
2
vendor/rubyzip-0.5.6/samples/example_filesystem.rb → vendor/rubyzip-0.5.8/samples/example_filesystem.rb
vendored
Executable file → Normal file
2
vendor/rubyzip-0.5.6/samples/example_filesystem.rb → vendor/rubyzip-0.5.8/samples/example_filesystem.rb
vendored
Executable file → Normal file
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
$: << ".."
|
||||
$: << "../lib"
|
||||
|
||||
require 'zip/zipfilesystem'
|
||||
require 'ftools'
|
2
vendor/rubyzip-0.5.6/samples/gtkRubyzip.rb → vendor/rubyzip-0.5.8/samples/gtkRubyzip.rb
vendored
Executable file → Normal file
2
vendor/rubyzip-0.5.6/samples/gtkRubyzip.rb → vendor/rubyzip-0.5.8/samples/gtkRubyzip.rb
vendored
Executable file → Normal file
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
$: << ".."
|
||||
$: << "../lib"
|
||||
|
||||
$VERBOSE = true
|
||||
|
2
vendor/rubyzip-0.5.6/samples/write_simple.rb → vendor/rubyzip-0.5.8/samples/write_simple.rb
vendored
Executable file → Normal file
2
vendor/rubyzip-0.5.6/samples/write_simple.rb → vendor/rubyzip-0.5.8/samples/write_simple.rb
vendored
Executable file → Normal file
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
$: << ".."
|
||||
$: << "../lib"
|
||||
|
||||
require 'zip/zip'
|
||||
|
2
vendor/rubyzip-0.5.6/samples/zipfind.rb → vendor/rubyzip-0.5.8/samples/zipfind.rb
vendored
Executable file → Normal file
2
vendor/rubyzip-0.5.6/samples/zipfind.rb → vendor/rubyzip-0.5.8/samples/zipfind.rb
vendored
Executable file → Normal file
|
@ -2,7 +2,7 @@
|
|||
|
||||
$VERBOSE = true
|
||||
|
||||
$: << ".."
|
||||
$: << "../lib"
|
||||
|
||||
require 'zip/zip'
|
||||
require 'find'
|
0
vendor/rubyzip-0.5.6/test/alltests.rb → vendor/rubyzip-0.5.8/test/alltests.rb
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/alltests.rb → vendor/rubyzip-0.5.8/test/alltests.rb
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/file1.txt → vendor/rubyzip-0.5.8/test/data/file1.txt
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/file1.txt → vendor/rubyzip-0.5.8/test/data/file1.txt
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/file1.txt.deflatedData → vendor/rubyzip-0.5.8/test/data/file1.txt.deflatedData
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/file1.txt.deflatedData → vendor/rubyzip-0.5.8/test/data/file1.txt.deflatedData
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/file2.txt → vendor/rubyzip-0.5.8/test/data/file2.txt
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/file2.txt → vendor/rubyzip-0.5.8/test/data/file2.txt
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/notzippedruby.rb → vendor/rubyzip-0.5.8/test/data/notzippedruby.rb
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/notzippedruby.rb → vendor/rubyzip-0.5.8/test/data/notzippedruby.rb
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/rubycode.zip → vendor/rubyzip-0.5.8/test/data/rubycode.zip
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/rubycode.zip → vendor/rubyzip-0.5.8/test/data/rubycode.zip
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/rubycode2.zip → vendor/rubyzip-0.5.8/test/data/rubycode2.zip
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/rubycode2.zip → vendor/rubyzip-0.5.8/test/data/rubycode2.zip
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/testDirectory.bin → vendor/rubyzip-0.5.8/test/data/testDirectory.bin
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/testDirectory.bin → vendor/rubyzip-0.5.8/test/data/testDirectory.bin
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/zipWithDirs.zip → vendor/rubyzip-0.5.8/test/data/zipWithDirs.zip
vendored
Executable file → Normal file
0
vendor/rubyzip-0.5.6/test/zipWithDirs.zip → vendor/rubyzip-0.5.8/test/data/zipWithDirs.zip
vendored
Executable file → Normal file
155
vendor/rubyzip-0.5.8/test/gentestfiles.rb
vendored
Normal file
155
vendor/rubyzip-0.5.8/test/gentestfiles.rb
vendored
Normal file
|
@ -0,0 +1,155 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
$VERBOSE = true
|
||||
|
||||
class TestFiles
|
||||
RANDOM_ASCII_FILE1 = "data/generated/randomAscii1.txt"
|
||||
RANDOM_ASCII_FILE2 = "data/generated/randomAscii2.txt"
|
||||
RANDOM_ASCII_FILE3 = "data/generated/randomAscii3.txt"
|
||||
RANDOM_BINARY_FILE1 = "data/generated/randomBinary1.bin"
|
||||
RANDOM_BINARY_FILE2 = "data/generated/randomBinary2.bin"
|
||||
|
||||
EMPTY_TEST_DIR = "data/generated/emptytestdir"
|
||||
|
||||
ASCII_TEST_FILES = [ RANDOM_ASCII_FILE1, RANDOM_ASCII_FILE2, RANDOM_ASCII_FILE3 ]
|
||||
BINARY_TEST_FILES = [ RANDOM_BINARY_FILE1, RANDOM_BINARY_FILE2 ]
|
||||
TEST_DIRECTORIES = [ EMPTY_TEST_DIR ]
|
||||
TEST_FILES = [ ASCII_TEST_FILES, BINARY_TEST_FILES, EMPTY_TEST_DIR ].flatten!
|
||||
|
||||
def TestFiles.create_test_files(recreate)
|
||||
if (recreate ||
|
||||
! (TEST_FILES.inject(true) { |accum, element| accum && File.exists?(element) }))
|
||||
|
||||
Dir.mkdir "data/generated" rescue Errno::EEXIST
|
||||
|
||||
ASCII_TEST_FILES.each_with_index {
|
||||
|filename, index|
|
||||
create_random_ascii(filename, 1E4 * (index+1))
|
||||
}
|
||||
|
||||
BINARY_TEST_FILES.each_with_index {
|
||||
|filename, index|
|
||||
create_random_binary(filename, 1E4 * (index+1))
|
||||
}
|
||||
|
||||
ensure_dir(EMPTY_TEST_DIR)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def TestFiles.create_random_ascii(filename, size)
|
||||
File.open(filename, "wb") {
|
||||
|file|
|
||||
while (file.tell < size)
|
||||
file << rand
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
def TestFiles.create_random_binary(filename, size)
|
||||
File.open(filename, "wb") {
|
||||
|file|
|
||||
while (file.tell < size)
|
||||
file << [rand].pack("V")
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
def TestFiles.ensure_dir(name)
|
||||
if File.exists?(name)
|
||||
return if File.stat(name).directory?
|
||||
File.delete(name)
|
||||
end
|
||||
Dir.mkdir(name)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
# For representation and creation of
|
||||
# test data
|
||||
class TestZipFile
|
||||
attr_accessor :zip_name, :entry_names, :comment
|
||||
|
||||
def initialize(zip_name, entry_names, comment = "")
|
||||
@zip_name=zip_name
|
||||
@entry_names=entry_names
|
||||
@comment = comment
|
||||
end
|
||||
|
||||
def TestZipFile.create_test_zips(recreate)
|
||||
files = Dir.entries("data/generated")
|
||||
if (recreate ||
|
||||
! (files.index(File.basename(TEST_ZIP1.zip_name)) &&
|
||||
files.index(File.basename(TEST_ZIP2.zip_name)) &&
|
||||
files.index(File.basename(TEST_ZIP3.zip_name)) &&
|
||||
files.index(File.basename(TEST_ZIP4.zip_name)) &&
|
||||
files.index("empty.txt") &&
|
||||
files.index("short.txt") &&
|
||||
files.index("longAscii.txt") &&
|
||||
files.index("longBinary.bin") ))
|
||||
raise "failed to create test zip '#{TEST_ZIP1.zip_name}'" unless
|
||||
system("zip #{TEST_ZIP1.zip_name} data/file2.txt")
|
||||
raise "failed to remove entry from '#{TEST_ZIP1.zip_name}'" unless
|
||||
system("zip #{TEST_ZIP1.zip_name} -d data/file2.txt")
|
||||
|
||||
File.open("data/generated/empty.txt", "w") {}
|
||||
|
||||
File.open("data/generated/short.txt", "w") { |file| file << "ABCDEF" }
|
||||
ziptestTxt=""
|
||||
File.open("data/file2.txt") { |file| ziptestTxt=file.read }
|
||||
File.open("data/generated/longAscii.txt", "w") {
|
||||
|file|
|
||||
while (file.tell < 1E5)
|
||||
file << ziptestTxt
|
||||
end
|
||||
}
|
||||
|
||||
testBinaryPattern=""
|
||||
File.open("data/generated/empty.zip") { |file| testBinaryPattern=file.read }
|
||||
testBinaryPattern *= 4
|
||||
|
||||
File.open("data/generated/longBinary.bin", "wb") {
|
||||
|file|
|
||||
while (file.tell < 3E5)
|
||||
file << testBinaryPattern << rand
|
||||
end
|
||||
}
|
||||
raise "failed to create test zip '#{TEST_ZIP2.zip_name}'" unless
|
||||
system("zip #{TEST_ZIP2.zip_name} #{TEST_ZIP2.entry_names.join(' ')}")
|
||||
|
||||
# without bash system interprets everything after echo as parameters to
|
||||
# echo including | zip -z ...
|
||||
raise "failed to add comment to test zip '#{TEST_ZIP2.zip_name}'" unless
|
||||
system("bash -c \"echo #{TEST_ZIP2.comment} | zip -z #{TEST_ZIP2.zip_name}\"")
|
||||
|
||||
raise "failed to create test zip '#{TEST_ZIP3.zip_name}'" unless
|
||||
system("zip #{TEST_ZIP3.zip_name} #{TEST_ZIP3.entry_names.join(' ')}")
|
||||
|
||||
raise "failed to create test zip '#{TEST_ZIP4.zip_name}'" unless
|
||||
system("zip #{TEST_ZIP4.zip_name} #{TEST_ZIP4.entry_names.join(' ')}")
|
||||
end
|
||||
rescue
|
||||
raise $!.to_s +
|
||||
"\n\nziptest.rb requires the Info-ZIP program 'zip' in the path\n" +
|
||||
"to create test data. If you don't have it you can download\n" +
|
||||
"the necessary test files at http://sf.net/projects/rubyzip."
|
||||
end
|
||||
|
||||
TEST_ZIP1 = TestZipFile.new("data/generated/empty.zip", [])
|
||||
TEST_ZIP2 = TestZipFile.new("data/generated/4entry.zip", %w{ data/generated/longAscii.txt data/generated/empty.txt data/generated/short.txt data/generated/longBinary.bin},
|
||||
"my zip comment")
|
||||
TEST_ZIP3 = TestZipFile.new("data/generated/test1.zip", %w{ data/file1.txt })
|
||||
TEST_ZIP4 = TestZipFile.new("data/generated/zipWithDir.zip", [ "data/file1.txt",
|
||||
TestFiles::EMPTY_TEST_DIR])
|
||||
end
|
||||
|
||||
|
||||
END {
|
||||
TestFiles::create_test_files(ARGV.index("recreate") != nil ||
|
||||
ARGV.index("recreateonly") != nil)
|
||||
TestZipFile::create_test_zips(ARGV.index("recreate") != nil ||
|
||||
ARGV.index("recreateonly") != nil)
|
||||
exit if ARGV.index("recreateonly") != nil
|
||||
}
|
74
vendor/rubyzip-0.5.6/test/ioextrastest.rb → vendor/rubyzip-0.5.8/test/ioextrastest.rb
vendored
Executable file → Normal file
74
vendor/rubyzip-0.5.6/test/ioextrastest.rb → vendor/rubyzip-0.5.8/test/ioextrastest.rb
vendored
Executable file → Normal file
|
@ -2,14 +2,14 @@
|
|||
|
||||
$VERBOSE = true
|
||||
|
||||
$: << ".."
|
||||
$: << "../lib"
|
||||
|
||||
require 'rubyunit'
|
||||
require 'test/unit'
|
||||
require 'zip/ioextras'
|
||||
|
||||
include IOExtras
|
||||
|
||||
class FakeIOTest < RUNIT::TestCase
|
||||
class FakeIOTest < Test::Unit::TestCase
|
||||
class FakeIOUsingClass
|
||||
include FakeIO
|
||||
end
|
||||
|
@ -25,7 +25,7 @@ class FakeIOTest < RUNIT::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class AbstractInputStreamTest < RUNIT::TestCase
|
||||
class AbstractInputStreamTest < Test::Unit::TestCase
|
||||
# AbstractInputStream subclass that provides a read method
|
||||
|
||||
TEST_LINES = [ "Hello world#{$/}",
|
||||
|
@ -60,32 +60,32 @@ class AbstractInputStreamTest < RUNIT::TestCase
|
|||
end
|
||||
|
||||
def test_gets
|
||||
assert_equals(TEST_LINES[0], @io.gets)
|
||||
assert_equals(1, @io.lineno)
|
||||
assert_equals(TEST_LINES[1], @io.gets)
|
||||
assert_equals(2, @io.lineno)
|
||||
assert_equals(TEST_LINES[2], @io.gets)
|
||||
assert_equals(3, @io.lineno)
|
||||
assert_equals(nil, @io.gets)
|
||||
assert_equals(4, @io.lineno)
|
||||
assert_equal(TEST_LINES[0], @io.gets)
|
||||
assert_equal(1, @io.lineno)
|
||||
assert_equal(TEST_LINES[1], @io.gets)
|
||||
assert_equal(2, @io.lineno)
|
||||
assert_equal(TEST_LINES[2], @io.gets)
|
||||
assert_equal(3, @io.lineno)
|
||||
assert_equal(nil, @io.gets)
|
||||
assert_equal(4, @io.lineno)
|
||||
end
|
||||
|
||||
def test_getsMultiCharSeperator
|
||||
assert_equals("Hell", @io.gets("ll"))
|
||||
assert_equals("o world#{$/}this is the second l", @io.gets("d l"))
|
||||
assert_equal("Hell", @io.gets("ll"))
|
||||
assert_equal("o world#{$/}this is the second l", @io.gets("d l"))
|
||||
end
|
||||
|
||||
def test_each_line
|
||||
lineNumber=0
|
||||
@io.each_line {
|
||||
|line|
|
||||
assert_equals(TEST_LINES[lineNumber], line)
|
||||
assert_equal(TEST_LINES[lineNumber], line)
|
||||
lineNumber+=1
|
||||
}
|
||||
end
|
||||
|
||||
def test_readlines
|
||||
assert_equals(TEST_LINES, @io.readlines)
|
||||
assert_equal(TEST_LINES, @io.readlines)
|
||||
end
|
||||
|
||||
def test_readline
|
||||
|
@ -98,7 +98,7 @@ class AbstractInputStreamTest < RUNIT::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
class AbstractOutputStreamTest < RUNIT::TestCase
|
||||
class AbstractOutputStreamTest < Test::Unit::TestCase
|
||||
class TestOutputStream
|
||||
include AbstractOutputStream
|
||||
|
||||
|
@ -128,77 +128,77 @@ class AbstractOutputStreamTest < RUNIT::TestCase
|
|||
|
||||
def test_write
|
||||
count = @outputStream.write("a little string")
|
||||
assert_equals("a little string", @outputStream.buffer)
|
||||
assert_equals("a little string".length, count)
|
||||
assert_equal("a little string", @outputStream.buffer)
|
||||
assert_equal("a little string".length, count)
|
||||
|
||||
count = @outputStream.write(". a little more")
|
||||
assert_equals("a little string. a little more", @outputStream.buffer)
|
||||
assert_equals(". a little more".length, count)
|
||||
assert_equal("a little string. a little more", @outputStream.buffer)
|
||||
assert_equal(". a little more".length, count)
|
||||
end
|
||||
|
||||
def test_print
|
||||
$\ = nil # record separator set to nil
|
||||
@outputStream.print("hello")
|
||||
assert_equals("hello", @outputStream.buffer)
|
||||
assert_equal("hello", @outputStream.buffer)
|
||||
|
||||
@outputStream.print(" world.")
|
||||
assert_equals("hello world.", @outputStream.buffer)
|
||||
assert_equal("hello world.", @outputStream.buffer)
|
||||
|
||||
@outputStream.print(" You ok ", "out ", "there?")
|
||||
assert_equals("hello world. You ok out there?", @outputStream.buffer)
|
||||
assert_equal("hello world. You ok out there?", @outputStream.buffer)
|
||||
|
||||
$\ = "\n"
|
||||
@outputStream.print
|
||||
assert_equals("hello world. You ok out there?\n", @outputStream.buffer)
|
||||
assert_equal("hello world. You ok out there?\n", @outputStream.buffer)
|
||||
|
||||
@outputStream.print("I sure hope so!")
|
||||
assert_equals("hello world. You ok out there?\nI sure hope so!\n", @outputStream.buffer)
|
||||
assert_equal("hello world. You ok out there?\nI sure hope so!\n", @outputStream.buffer)
|
||||
|
||||
$, = "X"
|
||||
@outputStream.buffer = ""
|
||||
@outputStream.print("monkey", "duck", "zebra")
|
||||
assert_equals("monkeyXduckXzebra\n", @outputStream.buffer)
|
||||
assert_equal("monkeyXduckXzebra\n", @outputStream.buffer)
|
||||
|
||||
$\ = nil
|
||||
@outputStream.buffer = ""
|
||||
@outputStream.print(20)
|
||||
assert_equals("20", @outputStream.buffer)
|
||||
assert_equal("20", @outputStream.buffer)
|
||||
end
|
||||
|
||||
def test_printf
|
||||
@outputStream.printf("%d %04x", 123, 123)
|
||||
assert_equals("123 007b", @outputStream.buffer)
|
||||
assert_equal("123 007b", @outputStream.buffer)
|
||||
end
|
||||
|
||||
def test_putc
|
||||
@outputStream.putc("A")
|
||||
assert_equals("A", @outputStream.buffer)
|
||||
assert_equal("A", @outputStream.buffer)
|
||||
@outputStream.putc(65)
|
||||
assert_equals("AA", @outputStream.buffer)
|
||||
assert_equal("AA", @outputStream.buffer)
|
||||
end
|
||||
|
||||
def test_puts
|
||||
@outputStream.puts
|
||||
assert_equals("\n", @outputStream.buffer)
|
||||
assert_equal("\n", @outputStream.buffer)
|
||||
|
||||
@outputStream.puts("hello", "world")
|
||||
assert_equals("\nhello\nworld\n", @outputStream.buffer)
|
||||
assert_equal("\nhello\nworld\n", @outputStream.buffer)
|
||||
|
||||
@outputStream.buffer = ""
|
||||
@outputStream.puts("hello\n", "world\n")
|
||||
assert_equals("hello\nworld\n", @outputStream.buffer)
|
||||
assert_equal("hello\nworld\n", @outputStream.buffer)
|
||||
|
||||
@outputStream.buffer = ""
|
||||
@outputStream.puts(["hello\n", "world\n"])
|
||||
assert_equals("hello\nworld\n", @outputStream.buffer)
|
||||
assert_equal("hello\nworld\n", @outputStream.buffer)
|
||||
|
||||
@outputStream.buffer = ""
|
||||
@outputStream.puts(["hello\n", "world\n"], "bingo")
|
||||
assert_equals("hello\nworld\nbingo\n", @outputStream.buffer)
|
||||
assert_equal("hello\nworld\nbingo\n", @outputStream.buffer)
|
||||
|
||||
@outputStream.buffer = ""
|
||||
@outputStream.puts(16, 20, 50, "hello")
|
||||
assert_equals("16\n20\n50\nhello\n", @outputStream.buffer)
|
||||
assert_equal("16\n20\n50\nhello\n", @outputStream.buffer)
|
||||
end
|
||||
end
|
||||
|
20
vendor/rubyzip-0.5.6/test/stdrubyexttest.rb → vendor/rubyzip-0.5.8/test/stdrubyexttest.rb
vendored
Executable file → Normal file
20
vendor/rubyzip-0.5.6/test/stdrubyexttest.rb → vendor/rubyzip-0.5.8/test/stdrubyexttest.rb
vendored
Executable file → Normal file
|
@ -2,20 +2,20 @@
|
|||
|
||||
$VERBOSE = true
|
||||
|
||||
$: << ".."
|
||||
$: << "../lib"
|
||||
|
||||
require 'rubyunit'
|
||||
require 'test/unit'
|
||||
require 'zip/stdrubyext'
|
||||
|
||||
class ModuleTest < RUNIT::TestCase
|
||||
class ModuleTest < Test::Unit::TestCase
|
||||
|
||||
def test_select_map
|
||||
assert_equals([2, 4, 8, 10], [1, 2, 3, 4, 5].select_map { |e| e == 3 ? nil : 2*e })
|
||||
assert_equal([2, 4, 8, 10], [1, 2, 3, 4, 5].select_map { |e| e == 3 ? nil : 2*e })
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class StringExtensionsTest < RUNIT::TestCase
|
||||
class StringExtensionsTest < Test::Unit::TestCase
|
||||
|
||||
def test_starts_with
|
||||
assert("hello".starts_with(""))
|
||||
|
@ -24,7 +24,7 @@ class StringExtensionsTest < RUNIT::TestCase
|
|||
assert(! "hello".starts_with("hello there"))
|
||||
assert(! "hello".starts_with(" he"))
|
||||
|
||||
assert_exception(TypeError, "type mismatch: NilClass given") {
|
||||
assert_raise(TypeError, "type mismatch: NilClass given") {
|
||||
"hello".starts_with(nil)
|
||||
}
|
||||
end
|
||||
|
@ -40,10 +40,10 @@ class StringExtensionsTest < RUNIT::TestCase
|
|||
end
|
||||
|
||||
def test_ensure_end
|
||||
assert_equals("hello!", "hello!".ensure_end("!"))
|
||||
assert_equals("hello!", "hello!".ensure_end("o!"))
|
||||
assert_equals("hello!", "hello".ensure_end("!"))
|
||||
assert_equals("hello!", "hel".ensure_end("lo!"))
|
||||
assert_equal("hello!", "hello!".ensure_end("!"))
|
||||
assert_equal("hello!", "hello!".ensure_end("o!"))
|
||||
assert_equal("hello!", "hello".ensure_end("!"))
|
||||
assert_equal("hello!", "hel".ensure_end("lo!"))
|
||||
end
|
||||
end
|
||||
|
270
vendor/rubyzip-0.5.6/test/zipfilesystemtest.rb → vendor/rubyzip-0.5.8/test/zipfilesystemtest.rb
vendored
Executable file → Normal file
270
vendor/rubyzip-0.5.6/test/zipfilesystemtest.rb → vendor/rubyzip-0.5.8/test/zipfilesystemtest.rb
vendored
Executable file → Normal file
|
@ -2,10 +2,10 @@
|
|||
|
||||
$VERBOSE = true
|
||||
|
||||
$: << ".."
|
||||
$: << "../lib"
|
||||
|
||||
require 'zip/zipfilesystem'
|
||||
require 'rubyunit'
|
||||
require 'test/unit'
|
||||
|
||||
module ExtraAssertions
|
||||
|
||||
|
@ -20,8 +20,8 @@ module ExtraAssertions
|
|||
end
|
||||
end_eval
|
||||
|
||||
assert_equals(retVal, yield) # Invoke test
|
||||
assert_equals(expectedArgs, callArgs)
|
||||
assert_equal(retVal, yield) # Invoke test
|
||||
assert_equal(expectedArgs, callArgs)
|
||||
ensure
|
||||
anObject.instance_eval "alias #{method} #{method}_org"
|
||||
end
|
||||
|
@ -30,9 +30,9 @@ end
|
|||
|
||||
include Zip
|
||||
|
||||
class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
||||
class ZipFsFileNonmutatingTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@zipFile = ZipFile.new("zipWithDirs.zip")
|
||||
@zipFile = ZipFile.new("data/zipWithDirs.zip")
|
||||
end
|
||||
|
||||
def teardown
|
||||
|
@ -40,7 +40,7 @@ class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
|||
end
|
||||
|
||||
def test_umask
|
||||
assert_equals(File.umask, @zipFile.file.umask)
|
||||
assert_equal(File.umask, @zipFile.file.umask)
|
||||
@zipFile.file.umask(0006)
|
||||
end
|
||||
|
||||
|
@ -62,7 +62,7 @@ class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
|||
@zipFile.file.open("file1", "r") {
|
||||
|f|
|
||||
blockCalled = true
|
||||
assert_equals("this is the entry 'file1' in my test archive!",
|
||||
assert_equal("this is the entry 'file1' in my test archive!",
|
||||
f.readline.chomp)
|
||||
}
|
||||
assert(blockCalled)
|
||||
|
@ -72,19 +72,19 @@ class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
|||
@zipFile.file.open("file21", "r") {
|
||||
|f|
|
||||
blockCalled = true
|
||||
assert_equals("this is the entry 'dir2/file21' in my test archive!",
|
||||
assert_equal("this is the entry 'dir2/file21' in my test archive!",
|
||||
f.readline.chomp)
|
||||
}
|
||||
assert(blockCalled)
|
||||
@zipFile.dir.chdir "/"
|
||||
|
||||
assert_exception(Errno::ENOENT) {
|
||||
assert_raise(Errno::ENOENT) {
|
||||
@zipFile.file.open("noSuchEntry")
|
||||
}
|
||||
|
||||
begin
|
||||
is = @zipFile.file.open("file1")
|
||||
assert_equals("this is the entry 'file1' in my test archive!",
|
||||
assert_equal("this is the entry 'file1' in my test archive!",
|
||||
is.readline.chomp)
|
||||
ensure
|
||||
is.close if is
|
||||
|
@ -94,7 +94,7 @@ class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
|||
def test_new
|
||||
begin
|
||||
is = @zipFile.file.new("file1")
|
||||
assert_equals("this is the entry 'file1' in my test archive!",
|
||||
assert_equal("this is the entry 'file1' in my test archive!",
|
||||
is.readline.chomp)
|
||||
ensure
|
||||
is.close if is
|
||||
|
@ -109,27 +109,27 @@ class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
|||
end
|
||||
|
||||
def test_symlink
|
||||
assert_exception(NotImplementedError) {
|
||||
assert_raise(NotImplementedError) {
|
||||
@zipFile.file.symlink("file1", "aSymlink")
|
||||
}
|
||||
end
|
||||
|
||||
def test_size
|
||||
assert_exception(Errno::ENOENT) { @zipFile.file.size("notAFile") }
|
||||
assert_equals(72, @zipFile.file.size("file1"))
|
||||
assert_equals(0, @zipFile.file.size("dir2/dir21"))
|
||||
assert_raise(Errno::ENOENT) { @zipFile.file.size("notAFile") }
|
||||
assert_equal(72, @zipFile.file.size("file1"))
|
||||
assert_equal(0, @zipFile.file.size("dir2/dir21"))
|
||||
|
||||
assert_equals(72, @zipFile.file.stat("file1").size)
|
||||
assert_equals(0, @zipFile.file.stat("dir2/dir21").size)
|
||||
assert_equal(72, @zipFile.file.stat("file1").size)
|
||||
assert_equal(0, @zipFile.file.stat("dir2/dir21").size)
|
||||
end
|
||||
|
||||
def test_size?
|
||||
assert_equals(nil, @zipFile.file.size?("notAFile"))
|
||||
assert_equals(72, @zipFile.file.size?("file1"))
|
||||
assert_equals(nil, @zipFile.file.size?("dir2/dir21"))
|
||||
assert_equal(nil, @zipFile.file.size?("notAFile"))
|
||||
assert_equal(72, @zipFile.file.size?("file1"))
|
||||
assert_equal(nil, @zipFile.file.size?("dir2/dir21"))
|
||||
|
||||
assert_equals(72, @zipFile.file.stat("file1").size?)
|
||||
assert_equals(nil, @zipFile.file.stat("dir2/dir21").size?)
|
||||
assert_equal(72, @zipFile.file.stat("file1").size?)
|
||||
assert_equal(nil, @zipFile.file.stat("dir2/dir21").size?)
|
||||
end
|
||||
|
||||
|
||||
|
@ -166,19 +166,19 @@ class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
|||
end
|
||||
|
||||
def test_join
|
||||
assert_equals("a/b/c", @zipFile.file.join("a/b", "c"))
|
||||
assert_equals("a/b/c/d", @zipFile.file.join("a/b", "c/d"))
|
||||
assert_equals("/c/d", @zipFile.file.join("", "c/d"))
|
||||
assert_equals("a/b/c/d", @zipFile.file.join("a", "b", "c", "d"))
|
||||
assert_equal("a/b/c", @zipFile.file.join("a/b", "c"))
|
||||
assert_equal("a/b/c/d", @zipFile.file.join("a/b", "c/d"))
|
||||
assert_equal("/c/d", @zipFile.file.join("", "c/d"))
|
||||
assert_equal("a/b/c/d", @zipFile.file.join("a", "b", "c", "d"))
|
||||
end
|
||||
|
||||
def test_utime
|
||||
t_now = Time.now
|
||||
t_bak = @zipFile.file.mtime("file1")
|
||||
@zipFile.file.utime(t_now, "file1")
|
||||
assert_equals(t_now, @zipFile.file.mtime("file1"))
|
||||
assert_equal(t_now, @zipFile.file.mtime("file1"))
|
||||
@zipFile.file.utime(t_bak, "file1")
|
||||
assert_equals(t_bak, @zipFile.file.mtime("file1"))
|
||||
assert_equal(t_bak, @zipFile.file.mtime("file1"))
|
||||
end
|
||||
|
||||
|
||||
|
@ -219,26 +219,26 @@ class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
|||
end
|
||||
|
||||
def test_truncate
|
||||
assert_exception(StandardError, "truncate not supported") {
|
||||
assert_raise(StandardError, "truncate not supported") {
|
||||
@zipFile.file.truncate("file1", 100)
|
||||
}
|
||||
end
|
||||
|
||||
def assert_e_n_o_e_n_t(operation, args = ["NoSuchFile"])
|
||||
assert_exception(Errno::ENOENT) {
|
||||
assert_raise(Errno::ENOENT) {
|
||||
@zipFile.file.send(operation, *args)
|
||||
}
|
||||
end
|
||||
|
||||
def test_ftype
|
||||
assert_e_n_o_e_n_t(:ftype)
|
||||
assert_equals("file", @zipFile.file.ftype("file1"))
|
||||
assert_equals("directory", @zipFile.file.ftype("dir1/dir11"))
|
||||
assert_equals("directory", @zipFile.file.ftype("dir1/dir11/"))
|
||||
assert_equal("file", @zipFile.file.ftype("file1"))
|
||||
assert_equal("directory", @zipFile.file.ftype("dir1/dir11"))
|
||||
assert_equal("directory", @zipFile.file.ftype("dir1/dir11/"))
|
||||
end
|
||||
|
||||
def test_link
|
||||
assert_exception(NotImplementedError) {
|
||||
assert_raise(NotImplementedError) {
|
||||
@zipFile.file.link("file1", "someOtherString")
|
||||
}
|
||||
end
|
||||
|
@ -259,10 +259,10 @@ class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
|||
end
|
||||
|
||||
def test_chown
|
||||
assert_equals(2, @zipFile.file.chown(1,2, "dir1", "file1"))
|
||||
assert_equals(1, @zipFile.file.stat("dir1").uid)
|
||||
assert_equals(2, @zipFile.file.stat("dir1").gid)
|
||||
assert_equals(2, @zipFile.file.chown(nil, nil, "dir1", "file1"))
|
||||
assert_equal(2, @zipFile.file.chown(1,2, "dir1", "file1"))
|
||||
assert_equal(1, @zipFile.file.stat("dir1").uid)
|
||||
assert_equal(2, @zipFile.file.stat("dir1").gid)
|
||||
assert_equal(2, @zipFile.file.chown(nil, nil, "dir1", "file1"))
|
||||
end
|
||||
|
||||
def test_zero?
|
||||
|
@ -270,48 +270,48 @@ class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
|||
assert(! @zipFile.file.zero?("file1"))
|
||||
assert(@zipFile.file.zero?("dir1"))
|
||||
blockCalled = false
|
||||
ZipFile.open("4entry.zip") {
|
||||
ZipFile.open("data/generated/4entry.zip") {
|
||||
|zf|
|
||||
blockCalled = true
|
||||
assert(zf.file.zero?("empty.txt"))
|
||||
assert(zf.file.zero?("data/generated/empty.txt"))
|
||||
}
|
||||
assert(blockCalled)
|
||||
|
||||
assert(! @zipFile.file.stat("file1").zero?)
|
||||
assert(@zipFile.file.stat("dir1").zero?)
|
||||
blockCalled = false
|
||||
ZipFile.open("4entry.zip") {
|
||||
ZipFile.open("data/generated/4entry.zip") {
|
||||
|zf|
|
||||
blockCalled = true
|
||||
assert(zf.file.stat("empty.txt").zero?)
|
||||
assert(zf.file.stat("data/generated/empty.txt").zero?)
|
||||
}
|
||||
assert(blockCalled)
|
||||
end
|
||||
|
||||
def test_expand_path
|
||||
ZipFile.open("zipWithDirs.zip") {
|
||||
ZipFile.open("data/zipWithDirs.zip") {
|
||||
|zf|
|
||||
assert_equals("/", zf.file.expand_path("."))
|
||||
assert_equal("/", zf.file.expand_path("."))
|
||||
zf.dir.chdir "dir1"
|
||||
assert_equals("/dir1", zf.file.expand_path("."))
|
||||
assert_equals("/dir1/file12", zf.file.expand_path("file12"))
|
||||
assert_equals("/", zf.file.expand_path(".."))
|
||||
assert_equals("/dir2/dir21", zf.file.expand_path("../dir2/dir21"))
|
||||
assert_equal("/dir1", zf.file.expand_path("."))
|
||||
assert_equal("/dir1/file12", zf.file.expand_path("file12"))
|
||||
assert_equal("/", zf.file.expand_path(".."))
|
||||
assert_equal("/dir2/dir21", zf.file.expand_path("../dir2/dir21"))
|
||||
}
|
||||
end
|
||||
|
||||
def test_mtime
|
||||
assert_equals(Time.at(1027694306),
|
||||
assert_equal(Time.at(1027694306),
|
||||
@zipFile.file.mtime("dir2/file21"))
|
||||
assert_equals(Time.at(1027690863),
|
||||
assert_equal(Time.at(1027690863),
|
||||
@zipFile.file.mtime("dir2/dir21"))
|
||||
assert_exception(Errno::ENOENT) {
|
||||
assert_raise(Errno::ENOENT) {
|
||||
@zipFile.file.mtime("noSuchEntry")
|
||||
}
|
||||
|
||||
assert_equals(Time.at(1027694306),
|
||||
assert_equal(Time.at(1027694306),
|
||||
@zipFile.file.stat("dir2/file21").mtime)
|
||||
assert_equals(Time.at(1027690863),
|
||||
assert_equal(Time.at(1027690863),
|
||||
@zipFile.file.stat("dir2/dir21").mtime)
|
||||
end
|
||||
|
||||
|
@ -394,7 +394,7 @@ class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
|||
end
|
||||
|
||||
def test_readlink
|
||||
assert_exception(NotImplementedError) {
|
||||
assert_raise(NotImplementedError) {
|
||||
@zipFile.file.readlink("someString")
|
||||
}
|
||||
end
|
||||
|
@ -402,7 +402,7 @@ class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
|||
def test_stat
|
||||
s = @zipFile.file.stat("file1")
|
||||
assert(s.kind_of?(File::Stat)) # It pretends
|
||||
assert_exception(Errno::ENOENT, "No such file or directory - noSuchFile") {
|
||||
assert_raise(Errno::ENOENT, "No such file or directory - noSuchFile") {
|
||||
@zipFile.file.stat("noSuchFile")
|
||||
}
|
||||
end
|
||||
|
@ -413,50 +413,50 @@ class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
|||
|
||||
|
||||
def test_chmod
|
||||
assert_exception(Errno::ENOENT, "No such file or directory - noSuchFile") {
|
||||
assert_raise(Errno::ENOENT, "No such file or directory - noSuchFile") {
|
||||
@zipFile.file.chmod(0644, "file1", "NoSuchFile")
|
||||
}
|
||||
assert_equals(2, @zipFile.file.chmod(0644, "file1", "dir1"))
|
||||
assert_equal(2, @zipFile.file.chmod(0644, "file1", "dir1"))
|
||||
end
|
||||
|
||||
def test_pipe
|
||||
assert_exception(NotImplementedError) {
|
||||
assert_raise(NotImplementedError) {
|
||||
@zipFile.file.pipe
|
||||
}
|
||||
end
|
||||
|
||||
def test_foreach
|
||||
ZipFile.open("zipWithDir.zip") {
|
||||
ZipFile.open("data/generated/zipWithDir.zip") {
|
||||
|zf|
|
||||
ref = []
|
||||
File.foreach("file1.txt") { |e| ref << e }
|
||||
File.foreach("data/file1.txt") { |e| ref << e }
|
||||
|
||||
index = 0
|
||||
zf.file.foreach("file1.txt") {
|
||||
zf.file.foreach("data/file1.txt") {
|
||||
|l|
|
||||
assert_equals(ref[index], l)
|
||||
assert_equal(ref[index], l)
|
||||
index = index.next
|
||||
}
|
||||
assert_equals(ref.size, index)
|
||||
assert_equal(ref.size, index)
|
||||
}
|
||||
|
||||
ZipFile.open("zipWithDir.zip") {
|
||||
ZipFile.open("data/generated/zipWithDir.zip") {
|
||||
|zf|
|
||||
ref = []
|
||||
File.foreach("file1.txt", " ") { |e| ref << e }
|
||||
File.foreach("data/file1.txt", " ") { |e| ref << e }
|
||||
|
||||
index = 0
|
||||
zf.file.foreach("file1.txt", " ") {
|
||||
zf.file.foreach("data/file1.txt", " ") {
|
||||
|l|
|
||||
assert_equals(ref[index], l)
|
||||
assert_equal(ref[index], l)
|
||||
index = index.next
|
||||
}
|
||||
assert_equals(ref.size, index)
|
||||
assert_equal(ref.size, index)
|
||||
}
|
||||
end
|
||||
|
||||
def test_popen
|
||||
assert_equals(File.popen("ls") { |f| f.read },
|
||||
assert_equal(File.popen("ls") { |f| f.read },
|
||||
@zipFile.file.popen("ls") { |f| f.read })
|
||||
end
|
||||
|
||||
|
@ -466,27 +466,27 @@ class ZipFsFileNonmutatingTest < RUNIT::TestCase
|
|||
# end
|
||||
|
||||
def test_readlines
|
||||
ZipFile.open("zipWithDir.zip") {
|
||||
ZipFile.open("data/generated/zipWithDir.zip") {
|
||||
|zf|
|
||||
assert_equals(File.readlines("file1.txt"),
|
||||
zf.file.readlines("file1.txt"))
|
||||
assert_equal(File.readlines("data/file1.txt"),
|
||||
zf.file.readlines("data/file1.txt"))
|
||||
}
|
||||
end
|
||||
|
||||
def test_read
|
||||
ZipFile.open("zipWithDir.zip") {
|
||||
ZipFile.open("data/generated/zipWithDir.zip") {
|
||||
|zf|
|
||||
assert_equals(File.read("file1.txt"),
|
||||
zf.file.read("file1.txt"))
|
||||
assert_equal(File.read("data/file1.txt"),
|
||||
zf.file.read("data/file1.txt"))
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class ZipFsFileStatTest < RUNIT::TestCase
|
||||
class ZipFsFileStatTest < Test::Unit::TestCase
|
||||
|
||||
def setup
|
||||
@zipFile = ZipFile.new("zipWithDirs.zip")
|
||||
@zipFile = ZipFile.new("data/zipWithDirs.zip")
|
||||
end
|
||||
|
||||
def teardown
|
||||
|
@ -494,51 +494,51 @@ class ZipFsFileStatTest < RUNIT::TestCase
|
|||
end
|
||||
|
||||
def test_blocks
|
||||
assert_equals(nil, @zipFile.file.stat("file1").blocks)
|
||||
assert_equal(nil, @zipFile.file.stat("file1").blocks)
|
||||
end
|
||||
|
||||
def test_ino
|
||||
assert_equals(0, @zipFile.file.stat("file1").ino)
|
||||
assert_equal(0, @zipFile.file.stat("file1").ino)
|
||||
end
|
||||
|
||||
def test_uid
|
||||
assert_equals(0, @zipFile.file.stat("file1").uid)
|
||||
assert_equal(0, @zipFile.file.stat("file1").uid)
|
||||
end
|
||||
|
||||
def test_gid
|
||||
assert_equals(0, @zipFile.file.stat("file1").gid)
|
||||
assert_equal(0, @zipFile.file.stat("file1").gid)
|
||||
end
|
||||
|
||||
def test_ftype
|
||||
assert_equals("file", @zipFile.file.stat("file1").ftype)
|
||||
assert_equals("directory", @zipFile.file.stat("dir1").ftype)
|
||||
assert_equal("file", @zipFile.file.stat("file1").ftype)
|
||||
assert_equal("directory", @zipFile.file.stat("dir1").ftype)
|
||||
end
|
||||
|
||||
def test_mode
|
||||
assert_equals(0600, @zipFile.file.stat("file1").mode & 0777)
|
||||
assert_equals(0600, @zipFile.file.stat("file1").mode & 0777)
|
||||
assert_equals(0755, @zipFile.file.stat("dir1").mode & 0777)
|
||||
assert_equals(0755, @zipFile.file.stat("dir1").mode & 0777)
|
||||
assert_equal(0600, @zipFile.file.stat("file1").mode & 0777)
|
||||
assert_equal(0600, @zipFile.file.stat("file1").mode & 0777)
|
||||
assert_equal(0755, @zipFile.file.stat("dir1").mode & 0777)
|
||||
assert_equal(0755, @zipFile.file.stat("dir1").mode & 0777)
|
||||
end
|
||||
|
||||
def test_dev
|
||||
assert_equals(0, @zipFile.file.stat("file1").dev)
|
||||
assert_equal(0, @zipFile.file.stat("file1").dev)
|
||||
end
|
||||
|
||||
def test_rdev
|
||||
assert_equals(0, @zipFile.file.stat("file1").rdev)
|
||||
assert_equal(0, @zipFile.file.stat("file1").rdev)
|
||||
end
|
||||
|
||||
def test_rdev_major
|
||||
assert_equals(0, @zipFile.file.stat("file1").rdev_major)
|
||||
assert_equal(0, @zipFile.file.stat("file1").rdev_major)
|
||||
end
|
||||
|
||||
def test_rdev_minor
|
||||
assert_equals(0, @zipFile.file.stat("file1").rdev_minor)
|
||||
assert_equal(0, @zipFile.file.stat("file1").rdev_minor)
|
||||
end
|
||||
|
||||
def test_nlink
|
||||
assert_equals(1, @zipFile.file.stat("file1").nlink)
|
||||
assert_equal(1, @zipFile.file.stat("file1").nlink)
|
||||
end
|
||||
|
||||
def test_blksize
|
||||
|
@ -547,10 +547,10 @@ class ZipFsFileStatTest < RUNIT::TestCase
|
|||
|
||||
end
|
||||
|
||||
class ZipFsFileMutatingTest < RUNIT::TestCase
|
||||
class ZipFsFileMutatingTest < Test::Unit::TestCase
|
||||
TEST_ZIP = "zipWithDirs_copy.zip"
|
||||
def setup
|
||||
File.copy("zipWithDirs.zip", TEST_ZIP)
|
||||
File.copy("data/zipWithDirs.zip", TEST_ZIP)
|
||||
end
|
||||
|
||||
def teardown
|
||||
|
@ -573,7 +573,7 @@ class ZipFsFileMutatingTest < RUNIT::TestCase
|
|||
blockCalled = true
|
||||
f.write "This is what I'm writing"
|
||||
}
|
||||
assert_equals("This is what I'm writing",
|
||||
assert_equal("This is what I'm writing",
|
||||
zf.file.read("test_open_write_entry"))
|
||||
|
||||
# Test with existing entry
|
||||
|
@ -582,7 +582,7 @@ class ZipFsFileMutatingTest < RUNIT::TestCase
|
|||
blockCalled = true
|
||||
f.write "This is what I'm writing too"
|
||||
}
|
||||
assert_equals("This is what I'm writing too",
|
||||
assert_equal("This is what I'm writing too",
|
||||
zf.file.read("file1"))
|
||||
}
|
||||
end
|
||||
|
@ -590,7 +590,7 @@ class ZipFsFileMutatingTest < RUNIT::TestCase
|
|||
def test_rename
|
||||
ZipFile.open(TEST_ZIP) {
|
||||
|zf|
|
||||
assert_exception(Errno::ENOENT, "") {
|
||||
assert_raise(Errno::ENOENT, "") {
|
||||
zf.file.rename("NoSuchFile", "bimse")
|
||||
}
|
||||
zf.file.rename("file1", "newNameForFile1")
|
||||
|
@ -616,9 +616,9 @@ class ZipFsFileMutatingTest < RUNIT::TestCase
|
|||
assert(! zf.file.exists?("dir1/file11"))
|
||||
assert(! zf.file.exists?("dir1/file12"))
|
||||
|
||||
assert_exception(Errno::ENOENT) { zf.file.send(symbol, "noSuchFile") }
|
||||
assert_exception(Errno::EISDIR) { zf.file.send(symbol, "dir1/dir11") }
|
||||
assert_exception(Errno::EISDIR) { zf.file.send(symbol, "dir1/dir11/") }
|
||||
assert_raise(Errno::ENOENT) { zf.file.send(symbol, "noSuchFile") }
|
||||
assert_raise(Errno::EISDIR) { zf.file.send(symbol, "dir1/dir11") }
|
||||
assert_raise(Errno::EISDIR) { zf.file.send(symbol, "dir1/dir11/") }
|
||||
}
|
||||
|
||||
ZipFile.open(TEST_ZIP) {
|
||||
|
@ -634,20 +634,20 @@ class ZipFsFileMutatingTest < RUNIT::TestCase
|
|||
|
||||
end
|
||||
|
||||
class ZipFsDirectoryTest < RUNIT::TestCase
|
||||
class ZipFsDirectoryTest < Test::Unit::TestCase
|
||||
TEST_ZIP = "zipWithDirs_copy.zip"
|
||||
|
||||
def setup
|
||||
File.copy("zipWithDirs.zip", TEST_ZIP)
|
||||
File.copy("data/zipWithDirs.zip", TEST_ZIP)
|
||||
end
|
||||
|
||||
def test_delete
|
||||
ZipFile.open(TEST_ZIP) {
|
||||
|zf|
|
||||
assert_exception(Errno::ENOENT, "No such file or directory - NoSuchFile.txt") {
|
||||
assert_raise(Errno::ENOENT, "No such file or directory - NoSuchFile.txt") {
|
||||
zf.dir.delete("NoSuchFile.txt")
|
||||
}
|
||||
assert_exception(Errno::EINVAL, "Invalid argument - file1") {
|
||||
assert_raise(Errno::EINVAL, "Invalid argument - file1") {
|
||||
zf.dir.delete("file1")
|
||||
}
|
||||
assert(zf.file.exists?("dir1"))
|
||||
|
@ -659,10 +659,10 @@ class ZipFsDirectoryTest < RUNIT::TestCase
|
|||
def test_mkdir
|
||||
ZipFile.open(TEST_ZIP) {
|
||||
|zf|
|
||||
assert_exception(Errno::EEXIST, "File exists - dir1") {
|
||||
assert_raise(Errno::EEXIST, "File exists - dir1") {
|
||||
zf.dir.mkdir("file1")
|
||||
}
|
||||
assert_exception(Errno::EEXIST, "File exists - dir1") {
|
||||
assert_raise(Errno::EEXIST, "File exists - dir1") {
|
||||
zf.dir.mkdir("dir1")
|
||||
}
|
||||
assert(!zf.file.exists?("newDir"))
|
||||
|
@ -677,24 +677,24 @@ class ZipFsDirectoryTest < RUNIT::TestCase
|
|||
def test_pwd_chdir_entries
|
||||
ZipFile.open(TEST_ZIP) {
|
||||
|zf|
|
||||
assert_equals("/", zf.dir.pwd)
|
||||
assert_equal("/", zf.dir.pwd)
|
||||
|
||||
assert_exception(Errno::ENOENT, "No such file or directory - no such dir") {
|
||||
assert_raise(Errno::ENOENT, "No such file or directory - no such dir") {
|
||||
zf.dir.chdir "no such dir"
|
||||
}
|
||||
|
||||
assert_exception(Errno::EINVAL, "Invalid argument - file1") {
|
||||
assert_raise(Errno::EINVAL, "Invalid argument - file1") {
|
||||
zf.dir.chdir "file1"
|
||||
}
|
||||
|
||||
assert_equals(["dir1", "dir2", "file1"].sort, zf.dir.entries(".").sort)
|
||||
assert_equal(["dir1", "dir2", "file1"].sort, zf.dir.entries(".").sort)
|
||||
zf.dir.chdir "dir1"
|
||||
assert_equals("/dir1", zf.dir.pwd)
|
||||
assert_equals(["dir11", "file11", "file12"], zf.dir.entries(".").sort)
|
||||
assert_equal("/dir1", zf.dir.pwd)
|
||||
assert_equal(["dir11", "file11", "file12"], zf.dir.entries(".").sort)
|
||||
|
||||
zf.dir.chdir "../dir2/dir21"
|
||||
assert_equals("/dir2/dir21", zf.dir.pwd)
|
||||
assert_equals(["dir221"].sort, zf.dir.entries(".").sort)
|
||||
assert_equal("/dir2/dir21", zf.dir.pwd)
|
||||
assert_equal(["dir221"].sort, zf.dir.entries(".").sort)
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -703,30 +703,30 @@ class ZipFsDirectoryTest < RUNIT::TestCase
|
|||
|zf|
|
||||
|
||||
blockCalled = false
|
||||
assert_exception(Errno::ENOENT, "No such file or directory - noSuchDir") {
|
||||
assert_raise(Errno::ENOENT, "No such file or directory - noSuchDir") {
|
||||
zf.dir.foreach("noSuchDir") { |e| blockCalled = true }
|
||||
}
|
||||
assert(! blockCalled)
|
||||
|
||||
assert_exception(Errno::ENOTDIR, "Not a directory - file1") {
|
||||
assert_raise(Errno::ENOTDIR, "Not a directory - file1") {
|
||||
zf.dir.foreach("file1") { |e| blockCalled = true }
|
||||
}
|
||||
assert(! blockCalled)
|
||||
|
||||
entries = []
|
||||
zf.dir.foreach(".") { |e| entries << e }
|
||||
assert_equals(["dir1", "dir2", "file1"].sort, entries.sort)
|
||||
assert_equal(["dir1", "dir2", "file1"].sort, entries.sort)
|
||||
|
||||
entries = []
|
||||
zf.dir.foreach("dir1") { |e| entries << e }
|
||||
assert_equals(["dir11", "file11", "file12"], entries.sort)
|
||||
assert_equal(["dir11", "file11", "file12"], entries.sort)
|
||||
}
|
||||
end
|
||||
|
||||
def test_chroot
|
||||
ZipFile.open(TEST_ZIP) {
|
||||
|zf|
|
||||
assert_exception(NotImplementedError) {
|
||||
assert_raise(NotImplementedError) {
|
||||
zf.dir.chroot
|
||||
}
|
||||
}
|
||||
|
@ -742,28 +742,28 @@ class ZipFsDirectoryTest < RUNIT::TestCase
|
|||
ZipFile.open(TEST_ZIP) {
|
||||
|zf|
|
||||
|
||||
assert_exception(Errno::ENOTDIR, "Not a directory - file1") {
|
||||
assert_raise(Errno::ENOTDIR, "Not a directory - file1") {
|
||||
zf.dir.new("file1")
|
||||
}
|
||||
|
||||
assert_exception(Errno::ENOENT, "No such file or directory - noSuchFile") {
|
||||
assert_raise(Errno::ENOENT, "No such file or directory - noSuchFile") {
|
||||
zf.dir.new("noSuchFile")
|
||||
}
|
||||
|
||||
d = zf.dir.new(".")
|
||||
assert_equals(["file1", "dir1", "dir2"].sort, d.entries.sort)
|
||||
assert_equal(["file1", "dir1", "dir2"].sort, d.entries.sort)
|
||||
d.close
|
||||
|
||||
zf.dir.open("dir1") {
|
||||
|d|
|
||||
assert_equals(["dir11", "file11", "file12"].sort, d.entries.sort)
|
||||
assert_equal(["dir11", "file11", "file12"].sort, d.entries.sort)
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class ZipFsDirIteratorTest < RUNIT::TestCase
|
||||
class ZipFsDirIteratorTest < Test::Unit::TestCase
|
||||
|
||||
FILENAME_ARRAY = [ "f1", "f2", "f3", "f4", "f5", "f6" ]
|
||||
|
||||
|
@ -773,19 +773,19 @@ class ZipFsDirIteratorTest < RUNIT::TestCase
|
|||
|
||||
def test_close
|
||||
@dirIt.close
|
||||
assert_exception(IOError, "closed directory") {
|
||||
assert_raise(IOError, "closed directory") {
|
||||
@dirIt.each { |e| p e }
|
||||
}
|
||||
assert_exception(IOError, "closed directory") {
|
||||
assert_raise(IOError, "closed directory") {
|
||||
@dirIt.read
|
||||
}
|
||||
assert_exception(IOError, "closed directory") {
|
||||
assert_raise(IOError, "closed directory") {
|
||||
@dirIt.rewind
|
||||
}
|
||||
assert_exception(IOError, "closed directory") {
|
||||
assert_raise(IOError, "closed directory") {
|
||||
@dirIt.seek(0)
|
||||
}
|
||||
assert_exception(IOError, "closed directory") {
|
||||
assert_raise(IOError, "closed directory") {
|
||||
@dirIt.tell
|
||||
}
|
||||
|
||||
|
@ -793,22 +793,22 @@ class ZipFsDirIteratorTest < RUNIT::TestCase
|
|||
|
||||
def test_each
|
||||
# Tested through Enumerable.entries
|
||||
assert_equals(FILENAME_ARRAY, @dirIt.entries)
|
||||
assert_equal(FILENAME_ARRAY, @dirIt.entries)
|
||||
end
|
||||
|
||||
def test_read
|
||||
FILENAME_ARRAY.size.times {
|
||||
|i|
|
||||
assert_equals(FILENAME_ARRAY[i], @dirIt.read)
|
||||
assert_equal(FILENAME_ARRAY[i], @dirIt.read)
|
||||
}
|
||||
end
|
||||
|
||||
def test_rewind
|
||||
@dirIt.read
|
||||
@dirIt.read
|
||||
assert_equals(FILENAME_ARRAY[2], @dirIt.read)
|
||||
assert_equal(FILENAME_ARRAY[2], @dirIt.read)
|
||||
@dirIt.rewind
|
||||
assert_equals(FILENAME_ARRAY[0], @dirIt.read)
|
||||
assert_equal(FILENAME_ARRAY[0], @dirIt.read)
|
||||
end
|
||||
|
||||
def test_tell_seek
|
||||
|
@ -818,7 +818,7 @@ class ZipFsDirIteratorTest < RUNIT::TestCase
|
|||
valAtPos = @dirIt.read
|
||||
@dirIt.read
|
||||
@dirIt.seek(pos)
|
||||
assert_equals(valAtPos, @dirIt.read)
|
||||
assert_equal(valAtPos, @dirIt.read)
|
||||
end
|
||||
|
||||
end
|
16
vendor/rubyzip-0.5.6/test/ziprequiretest.rb → vendor/rubyzip-0.5.8/test/ziprequiretest.rb
vendored
Executable file → Normal file
16
vendor/rubyzip-0.5.6/test/ziprequiretest.rb → vendor/rubyzip-0.5.8/test/ziprequiretest.rb
vendored
Executable file → Normal file
|
@ -2,17 +2,17 @@
|
|||
|
||||
$VERBOSE = true
|
||||
|
||||
$: << ".."
|
||||
$: << "../lib"
|
||||
|
||||
require 'rubyunit'
|
||||
require 'test/unit'
|
||||
require 'zip/ziprequire'
|
||||
|
||||
$: << 'rubycode.zip' << 'rubycode2.zip'
|
||||
$: << 'data/rubycode.zip' << 'data/rubycode2.zip'
|
||||
|
||||
class ZipRequireTest < RUNIT::TestCase
|
||||
class ZipRequireTest < Test::Unit::TestCase
|
||||
def test_require
|
||||
assert(require('notzippedruby'))
|
||||
assert(!require('notzippedruby'))
|
||||
assert(require('data/notzippedruby'))
|
||||
assert(!require('data/notzippedruby'))
|
||||
|
||||
assert(require('zippedruby1'))
|
||||
assert(!require('zippedruby1'))
|
||||
|
@ -27,13 +27,13 @@ class ZipRequireTest < RUNIT::TestCase
|
|||
assert(c1.returnTrue)
|
||||
assert(ZippedRuby1.returnTrue)
|
||||
assert(!ZippedRuby2.returnFalse)
|
||||
assert_equals(4, ZippedRuby3.multiplyValues(2, 2))
|
||||
assert_equal(4, ZippedRuby3.multiplyValues(2, 2))
|
||||
end
|
||||
|
||||
def test_get_resource
|
||||
get_resource("aResource.txt") {
|
||||
|f|
|
||||
assert_equals("Nothing exciting in this file!", f.read)
|
||||
assert_equal("Nothing exciting in this file!", f.read)
|
||||
}
|
||||
end
|
||||
end
|
537
vendor/rubyzip-0.5.6/test/ziptest.rb → vendor/rubyzip-0.5.8/test/ziptest.rb
vendored
Executable file → Normal file
537
vendor/rubyzip-0.5.6/test/ziptest.rb → vendor/rubyzip-0.5.8/test/ziptest.rb
vendored
Executable file → Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue