rubyzip 1.1.5 → 1.1.6

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f37f5862f1890546a9ceb653b406beea7daec34
4
- data.tar.gz: 124b547d2a2999a5fb6cd99597721d8dd45347aa
3
+ metadata.gz: f1b8a6d42ff819b19645f78ce2afb3c9fc7f6e36
4
+ data.tar.gz: 7319bb5eb51c46fdd78fffb43ead4452f2e3d947
5
5
  SHA512:
6
- metadata.gz: a2daaac5e981f3aada2d3426bb51f81e60f61f5e8807efe9a339286923722f7ee0b5b4f5d42f366cfe90d486491f070402b5583d77141c544ea01893da6f40b3
7
- data.tar.gz: 9d8efdb1540364455f36610c8d0d7c31f785458d5666176778ce6d1d1fb568902eb87369d6393fa9875177a164b8444a452bcfd7ae2811785be6c89475fa5c6e
6
+ metadata.gz: 5e59f7e789b618c7e7746efac11152c2272ced20cb63977c045bbbf3dd75ce4fe8bfe1b7da75d490bd7a9bbcddfa1ec93f2924c5f6e7ebcdf94c45ddd23e7042
7
+ data.tar.gz: 97fbb6781a474c5ba51b586033f0da491044687e32f40fe5dcec253305ff55e0ab49d9c22a5732616eaa8203c1e5b768b9d661a77ec0692fa298b89a6598974c
@@ -97,7 +97,6 @@ module Zip
97
97
  return zf unless block_given?
98
98
  begin
99
99
  yield zf
100
- zf
101
100
  ensure
102
101
  zf.close
103
102
  end
@@ -1,3 +1,3 @@
1
1
  module Zip
2
- VERSION = '1.1.5'
2
+ VERSION = '1.1.6'
3
3
  end
@@ -38,18 +38,6 @@ class ZipFileTest < MiniTest::Unit::TestCase
38
38
  assert_equal(2, zfRead.entries.length)
39
39
  end
40
40
 
41
- def test_open_with_block_returns_zip_file
42
- srcFile = "test/data/file2.txt"
43
- entryName = "newEntryName.rb"
44
- assert(::File.exist?(srcFile))
45
- created_file = ::Zip::File.open(EMPTY_FILENAME, ::Zip::File::CREATE) do |zf|
46
- zf.add(entryName, srcFile)
47
- end
48
-
49
- zfRead = ::Zip::File.new(EMPTY_FILENAME)
50
- assert_equal(created_file, zfRead)
51
- end
52
-
53
41
  def test_get_output_stream
54
42
  entryCount = nil
55
43
  ::Zip::File.open(TEST_ZIP.zip_name) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyzip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Simonov
@@ -17,13 +17,10 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - samples/example.rb
21
- - samples/example_filesystem.rb
22
- - samples/example_recursive.rb
23
- - samples/gtkRubyzip.rb
24
- - samples/qtzip.rb
25
- - samples/write_simple.rb
26
- - samples/zipfind.rb
20
+ - README.md
21
+ - Rakefile
22
+ - TODO
23
+ - lib/zip.rb
27
24
  - lib/zip/central_directory.rb
28
25
  - lib/zip/compressor.rb
29
26
  - lib/zip/constants.rb
@@ -33,20 +30,20 @@ files:
33
30
  - lib/zip/entry.rb
34
31
  - lib/zip/entry_set.rb
35
32
  - lib/zip/errors.rb
33
+ - lib/zip/extra_field.rb
36
34
  - lib/zip/extra_field/generic.rb
37
35
  - lib/zip/extra_field/old_unix.rb
38
36
  - lib/zip/extra_field/universal_time.rb
39
37
  - lib/zip/extra_field/unix.rb
40
38
  - lib/zip/extra_field/zip64.rb
41
39
  - lib/zip/extra_field/zip64_placeholder.rb
42
- - lib/zip/extra_field.rb
43
40
  - lib/zip/file.rb
44
41
  - lib/zip/filesystem.rb
45
42
  - lib/zip/inflater.rb
46
43
  - lib/zip/input_stream.rb
44
+ - lib/zip/ioextras.rb
47
45
  - lib/zip/ioextras/abstract_input_stream.rb
48
46
  - lib/zip/ioextras/abstract_output_stream.rb
49
- - lib/zip/ioextras.rb
50
47
  - lib/zip/null_compressor.rb
51
48
  - lib/zip/null_decompressor.rb
52
49
  - lib/zip/null_input_stream.rb
@@ -56,22 +53,23 @@ files:
56
53
  - lib/zip/streamable_directory.rb
57
54
  - lib/zip/streamable_stream.rb
