zip_tricks 5.1.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +96 -0
- data/.gitignore +2 -1
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +49 -3
- data/CONTRIBUTING.md +4 -4
- data/README.md +28 -17
- data/lib/zip_tricks/block_write.rb +26 -21
- data/lib/zip_tricks/file_reader.rb +8 -6
- data/lib/zip_tricks/null_writer.rb +1 -1
- data/lib/zip_tricks/output_enumerator.rb +48 -27
- data/lib/zip_tricks/path_set.rb +4 -0
- data/lib/zip_tricks/rails_streaming.rb +7 -9
- data/lib/zip_tricks/size_estimator.rb +0 -3
- data/lib/zip_tricks/stream_crc32.rb +2 -2
- data/lib/zip_tricks/streamer/deflated_writer.rb +9 -28
- data/lib/zip_tricks/streamer/entry.rb +5 -1
- data/lib/zip_tricks/streamer/stored_writer.rb +4 -3
- data/lib/zip_tricks/streamer.rb +69 -28
- data/lib/zip_tricks/version.rb +1 -1
- data/lib/zip_tricks/write_and_tell.rb +2 -12
- data/lib/zip_tricks/write_buffer.rb +37 -17
- data/lib/zip_tricks/zip_writer.rb +37 -30
- data/zip_tricks.gemspec +4 -6
- metadata +9 -51
- data/.travis.yml +0 -11
- data/qa/README_QA.md +0 -16
- data/qa/generate_test_files.rb +0 -126
- data/qa/in/VTYL8830.jpg +0 -0
- data/qa/in/war-and-peace.txt +0 -10810
- data/qa/support.rb +0 -88
- data/qa/test-report-2016-07-28.txt +0 -156
- data/qa/test-report-2016-12-12.txt +0 -156
- data/qa/test-report-2017-04-2.txt +0 -168
- data/qa/test-report.txt +0 -28
data/zip_tricks.gemspec
CHANGED
|
@@ -5,13 +5,13 @@ require 'zip_tricks/version'
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = 'zip_tricks'
|
|
7
7
|
spec.version = ZipTricks::VERSION
|
|
8
|
-
spec.authors = ['Julik Tarkhanov', 'Noah Berman', 'Dmitry Tymchuk', 'David Bosveld']
|
|
8
|
+
spec.authors = ['Julik Tarkhanov', 'Noah Berman', 'Dmitry Tymchuk', 'David Bosveld', 'Felix Bünemann']
|
|
9
9
|
spec.email = ['me@julik.nl']
|
|
10
10
|
|
|
11
11
|
spec.licenses = ['MIT (Hippocratic)']
|
|
12
12
|
spec.summary = 'Stream out ZIP files from Ruby'
|
|
13
13
|
spec.description = 'Stream out ZIP files from Ruby'
|
|
14
|
-
spec.homepage = '
|
|
14
|
+
spec.homepage = 'https://github.com/wetransfer/zip_tricks'
|
|
15
15
|
|
|
16
16
|
# Prevent pushing this gem to RubyGems.org.
|
|
17
17
|
# To allow pushes either set the 'allowed_push_host'
|
|
@@ -31,11 +31,9 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.require_paths = ['lib']
|
|
32
32
|
|
|
33
33
|
spec.add_development_dependency 'bundler'
|
|
34
|
-
spec.add_development_dependency 'rubyzip', '~> 1'
|
|
35
|
-
spec.add_development_dependency 'terminal-table'
|
|
36
|
-
spec.add_development_dependency 'range_utils'
|
|
34
|
+
spec.add_development_dependency 'rubyzip', '~> 1'
|
|
37
35
|
|
|
38
|
-
spec.add_development_dependency 'rack', '~> 1.6' # For
|
|
36
|
+
spec.add_development_dependency 'rack', '~> 1.6' # For tests, where we spin up a server
|
|
39
37
|
spec.add_development_dependency 'rake', '~> 12.2'
|
|
40
38
|
spec.add_development_dependency 'rspec', '~> 3'
|
|
41
39
|
spec.add_development_dependency 'complexity_assert'
|
metadata
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zip_tricks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Julik Tarkhanov
|
|
8
8
|
- Noah Berman
|
|
9
9
|
- Dmitry Tymchuk
|
|
10
10
|
- David Bosveld
|
|
11
|
-
|
|
11
|
+
- Felix Bünemann
|
|
12
|
+
autorequire:
|
|
12
13
|
bindir: exe
|
|
13
14
|
cert_chain: []
|
|
14
|
-
date:
|
|
15
|
+
date: 2021-06-05 00:00:00.000000000 Z
|
|
15
16
|
dependencies:
|
|
16
17
|
- !ruby/object:Gem::Dependency
|
|
17
18
|
name: bundler
|
|
@@ -34,9 +35,6 @@ dependencies:
|
|
|
34
35
|
- - "~>"
|
|
35
36
|
- !ruby/object:Gem::Version
|
|
36
37
|
version: '1'
|
|
37
|
-
- - ">="
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: 1.2.2
|
|
40
38
|
type: :development
|
|
41
39
|
prerelease: false
|
|
42
40
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -44,37 +42,6 @@ dependencies:
|
|
|
44
42
|
- - "~>"
|
|
45
43
|
- !ruby/object:Gem::Version
|
|
46
44
|
version: '1'
|
|
47
|
-
- - ">="
|
|
48
|
-
- !ruby/object:Gem::Version
|
|
49
|
-
version: 1.2.2
|
|
50
|
-
- !ruby/object:Gem::Dependency
|
|
51
|
-
name: terminal-table
|
|
52
|
-
requirement: !ruby/object:Gem::Requirement
|
|
53
|
-
requirements:
|
|
54
|
-
- - ">="
|
|
55
|
-
- !ruby/object:Gem::Version
|
|
56
|
-
version: '0'
|
|
57
|
-
type: :development
|
|
58
|
-
prerelease: false
|
|
59
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
60
|
-
requirements:
|
|
61
|
-
- - ">="
|
|
62
|
-
- !ruby/object:Gem::Version
|
|
63
|
-
version: '0'
|
|
64
|
-
- !ruby/object:Gem::Dependency
|
|
65
|
-
name: range_utils
|
|
66
|
-
requirement: !ruby/object:Gem::Requirement
|
|
67
|
-
requirements:
|
|
68
|
-
- - ">="
|
|
69
|
-
- !ruby/object:Gem::Version
|
|
70
|
-
version: '0'
|
|
71
|
-
type: :development
|
|
72
|
-
prerelease: false
|
|
73
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
74
|
-
requirements:
|
|
75
|
-
- - ">="
|
|
76
|
-
- !ruby/object:Gem::Version
|
|
77
|
-
version: '0'
|
|
78
45
|
- !ruby/object:Gem::Dependency
|
|
79
46
|
name: rack
|
|
80
47
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -224,10 +191,10 @@ extra_rdoc_files: []
|
|
|
224
191
|
files:
|
|
225
192
|
- ".codeclimate.yml"
|
|
226
193
|
- ".document"
|
|
194
|
+
- ".github/workflows/ci.yml"
|
|
227
195
|
- ".gitignore"
|
|
228
196
|
- ".rspec"
|
|
229
197
|
- ".rubocop.yml"
|
|
230
|
-
- ".travis.yml"
|
|
231
198
|
- ".yardopts"
|
|
232
199
|
- CHANGELOG.md
|
|
233
200
|
- CODE_OF_CONDUCT.md
|
|
@@ -268,22 +235,13 @@ files:
|
|
|
268
235
|
- lib/zip_tricks/write_and_tell.rb
|
|
269
236
|
- lib/zip_tricks/write_buffer.rb
|
|
270
237
|
- lib/zip_tricks/zip_writer.rb
|
|
271
|
-
- qa/README_QA.md
|
|
272
|
-
- qa/generate_test_files.rb
|
|
273
|
-
- qa/in/VTYL8830.jpg
|
|
274
|
-
- qa/in/war-and-peace.txt
|
|
275
|
-
- qa/support.rb
|
|
276
|
-
- qa/test-report-2016-07-28.txt
|
|
277
|
-
- qa/test-report-2016-12-12.txt
|
|
278
|
-
- qa/test-report-2017-04-2.txt
|
|
279
|
-
- qa/test-report.txt
|
|
280
238
|
- zip_tricks.gemspec
|
|
281
|
-
homepage:
|
|
239
|
+
homepage: https://github.com/wetransfer/zip_tricks
|
|
282
240
|
licenses:
|
|
283
241
|
- MIT (Hippocratic)
|
|
284
242
|
metadata:
|
|
285
243
|
allowed_push_host: https://rubygems.org
|
|
286
|
-
post_install_message:
|
|
244
|
+
post_install_message:
|
|
287
245
|
rdoc_options: []
|
|
288
246
|
require_paths:
|
|
289
247
|
- lib
|
|
@@ -298,8 +256,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
298
256
|
- !ruby/object:Gem::Version
|
|
299
257
|
version: '0'
|
|
300
258
|
requirements: []
|
|
301
|
-
rubygems_version: 3.0.
|
|
302
|
-
signing_key:
|
|
259
|
+
rubygems_version: 3.0.3
|
|
260
|
+
signing_key:
|
|
303
261
|
specification_version: 4
|
|
304
262
|
summary: Stream out ZIP files from Ruby
|
|
305
263
|
test_files: []
|
data/.travis.yml
DELETED
data/qa/README_QA.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
## Manual testing harness for ZipTricks
|
|
2
|
-
|
|
3
|
-
These tests will generate **very large** files that test various edge cases of ZIP generation. The idea is to generate
|
|
4
|
-
these files and to then try to open them with the unarchiver applications we support. The workflow is as follows:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
1. Configure your storage to have `zip_tricks` directory linked into your virtual machines and to be on a fast volume (SSD RAID0 is recommended)
|
|
8
|
-
2. Run `generate_test_files.rb`. This will take some time and produce a number of large ZIP files.
|
|
9
|
-
3. Open them with the following ZIP unarchivers:
|
|
10
|
-
* A recent version of `zipinfo` with the `-tlhvz` flags - to see the information about the file
|
|
11
|
-
* ArchiveUtility on OSX
|
|
12
|
-
* The Unarchiver on OSX
|
|
13
|
-
* Built-in Explorer on Windows 7
|
|
14
|
-
* 7Zip 9.20 on Windows 7
|
|
15
|
-
* Any other unarchivers you consider necessary
|
|
16
|
-
* Write down your observations in `test-report.txt` and, when cutting a release, timestamp a copy of that file.
|
data/qa/generate_test_files.rb
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative 'support'
|
|
4
|
-
|
|
5
|
-
build_test 'Two small stored files' do |zip|
|
|
6
|
-
zip.add_stored_entry(filename: 'text.txt',
|
|
7
|
-
size: $war_and_peace.bytesize,
|
|
8
|
-
crc32: $war_and_peace_crc)
|
|
9
|
-
zip << $war_and_peace
|
|
10
|
-
|
|
11
|
-
zip.add_stored_entry(filename: 'image.jpg',
|
|
12
|
-
size: $image_file.bytesize,
|
|
13
|
-
crc32: $image_file_crc)
|
|
14
|
-
zip << $image_file
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
build_test 'Two small stored files and an empty directory' do |zip|
|
|
18
|
-
zip.add_stored_entry(filename: 'text.txt',
|
|
19
|
-
size: $war_and_peace.bytesize,
|
|
20
|
-
crc32: $war_and_peace_crc)
|
|
21
|
-
zip << $war_and_peace
|
|
22
|
-
|
|
23
|
-
zip.add_stored_entry(filename: 'image.jpg',
|
|
24
|
-
size: $image_file.bytesize,
|
|
25
|
-
crc32: $image_file_crc)
|
|
26
|
-
zip << $image_file
|
|
27
|
-
|
|
28
|
-
zip.add_empty_directory(dirname: 'Chekov')
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
build_test 'Filename with diacritics' do |zip|
|
|
32
|
-
zip.add_stored_entry(filename: 'Kungälv.txt',
|
|
33
|
-
size: $war_and_peace.bytesize,
|
|
34
|
-
crc32: $war_and_peace_crc)
|
|
35
|
-
zip << $war_and_peace
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
build_test 'Purely UTF-8 filename' do |zip|
|
|
39
|
-
zip.add_stored_entry(filename: 'Война и мир.txt',
|
|
40
|
-
size: $war_and_peace.bytesize,
|
|
41
|
-
crc32: $war_and_peace_crc)
|
|
42
|
-
zip << $war_and_peace
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# The trick of this test is that each file of the 2, on it's own, does _not_ exceed the
|
|
46
|
-
# size threshold for Zip64. Together, however, they do.
|
|
47
|
-
build_test 'Two entries larger than the overall Zip64 offset' do |zip|
|
|
48
|
-
big = generate_big_entry((0xFFFFFFFF / 2) + 1_024)
|
|
49
|
-
zip.add_stored_entry(filename: 'repeated-A.txt',
|
|
50
|
-
size: big.size,
|
|
51
|
-
crc32: big.crc32)
|
|
52
|
-
big.write_to(zip)
|
|
53
|
-
|
|
54
|
-
zip.add_stored_entry(filename: 'repeated-B.txt',
|
|
55
|
-
size: big.size,
|
|
56
|
-
crc32: big.crc32)
|
|
57
|
-
big.write_to(zip)
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
build_test 'One entry that requires Zip64 and a tiny entry following it' do |zip|
|
|
61
|
-
big = generate_big_entry(0xFFFFFFFF + 2_048)
|
|
62
|
-
zip.add_stored_entry(filename: 'large-requires-zip64.bin',
|
|
63
|
-
size: big.size,
|
|
64
|
-
crc32: big.crc32)
|
|
65
|
-
big.write_to(zip)
|
|
66
|
-
|
|
67
|
-
zip.add_stored_entry(filename: 'tiny-after.txt',
|
|
68
|
-
size: $war_and_peace.bytesize,
|
|
69
|
-
crc32: $war_and_peace_crc)
|
|
70
|
-
zip << $war_and_peace
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
build_test 'One tiny entry followed by second that requires Zip64' do |zip|
|
|
74
|
-
zip.add_stored_entry(filename: 'tiny-at-start.txt',
|
|
75
|
-
size: $war_and_peace.bytesize,
|
|
76
|
-
crc32: $war_and_peace_crc)
|
|
77
|
-
zip << $war_and_peace
|
|
78
|
-
|
|
79
|
-
big = generate_big_entry(0xFFFFFFFF + 2_048)
|
|
80
|
-
zip.add_stored_entry(filename: 'large-requires-zip64.bin',
|
|
81
|
-
size: big.size,
|
|
82
|
-
crc32: big.crc32)
|
|
83
|
-
big.write_to(zip)
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
build_test 'Two entries both requiring Zip64' do |zip|
|
|
87
|
-
big = generate_big_entry(0xFFFFFFFF + 2_048)
|
|
88
|
-
zip.add_stored_entry(filename: 'huge-file-1.bin',
|
|
89
|
-
size: big.size,
|
|
90
|
-
crc32: big.crc32)
|
|
91
|
-
big.write_to(zip)
|
|
92
|
-
|
|
93
|
-
zip.add_stored_entry(filename: 'huge-file-2.bin',
|
|
94
|
-
size: big.size,
|
|
95
|
-
crc32: big.crc32)
|
|
96
|
-
big.write_to(zip)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
build_test 'Two stored entries using data descriptors' do |zip|
|
|
100
|
-
zip.write_stored_file('stored.1.bin') do |sink|
|
|
101
|
-
sink << Random.new.bytes(1_024 * 1_024 * 4)
|
|
102
|
-
end
|
|
103
|
-
zip.write_stored_file('stored.2.bin') do |sink|
|
|
104
|
-
sink << Random.new.bytes(1_024 * 1_024 * 3)
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
build_test 'One entry deflated using data descriptors' do |zip|
|
|
109
|
-
big = generate_big_entry(0xFFFFFFFF / 64)
|
|
110
|
-
zip.write_deflated_file('war-and-peace-repeated-compressed.txt') do |sink|
|
|
111
|
-
big.write_to(sink)
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
build_test 'Two entries larger than the overall Zip64 offset using data descriptors' do |zip|
|
|
116
|
-
big = generate_big_entry((0xFFFFFFFF / 2) + 1_024)
|
|
117
|
-
|
|
118
|
-
zip.write_stored_file('repeated-A.txt') { |sink| big.write_to(sink) }
|
|
119
|
-
zip.write_stored_file('repeated-B.txt') { |sink| big.write_to(sink) }
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
build_test 'One stored entry larger than Zip64 threshold using data descriptors' do |zip|
|
|
123
|
-
big = generate_big_entry(0xFFFFFFFF + 64_000)
|
|
124
|
-
|
|
125
|
-
zip.write_stored_file('repeated-A.txt') { |sink| big.write_to(sink) }
|
|
126
|
-
end
|
data/qa/in/VTYL8830.jpg
DELETED
|
Binary file
|