rubyzip 0.9.1 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubyzip might be problematic. Click here for more details.
- data/ChangeLog +92 -450
- data/NEWS +18 -0
- data/README +1 -1
- data/Rakefile +14 -13
- data/install.rb +4 -3
- data/lib/zip/ioextras.rb +11 -1
- data/lib/zip/stdrubyext.rb +0 -0
- data/lib/zip/tempfile_bugfixed.rb +0 -0
- data/lib/zip/zip.rb +57 -24
- data/lib/zip/zipfilesystem.rb +1 -0
- data/lib/zip/ziprequire.rb +0 -0
- data/samples/example.rb +0 -0
- data/samples/example_filesystem.rb +0 -1
- data/samples/gtkRubyzip.rb +0 -0
- data/samples/qtzip.rb +0 -0
- data/samples/write_simple.rb +0 -0
- data/samples/zipfind.rb +0 -0
- data/test/alltests.rb +0 -0
- data/test/data/notzippedruby.rb +0 -0
- data/test/gentestfiles.rb +0 -0
- data/test/ioextrastest.rb +0 -0
- data/test/stdrubyexttest.rb +0 -0
- data/test/zipfilesystemtest.rb +14 -4
- data/test/ziprequiretest.rb +0 -0
- data/test/ziptest.rb +30 -9
- metadata +76 -88
- data/lib/download_quizzes.rb +0 -119
- data/lib/quiz1/t/solutions/Bill Guindon/solitaire.rb +0 -205
- data/lib/quiz1/t/solutions/Carlos/solitaire.rb +0 -111
- data/lib/quiz1/t/solutions/Dennis Ranke/solitaire.rb +0 -111
- data/lib/quiz1/t/solutions/Florian Gross/solitaire.rb +0 -301
- data/lib/quiz1/t/solutions/Glen M. Lewis/solitaire.rb +0 -268
- data/lib/quiz1/t/solutions/James Edward Gray II/solitaire.rb +0 -132
- data/lib/quiz1/t/solutions/Jamis Buck/bin/main.rb +0 -13
- data/lib/quiz1/t/solutions/Jamis Buck/lib/cipher.rb +0 -230
- data/lib/quiz1/t/solutions/Jamis Buck/lib/cli.rb +0 -24
- data/lib/quiz1/t/solutions/Jamis Buck/test/tc_deck.rb +0 -30
- data/lib/quiz1/t/solutions/Jamis Buck/test/tc_key-stream.rb +0 -19
- data/lib/quiz1/t/solutions/Jamis Buck/test/tc_keying-algorithms.rb +0 -31
- data/lib/quiz1/t/solutions/Jamis Buck/test/tc_solitaire-cipher.rb +0 -66
- data/lib/quiz1/t/solutions/Jamis Buck/test/tc_unkeyed-algorithm.rb +0 -17
- data/lib/quiz1/t/solutions/Jamis Buck/test/tests.rb +0 -2
- data/lib/quiz1/t/solutions/Jim Menard/solitaire_cypher.rb +0 -204
- data/lib/quiz1/t/solutions/Jim Menard/test.rb +0 -47
- data/lib/quiz1/t/solutions/Moses Hohman/cipher.rb +0 -97
- data/lib/quiz1/t/solutions/Moses Hohman/deck.rb +0 -140
- data/lib/quiz1/t/solutions/Moses Hohman/solitaire.rb +0 -14
- data/lib/quiz1/t/solutions/Moses Hohman/test_cipher.rb +0 -68
- data/lib/quiz1/t/solutions/Moses Hohman/test_deck.rb +0 -146
- data/lib/quiz1/t/solutions/Moses Hohman/test_util.rb +0 -38
- data/lib/quiz1/t/solutions/Moses Hohman/testsuite.rb +0 -5
- data/lib/quiz1/t/solutions/Moses Hohman/util.rb +0 -27
- data/lib/quiz1/t/solutions/Niklas Frykholm/solitaire.rb +0 -151
- data/lib/quiz1/t/solutions/Thomas Leitner/solitaire.rb +0 -198
data/NEWS
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
= Version 0.9.4
|
2
|
+
|
3
|
+
Changed ZipOutputStream.put_next_entry signature (API CHANGE!). Now
|
4
|
+
allows comment, extra field and compression method to be specified.
|
5
|
+
|
6
|
+
= Version 0.9.3
|
7
|
+
|
8
|
+
Fixed: Added ZipEntry::name_encoding which retrieves the character
|
9
|
+
encoding of the name and comment of the entry. Also added convenience
|
10
|
+
methods ZipEntry::name_in(enc) and ZipEntry::comment_in(enc) for
|
11
|
+
getting zip entry names and comments in a specified character
|
12
|
+
encoding.
|
13
|
+
|
14
|
+
= Version 0.9.2
|
15
|
+
|
16
|
+
Fixed: Renaming an entry failed if the entry's new name was a
|
17
|
+
different length than its old name. (Diego Barros)
|
18
|
+
|
1
19
|
= Version 0.9.1
|
2
20
|
|
3
21
|
Added symlink support and support for unix file permissions. Reduced
|
data/README
CHANGED
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ require 'rake/packagetask'
|
|
7
7
|
require 'rake/gempackagetask'
|
8
8
|
require 'rake/rdoctask'
|
9
9
|
require 'rake/contrib/sshpublisher'
|
10
|
-
require 'net/
|
10
|
+
require 'net/sftp'
|
11
11
|
|
12
12
|
PKG_NAME = 'rubyzip'
|
13
13
|
PKG_VERSION = File.read('lib/zip/zip.rb').match(/\s+VERSION\s*=\s*'(.*)'/)[1]
|
@@ -32,6 +32,10 @@ clobberFromCvsIgnore 'samples'
|
|
32
32
|
clobberFromCvsIgnore 'test'
|
33
33
|
clobberFromCvsIgnore 'test/data'
|
34
34
|
|
35
|
+
def rsystem(cmd)
|
36
|
+
system(cmd) or raise "system command failed: '#{cmd}"
|
37
|
+
end
|
38
|
+
|
35
39
|
task :default => [:test]
|
36
40
|
|
37
41
|
desc "Run unit tests"
|
@@ -62,29 +66,26 @@ end
|
|
62
66
|
Rake::RDocTask.new do |rd|
|
63
67
|
rd.main = "README"
|
64
68
|
rd.rdoc_files.add %W{ lib/zip/*.rb README NEWS TODO ChangeLog }
|
65
|
-
rd.options << "
|
69
|
+
rd.options << "-t 'rubyzip documentation' --webcvs http://cvs.sourceforge.net/viewcvs.py/rubyzip/rubyzip/"
|
66
70
|
# rd.options << "--all"
|
67
71
|
end
|
68
72
|
|
69
73
|
desc "Publish documentation"
|
70
74
|
task :pdoc => [:rdoc] do
|
71
|
-
|
72
|
-
new("thomas@rubyzip.sourceforge.net", "/home/groups/r/ru/rubyzip/htdocs", "html").upload
|
75
|
+
rsystem("rsync -avz --delete html/* thomas,rubyzip@frs.sourceforge.net:/home/groups/r/ru/rubyzip/htdocs")
|
73
76
|
end
|
74
77
|
|
75
78
|
desc "Publish package"
|
76
79
|
task :ppackage => [:package] do
|
77
|
-
Net::
|
78
|
-
"ftp",
|
79
|
-
ENV['USER']+"@"+ENV['HOSTNAME']) {
|
80
|
+
Net::SFTP.start("frs.sourceforge.net", "thomas,rubyzip") do
|
80
81
|
|ftpclient|
|
81
|
-
|
82
|
-
ftpclient.
|
83
|
-
Dir['pkg/*.{tgz,zip,gem}'].each
|
82
|
+
releasedir = File.join("/home/pfs/project/r/ru/rubyzip/rubyzip", PKG_VERSION)
|
83
|
+
ftpclient.mkdir releasedir
|
84
|
+
Dir['pkg/*.{tgz,zip,gem}'].each do
|
84
85
|
|e|
|
85
|
-
ftpclient.
|
86
|
-
|
87
|
-
|
86
|
+
ftpclient.upload!(e, File.join(releasedir, File.basename(e)))
|
87
|
+
end
|
88
|
+
end
|
88
89
|
end
|
89
90
|
|
90
91
|
desc "Generate the ChangeLog file"
|
data/install.rb
CHANGED
@@ -4,19 +4,20 @@ $VERBOSE = true
|
|
4
4
|
|
5
5
|
require 'rbconfig'
|
6
6
|
require 'find'
|
7
|
-
require '
|
7
|
+
require 'fileutils'
|
8
8
|
|
9
9
|
include Config
|
10
10
|
|
11
11
|
files = %w{ stdrubyext.rb ioextras.rb zip.rb zipfilesystem.rb ziprequire.rb tempfile_bugfixed.rb }
|
12
12
|
|
13
13
|
INSTALL_DIR = File.join(CONFIG["sitelibdir"], "zip")
|
14
|
-
|
14
|
+
FileUtils.makedirs(INSTALL_DIR)
|
15
15
|
|
16
16
|
SOURCE_DIR = File.join(File.dirname($0), "lib/zip")
|
17
17
|
|
18
18
|
files.each {
|
19
19
|
|filename|
|
20
20
|
installPath = File.join(INSTALL_DIR, filename)
|
21
|
-
|
21
|
+
FileUtils::install(File.join(SOURCE_DIR, filename), installPath, 0644,
|
22
|
+
:verbose => true)
|
22
23
|
}
|
data/lib/zip/ioextras.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module IOExtras #:nodoc:
|
2
2
|
|
3
|
-
CHUNK_SIZE =
|
3
|
+
CHUNK_SIZE = 131072
|
4
4
|
|
5
5
|
RANGE_ALL = 0..-1
|
6
6
|
|
@@ -9,6 +9,16 @@ module IOExtras #:nodoc:
|
|
9
9
|
ostream.write(istream.read(CHUNK_SIZE, s)) until istream.eof?
|
10
10
|
end
|
11
11
|
|
12
|
+
def self.copy_stream_n(ostream, istream, nbytes)
|
13
|
+
s = ''
|
14
|
+
toread = nbytes
|
15
|
+
while (toread > 0 && ! istream.eof?)
|
16
|
+
tr = toread > CHUNK_SIZE ? CHUNK_SIZE : toread
|
17
|
+
ostream.write(istream.read(tr, s))
|
18
|
+
toread -= tr
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
12
22
|
|
13
23
|
# Implements kind_of? in order to pretend to be an IO object
|
14
24
|
module FakeIO
|
data/lib/zip/stdrubyext.rb
CHANGED
File without changes
|
File without changes
|
data/lib/zip/zip.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'delegate'
|
2
|
+
require 'iconv'
|
2
3
|
require 'singleton'
|
3
4
|
require 'tempfile'
|
4
|
-
require '
|
5
|
+
require 'fileutils'
|
5
6
|
require 'stringio'
|
6
7
|
require 'zlib'
|
7
8
|
require 'zip/stdrubyext'
|
@@ -20,7 +21,7 @@ end
|
|
20
21
|
|
21
22
|
module Zip
|
22
23
|
|
23
|
-
VERSION = '0.9.
|
24
|
+
VERSION = '0.9.4'
|
24
25
|
|
25
26
|
RUBY_MINOR_VERSION = RUBY_VERSION.split(".")[1].to_i
|
26
27
|
|
@@ -349,6 +350,21 @@ module Zip
|
|
349
350
|
|
350
351
|
attr_reader :ftype, :filepath # :nodoc:
|
351
352
|
|
353
|
+
# Returns the character encoding used for name and comment
|
354
|
+
def name_encoding
|
355
|
+
(@gp_flags & 0b100000000000) != 0 ? "utf8" : "CP437//"
|
356
|
+
end
|
357
|
+
|
358
|
+
# Returns the name in the encoding specified by enc
|
359
|
+
def name_in(enc)
|
360
|
+
Iconv.conv(enc, name_encoding, @name)
|
361
|
+
end
|
362
|
+
|
363
|
+
# Returns the name in the encoding specified by enc
|
364
|
+
def comment_in(enc)
|
365
|
+
Iconv.conv(enc, name_encoding, @name)
|
366
|
+
end
|
367
|
+
|
352
368
|
def initialize(zipfile = "", name = "", comment = "", extra = "",
|
353
369
|
compressed_size = 0, crc = 0,
|
354
370
|
compression_method = ZipEntry::DEFLATED, size = 0,
|
@@ -358,6 +374,7 @@ module Zip
|
|
358
374
|
raise ZipEntryNameError, "Illegal ZipEntry name '#{name}', name must not start with /"
|
359
375
|
end
|
360
376
|
@localHeaderOffset = 0
|
377
|
+
@local_header_size = 0
|
361
378
|
@internalFileAttributes = 1
|
362
379
|
@externalFileAttributes = 0
|
363
380
|
@version = 52 # this library's version
|
@@ -368,9 +385,14 @@ module Zip
|
|
368
385
|
else
|
369
386
|
@fstype = FSTYPE_UNIX
|
370
387
|
end
|
371
|
-
@zipfile
|
372
|
-
|
373
|
-
|
388
|
+
@zipfile = zipfile
|
389
|
+
@comment = comment
|
390
|
+
@compressed_size = compressed_size
|
391
|
+
@crc = crc
|
392
|
+
@extra = extra
|
393
|
+
@compression_method = compression_method
|
394
|
+
@name = name
|
395
|
+
@size = size
|
374
396
|
@time = time
|
375
397
|
|
376
398
|
@follow_symlinks = false
|
@@ -432,7 +454,7 @@ module Zip
|
|
432
454
|
# Returns +true+ if the entry is a symlink.
|
433
455
|
def symlink?
|
434
456
|
raise ZipInternalError, "current filetype is unknown: #{self.inspect}" unless @ftype
|
435
|
-
@ftype == :
|
457
|
+
@ftype == :symlink
|
436
458
|
end
|
437
459
|
|
438
460
|
def name_is_directory? #:nodoc:all
|
@@ -440,10 +462,10 @@ module Zip
|
|
440
462
|
end
|
441
463
|
|
442
464
|
def local_entry_offset #:nodoc:all
|
443
|
-
localHeaderOffset + local_header_size
|
465
|
+
localHeaderOffset + @local_header_size
|
444
466
|
end
|
445
467
|
|
446
|
-
def
|
468
|
+
def calculate_local_header_size #:nodoc:all
|
447
469
|
LOCAL_ENTRY_STATIC_HEADER_LENGTH + (@name ? @name.size : 0) + (@extra ? @extra.local_size : 0)
|
448
470
|
end
|
449
471
|
|
@@ -491,7 +513,8 @@ module Zip
|
|
491
513
|
LOCAL_ENTRY_SIGNATURE = 0x04034b50
|
492
514
|
LOCAL_ENTRY_STATIC_HEADER_LENGTH = 30
|
493
515
|
LOCAL_ENTRY_TRAILING_DESCRIPTOR_LENGTH = 4+4+4
|
494
|
-
|
516
|
+
VERSION_NEEDED_TO_EXTRACT = 10
|
517
|
+
|
495
518
|
def read_local_entry(io) #:nodoc:all
|
496
519
|
@localHeaderOffset = io.tell
|
497
520
|
staticSizedFieldsBuf = io.read(LOCAL_ENTRY_STATIC_HEADER_LENGTH)
|
@@ -516,6 +539,7 @@ module Zip
|
|
516
539
|
raise ZipError, "Zip local header magic not found at location '#{localHeaderOffset}'"
|
517
540
|
end
|
518
541
|
set_time(lastModDate, lastModTime)
|
542
|
+
|
519
543
|
|
520
544
|
@name = io.read(nameLength)
|
521
545
|
extra = io.read(extraLength)
|
@@ -529,6 +553,7 @@ module Zip
|
|
529
553
|
@extra = ZipExtraField.new(extra)
|
530
554
|
end
|
531
555
|
end
|
556
|
+
@local_header_size = calculate_local_header_size
|
532
557
|
end
|
533
558
|
|
534
559
|
def ZipEntry.read_local_entry(io)
|
@@ -544,7 +569,7 @@ module Zip
|
|
544
569
|
|
545
570
|
io <<
|
546
571
|
[LOCAL_ENTRY_SIGNATURE ,
|
547
|
-
|
572
|
+
VERSION_NEEDED_TO_EXTRACT , # version needed to extract
|
548
573
|
0 , # @gp_flags ,
|
549
574
|
@compression_method ,
|
550
575
|
@time.to_binary_dos_time , # @lastModTime ,
|
@@ -615,7 +640,7 @@ module Zip
|
|
615
640
|
when 010
|
616
641
|
@ftype = :file
|
617
642
|
when 012
|
618
|
-
@ftype = :
|
643
|
+
@ftype = :symlink
|
619
644
|
else
|
620
645
|
raise ZipInternalError, "unknown file type #{'0%o' % (@externalFileAttributes >> 28)}"
|
621
646
|
end
|
@@ -626,6 +651,7 @@ module Zip
|
|
626
651
|
@ftype = :file
|
627
652
|
end
|
628
653
|
end
|
654
|
+
@local_header_size = calculate_local_header_size
|
629
655
|
end
|
630
656
|
|
631
657
|
def ZipEntry.read_c_dir_entry(io) #:nodoc:all
|
@@ -662,8 +688,8 @@ module Zip
|
|
662
688
|
# ignore setuid/setgid bits by default. honor if @restore_ownership
|
663
689
|
unix_perms_mask = 01777
|
664
690
|
unix_perms_mask = 07777 if (@restore_ownership)
|
665
|
-
|
666
|
-
|
691
|
+
FileUtils::chmod(@unix_perms & unix_perms_mask, destPath) if (@restore_permissions && @unix_perms)
|
692
|
+
FileUtils::chown(@unix_uid, @unix_gid, destPath) if (@restore_ownership && @unix_uid && @unix_gid && Process::egid == 0)
|
667
693
|
# File::utimes()
|
668
694
|
end
|
669
695
|
end
|
@@ -693,7 +719,7 @@ module Zip
|
|
693
719
|
[CENTRAL_DIRECTORY_ENTRY_SIGNATURE,
|
694
720
|
@version , # version of encoding software
|
695
721
|
@fstype , # filesystem type
|
696
|
-
|
722
|
+
VERSION_NEEDED_TO_EXTRACT , # @versionNeededToExtract ,
|
697
723
|
0 , # @gp_flags ,
|
698
724
|
@compression_method ,
|
699
725
|
@time.to_binary_dos_time , # @lastModTime ,
|
@@ -849,7 +875,7 @@ module Zip
|
|
849
875
|
return
|
850
876
|
elsif File.exists? destPath
|
851
877
|
if block_given? && yield(self, destPath)
|
852
|
-
|
878
|
+
FileUtils::rm_f destPath
|
853
879
|
else
|
854
880
|
raise ZipDestinationFileExistsError,
|
855
881
|
"Cannot create directory '#{destPath}'. "+
|
@@ -951,11 +977,16 @@ module Zip
|
|
951
977
|
|
952
978
|
# Closes the current entry and opens a new for writing.
|
953
979
|
# +entry+ can be a ZipEntry object or a string.
|
954
|
-
def put_next_entry(
|
980
|
+
def put_next_entry(entryname, comment = nil, extra = nil, compression_method = ZipEntry::DEFLATED, level = Zlib::DEFAULT_COMPRESSION)
|
955
981
|
raise ZipError, "zip stream is closed" if @closed
|
956
|
-
|
957
|
-
|
958
|
-
|
982
|
+
new_entry = ZipEntry.new(@fileName, entryname.to_s)
|
983
|
+
new_entry.comment = comment if !comment.nil?
|
984
|
+
if (!extra.nil?)
|
985
|
+
new_entry.extra = ZipExtraField === extra ? extra : ZipExtraField.new(extra.to_s)
|
986
|
+
end
|
987
|
+
new_entry.compression_method = compression_method
|
988
|
+
init_next_entry(new_entry, level)
|
989
|
+
@currentEntry = new_entry
|
959
990
|
end
|
960
991
|
|
961
992
|
def copy_raw_entry(entry)
|
@@ -967,10 +998,10 @@ module Zip
|
|
967
998
|
src_pos = entry.local_entry_offset
|
968
999
|
entry.write_local_entry(@outputStream)
|
969
1000
|
@compressor = NullCompressor.instance
|
970
|
-
|
1001
|
+
entry.get_raw_input_stream {
|
971
1002
|
|is|
|
972
1003
|
is.seek(src_pos, IO::SEEK_SET)
|
973
|
-
|
1004
|
+
IOExtras.copy_stream_n(@outputStream, is, entry.compressed_size)
|
974
1005
|
}
|
975
1006
|
@compressor = NullCompressor.instance
|
976
1007
|
@currentEntry = nil
|
@@ -981,7 +1012,7 @@ module Zip
|
|
981
1012
|
return unless @currentEntry
|
982
1013
|
finish
|
983
1014
|
@currentEntry.compressed_size = @outputStream.tell - @currentEntry.localHeaderOffset -
|
984
|
-
@currentEntry.
|
1015
|
+
@currentEntry.calculate_local_header_size
|
985
1016
|
@currentEntry.size = @compressor.size
|
986
1017
|
@currentEntry.crc = @compressor.crc
|
987
1018
|
@currentEntry = nil
|
@@ -1453,7 +1484,9 @@ module Zip
|
|
1453
1484
|
def rename(entry, newName, &continueOnExistsProc)
|
1454
1485
|
foundEntry = get_entry(entry)
|
1455
1486
|
check_entry_exists(newName, continueOnExistsProc, "rename")
|
1456
|
-
foundEntry
|
1487
|
+
@entrySet.delete(foundEntry)
|
1488
|
+
foundEntry.name = newName
|
1489
|
+
@entrySet << foundEntry
|
1457
1490
|
end
|
1458
1491
|
|
1459
1492
|
# Replaces the specified entry with the contents of srcPath (from
|
@@ -1566,7 +1599,7 @@ module Zip
|
|
1566
1599
|
tmpFilename = tmpfile.path
|
1567
1600
|
tmpfile.close
|
1568
1601
|
if yield tmpFilename
|
1569
|
-
File.
|
1602
|
+
File.rename(tmpFilename, name)
|
1570
1603
|
end
|
1571
1604
|
end
|
1572
1605
|
|
data/lib/zip/zipfilesystem.rb
CHANGED
data/lib/zip/ziprequire.rb
CHANGED
File without changes
|
data/samples/example.rb
CHANGED
File without changes
|
data/samples/gtkRubyzip.rb
CHANGED
File without changes
|
data/samples/qtzip.rb
CHANGED
File without changes
|
data/samples/write_simple.rb
CHANGED
File without changes
|
data/samples/zipfind.rb
CHANGED
File without changes
|
data/test/alltests.rb
CHANGED
File without changes
|
data/test/data/notzippedruby.rb
CHANGED
File without changes
|
data/test/gentestfiles.rb
CHANGED
File without changes
|
data/test/ioextrastest.rb
CHANGED
File without changes
|
data/test/stdrubyexttest.rb
CHANGED
File without changes
|
data/test/zipfilesystemtest.rb
CHANGED
@@ -6,6 +6,7 @@ $: << "../lib"
|
|
6
6
|
|
7
7
|
require 'zip/zipfilesystem'
|
8
8
|
require 'test/unit'
|
9
|
+
require 'fileutils'
|
9
10
|
|
10
11
|
module ExtraAssertions
|
11
12
|
|
@@ -23,7 +24,7 @@ module ExtraAssertions
|
|
23
24
|
assert_equal(retVal, yield) # Invoke test
|
24
25
|
assert_equal(expectedArgs, callArgs)
|
25
26
|
ensure
|
26
|
-
anObject.instance_eval "alias #{method} #{method}_org"
|
27
|
+
anObject.instance_eval "undef #{method}; alias #{method} #{method}_org"
|
27
28
|
end
|
28
29
|
|
29
30
|
end
|
@@ -67,6 +68,15 @@ class ZipFsFileNonmutatingTest < Test::Unit::TestCase
|
|
67
68
|
}
|
68
69
|
assert(blockCalled)
|
69
70
|
|
71
|
+
blockCalled = false
|
72
|
+
@zipFile.file.open("file1", "rb") { # test binary flag is ignored
|
73
|
+
|f|
|
74
|
+
blockCalled = true
|
75
|
+
assert_equal("this is the entry 'file1' in my test archive!",
|
76
|
+
f.readline.chomp)
|
77
|
+
}
|
78
|
+
assert(blockCalled)
|
79
|
+
|
70
80
|
blockCalled = false
|
71
81
|
@zipFile.dir.chdir "dir2"
|
72
82
|
@zipFile.file.open("file21", "r") {
|
@@ -552,7 +562,7 @@ end
|
|
552
562
|
class ZipFsFileMutatingTest < Test::Unit::TestCase
|
553
563
|
TEST_ZIP = "zipWithDirs_copy.zip"
|
554
564
|
def setup
|
555
|
-
|
565
|
+
FileUtils.cp("data/zipWithDirs.zip", TEST_ZIP)
|
556
566
|
end
|
557
567
|
|
558
568
|
def teardown
|
@@ -579,7 +589,7 @@ class ZipFsFileMutatingTest < Test::Unit::TestCase
|
|
579
589
|
zf.file.read("test_open_write_entry"))
|
580
590
|
|
581
591
|
# Test with existing entry
|
582
|
-
zf.file.open("file1", "
|
592
|
+
zf.file.open("file1", "wb") { #also check that 'b' option is ignored
|
583
593
|
|f|
|
584
594
|
blockCalled = true
|
585
595
|
f.write "This is what I'm writing too"
|
@@ -640,7 +650,7 @@ class ZipFsDirectoryTest < Test::Unit::TestCase
|
|
640
650
|
TEST_ZIP = "zipWithDirs_copy.zip"
|
641
651
|
|
642
652
|
def setup
|
643
|
-
|
653
|
+
FileUtils.cp("data/zipWithDirs.zip", TEST_ZIP)
|
644
654
|
end
|
645
655
|
|
646
656
|
def test_delete
|