58
55
  - lib/zip/version.rb
59
- - lib/zip.rb
60
- - README.md
61
- - TODO
62
- - Rakefile
63
- - test/alltests.rb
56
+ - samples/example.rb
57
+ - samples/example_filesystem.rb
58
+ - samples/example_recursive.rb
59
+ - samples/gtkRubyzip.rb
60
+ - samples/qtzip.rb
61
+ - samples/write_simple.rb
62
+ - samples/zipfind.rb
64
63
  - test/basic_zip_file_test.rb
65
64
  - test/central_directory_entry_test.rb
66
65
  - test/central_directory_test.rb
67
66
  - test/data/file1.txt
68
67
  - test/data/file1.txt.deflatedData
69
68
  - test/data/file2.txt
70
- - test/data/file2.txt.other
71
- - test/data/globTest/foo/bar/baz/foo.txt
69
+ - test/data/globTest.zip
72
70
  - test/data/globTest/foo.txt
71
+ - test/data/globTest/foo/bar/baz/foo.txt
73
72
  - test/data/globTest/food.txt
74
- - test/data/globTest.zip
75
73
  - test/data/mimetype
76
74
  - test/data/notzippedruby.rb
77
75
  - test/data/rubycode.zip
@@ -100,13 +98,10 @@ files:
100
98
  - test/ioextras/abstract_input_stream_test.rb
101
99
  - test/ioextras/abstract_output_stream_test.rb
102
100
  - test/ioextras/fake_io_test.rb
103
- - test/ioextrastest.rb
104
101
  - test/local_entry_test.rb
105
- - test/odt_test_fix.rb
106
102
  - test/output_stream_test.rb
107
103
  - test/pass_thru_compressor_test.rb
108
104
  - test/pass_thru_decompressor_test.rb
109
- - test/sample.odt
110
105
  - test/settings_test.rb
111
106
  - test/test_helper.rb
112
107
  - test/unicode_file_names_and_comments_test.rb
@@ -122,29 +117,27 @@ require_paths:
122
117
  - lib
123
118
  required_ruby_version: !ruby/object:Gem::Requirement
124
119
  requirements:
125
- - - '>='
120
+ - - ">="
126
121
  - !ruby/object:Gem::Version
127
122
  version: 1.9.2
128
123
  required_rubygems_version: !ruby/object:Gem::Requirement
129
124
  requirements:
130
- - - '>='
125
+ - - ">="
131
126
  - !ruby/object:Gem::Version
132
127
  version: '0'
133
128
  requirements: []
134
129
  rubyforge_project:
135
- rubygems_version: 2.0.6
130
+ rubygems_version: 2.2.2
136
131
  signing_key:
137
132
  specification_version: 4
138
133
  summary: rubyzip is a ruby module for reading and writing zip files
139
134
  test_files:
140
- - test/alltests.rb
141
135
  - test/basic_zip_file_test.rb
142
136
  - test/central_directory_entry_test.rb
143
137
  - test/central_directory_test.rb
144
138
  - test/data/file1.txt
145
139
  - test/data/file1.txt.deflatedData
146
140
  - test/data/file2.txt
147
- - test/data/file2.txt.other
148
141
  - test/data/globTest/foo/bar/baz/foo.txt
149
142
  - test/data/globTest/foo.txt
150
143
  - test/data/globTest/food.txt
@@ -177,13 +170,10 @@ test_files:
177
170
  - test/ioextras/abstract_input_stream_test.rb
178
171
  - test/ioextras/abstract_output_stream_test.rb
179
172
  - test/ioextras/fake_io_test.rb
180
- - test/ioextrastest.rb
181
173
  - test/local_entry_test.rb
182
- - test/odt_test_fix.rb
183
174
  - test/output_stream_test.rb
184
175
  - test/pass_thru_compressor_test.rb
185
176
  - test/pass_thru_decompressor_test.rb
186
- - test/sample.odt
187
177
  - test/settings_test.rb
188
178
  - test/test_helper.rb
189
179
  - test/unicode_file_names_and_comments_test.rb
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'simplecov'
3
- require 'coveralls'
4
-
5
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
- SimpleCov::Formatter::HTMLFormatter,
7
- Coveralls::SimpleCov::Formatter
8
- ]
9
- SimpleCov.start do
10
- add_filter '/test'
11
- end
12
- Dir.chdir File.join(File.dirname(__FILE__))
13
-
14
- $VERBOSE = true
15
-
16
- require 'ioextrastest'
17
- require 'ziptest'
18
- require 'zipfilesystemtest'
File without changes
@@ -1,233 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $VERBOSE = true
4
-
5
- $LOAD_PATH << '../lib'
6
-
7
- require 'test/unit'
8
- require 'zip/ioextras'
9
-
10
- include ::Zip::IOExtras
11
-
12
- class FakeIOTest < Test::Unit::TestCase
13
- class FakeIOUsingClass
14
- include FakeIO
15
- end
16
-
17
- def test_kind_of?
18
- obj = FakeIOUsingClass.new
19
-
20
- assert(obj.kind_of?(Object))
21
- assert(obj.kind_of?(FakeIOUsingClass))
22
- assert(obj.kind_of?(IO))
23
- assert(!obj.kind_of?(Fixnum))
24
- assert(!obj.kind_of?(String))
25
- end
26
- end
27
-
28
- class AbstractInputStreamTest < Test::Unit::TestCase
29
- # AbstractInputStream subclass that provides a read method
30
-
31
- TEST_LINES = ["Hello world#{$INPUT_RECORD_SEPARATOR}",
32
- "this is the second line#{$INPUT_RECORD_SEPARATOR}",
33
- 'this is the last line']
34
- TEST_STRING = TEST_LINES.join
35
- class TestAbstractInputStream
36
- include AbstractInputStream
37
- def initialize(aString)
38
- super()
39
- @contents = aString
40
- @readPointer = 0
41
- end
42
-
43
- def sysread(charsToRead, _buf = nil)
44
- retVal = @contents[@readPointer, charsToRead]
45
- @readPointer += charsToRead
46
- retVal
47
- end
48
-
49
- def produce_input
50
- sysread(100)
51
- end
52
-
53
- def input_finished?
54
- @contents[@readPointer].nil?
55
- end
56
- end
57
-
58
- def setup
59
- @io = TestAbstractInputStream.new(TEST_STRING)
60
- end
61
-
62
- def test_gets
63
- assert_equal(TEST_LINES[0], @io.gets)
64
- assert_equal(1, @io.lineno)
65
- assert_equal(TEST_LINES[0].length, @io.pos)
66
- assert_equal(TEST_LINES[1], @io.gets)
67
- assert_equal(2, @io.lineno)
68
- assert_equal(TEST_LINES[2], @io.gets)
69
- assert_equal(3, @io.lineno)
70
- assert_equal(nil, @io.gets)
71
- assert_equal(4, @io.lineno)
72
- end
73
-
74
- def test_getsMultiCharSeperator
75
- assert_equal('Hell', @io.gets('ll'))
76
- assert_equal("o world#{$INPUT_RECORD_SEPARATOR}this is the second l", @io.gets('d l'))
77
- end
78
-
79
- LONG_LINES = [
80
- 'x' * 48 + "\r\n",
81
- 'y' * 49 + "\r\n",
82
- 'rest',
83
- ]
84
- def test_getsMulitCharSeperator_split
85
- io = TestAbstractInputStream.new(LONG_LINES.join)
86
- assert_equal(LONG_LINES[0], io.gets("\r\n"))
87
- assert_equal(LONG_LINES[1], io.gets("\r\n"))
88
- assert_equal(LONG_LINES[2], io.gets("\r\n"))
89
- end
90
-
91
- def test_getsWithSepAndIndex
92
- io = TestAbstractInputStream.new(LONG_LINES.join)
93
- assert_equal('x', io.gets("\r\n", 1))
94
- assert_equal('x' * 47 + "\r", io.gets("\r\n", 48))
95
- assert_equal("\n", io.gets(nil, 1))
96
- assert_equal('yy', io.gets(nil, 2))
97
- end
98
-
99
- def test_getsWithIndex
100
- assert_equal(TEST_LINES[0], @io.gets(100))
101
- assert_equal('this', @io.gets(4))
102
- end
103
-
104
- def test_each_line
105
- lineNumber = 0
106
- @io.each_line {
107
- |line|
108
- assert_equal(TEST_LINES[lineNumber], line)
109
- lineNumber += 1
110
- }
111
- end
112
-
113
- def test_readlines
114
- assert_equal(TEST_LINES, @io.readlines)
115
- end
116
-
117
- def test_readline
118
- test_gets
119
- begin
120
- @io.readline
121
- fail 'EOFError expected'
122
- rescue EOFError
123
- end
124
- end
125
- end
126
-
127
- class AbstractOutputStreamTest < Test::Unit::TestCase
128
- class TestOutputStream
129
- include AbstractOutputStream
130
-
131
- attr_accessor :buffer
132
-
133
- def initialize
134
- @buffer = ''
135
- end
136
-
137
- def <<(data)
138
- @buffer << data
139
- self
140
- end
141
- end
142
-
143
- def setup
144
- @output_stream = TestOutputStream.new
145
-
146
- @origCommaSep = $OUTPUT_FIELD_SEPARATOR
147
- @origOutputSep = $OUTPUT_RECORD_SEPARATOR
148
- end
149
-
150
- def teardown
151
- $, = @origCommaSep
152
- $\ = @origOutputSep
153
- end
154
-
155
- def test_write
156
- count = @output_stream.write('a little string')
157
- assert_equal('a little string', @output_stream.buffer)
158
- assert_equal('a little string'.length, count)
159
-
160
- count = @output_stream.write('. a little more')
161
- assert_equal('a little string. a little more', @output_stream.buffer)
162
- assert_equal('. a little more'.length, count)
163
- end
164
-
165
- def test_print
166
- $\ = nil # record separator set to nil
167
- @output_stream.print('hello')
168
- assert_equal('hello', @output_stream.buffer)
169
-
170
- @output_stream.print(' world.')
171
- assert_equal('hello world.', @output_stream.buffer)
172
-
173
- @output_stream.print(' You ok ', 'out ', 'there?')
174
- assert_equal('hello world. You ok out there?', @output_stream.buffer)
175
-
176
- $\ = "\n"
177
- @output_stream.print
178
- assert_equal("hello world. You ok out there?\n", @output_stream.buffer)
179
-
180
- @output_stream.print('I sure hope so!')
181
- assert_equal("hello world. You ok out there?\nI sure hope so!\n", @output_stream.buffer)
182
-
183
- $, = 'X'
184
- @output_stream.buffer = ''
185
- @output_stream.print('monkey', 'duck', 'zebra')
186
- assert_equal("monkeyXduckXzebra\n", @output_stream.buffer)
187
-
188
- $\ = nil
189
- @output_stream.buffer = ''
190
- @output_stream.print(20)
191
- assert_equal('20', @output_stream.buffer)
192
- end
193
-
194
- def test_printf
195
- @output_stream.printf('%d %04x', 123, 123)
196
- assert_equal('123 007b', @output_stream.buffer)
197
- end
198
-
199
- def test_putc
200
- @output_stream.putc('A')
201
- assert_equal('A', @output_stream.buffer)
202
- @output_stream.putc(65)
203
- assert_equal('AA', @output_stream.buffer)
204
- end
205
-
206
- def test_puts
207
- @output_stream.puts
208
- assert_equal("\n", @output_stream.buffer)
209
-
210
- @output_stream.puts('hello', 'world')
211
- assert_equal("\nhello\nworld\n", @output_stream.buffer)
212
-
213
- @output_stream.buffer = ''
214
- @output_stream.puts("hello\n", "world\n")
215
- assert_equal("hello\nworld\n", @output_stream.buffer)
216
-
217
- @output_stream.buffer = ''
218
- @output_stream.puts(["hello\n", "world\n"])
219
- assert_equal("hello\nworld\n", @output_stream.buffer)
220
-
221
- @output_stream.buffer = ''
222
- @output_stream.puts(["hello\n", "world\n"], 'bingo')
223
- assert_equal("hello\nworld\nbingo\n", @output_stream.buffer)
224
-
225
- @output_stream.buffer = ''
226
- @output_stream.puts(16, 20, 50, 'hello')
227
- assert_equal("16\n20\n50\nhello\n", @output_stream.buffer)
228
- end
229
- end
230
-
231
- # Copyright (C) 2002-2004 Thomas Sondergaard
232
- # rubyzip is free software; you can redistribute it and/or
233
- # modify it under the terms of the ruby license.
@@ -1,30 +0,0 @@
1
- require 'rubygems'
2
- require 'zip'
3
-
4
- file_name = 'sample.odt'
5
- content_file = 'content.xml'
6
-
7
- def extract_and_compress(file, dir, content_file)
8
- cont = "#{dir}/#{content_file}"
9
- Zip::File.open(file) do |z|
10
- z.extract(content_file, cont)
11
- z.replace(content_file, cont)
12
- end
13
- FileUtils.remove cont
14
- end
15
-
16
- dir = File.expand_path File.dirname(__FILE__)
17
- tmpdir = "#{dir}/#{Time.now.to_i}"
18
- FileUtils.mkdir tmpdir
19
-
20
- file = "#{dir}/#{file_name}"
21
- file_cp = "#{tmpdir}/sample_1.odt"
22
- FileUtils.cp file, file_cp
23
-
24
- extract_and_compress file_cp, tmpdir, content_file
25
-
26
- file = "#{tmpdir}/sample_1.odt"
27
- file_cp = "#{tmpdir}/sample_2.odt"
28
- FileUtils.cp file, file_cp
29
-
30
- extract_and_compress file_cp, tmpdir, content_file
Binary file