zip_tricks 4.4.1 → 4.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4fb7180cf39e2f4acbae7edc62614e0d391f5ab
4
- data.tar.gz: 88bcc21c47233036a05f5a8cd1d4a99f8eecc1fc
3
+ metadata.gz: c690345707197b65846cdbda6096a94321edd088
4
+ data.tar.gz: 23fb11b83016deacb2d94f6fb7ac8a5a2f8a6821
5
5
  SHA512:
6
- metadata.gz: d6fd5a5d297bc276c3f0853561490611bd42dc014d764eb6f9d9e297592703aaf9b5116409589d380f35d25d8f83cfee7217098f808fd07f3b134123c53b9b70
7
- data.tar.gz: 29e47a62795eaffd99c2c8e8b17bbedb51cc7f3f470802b6f73412ecbe1751585387c5bdd82e7115600ad06821e5d75bead2d96f9870526a481f228f87c572ad
6
+ metadata.gz: 854c3bd1a6d7d52f83187f925736f610fcc564a3fa892007b27ca4dc8ace5548d56fc872cf6acec2e6395dc70638b97beda07f29877bbe4562d736839ddea0b6
7
+ data.tar.gz: 475035d3ec2229b154b264bf1b0e7dc8ada36b008cbfea64323bf8e251d54c553957dadac5fa16b0f322ba8c35bc88ca933243325b72a34d2c9533d9d853dffa
data/.travis.yml CHANGED
@@ -2,6 +2,7 @@ rvm:
2
2
  - 2.1
3
3
  - 2.2
4
4
  - 2.3.0
5
+ - 2.4.1
5
6
  - jruby-9.0
6
7
  sudo: false
7
8
  cache: bundler
data/CHANGELOG.md ADDED
@@ -0,0 +1,119 @@
1
+ ## 4.4.2
2
+
3
+ * Add 2.4 to Travis rubies
4
+ * Fix a severe performance degradation in Streamer with large file counts (https://github.com/WeTransfer/zip_tricks/pull/14)
5
+
6
+ ## 4.4.1
7
+
8
+ * Tweak documentation a little
9
+
10
+ ## 4.4.0
11
+
12
+ * Add `Streamer#add_empty_directory_entry` for writing empty directories/folders into the ZIP
13
+
14
+ ## 4.3.0
15
+
16
+ * Add a native Rails streaming module for easier integration of ZipTricks into Rails controllers
17
+
18
+ ## 4.2.4
19
+
20
+ * Get rid of Jeweler in favor of the standard Bundler/rubygems gem tasks
21
+
22
+ ## 4.2.3
23
+
24
+ * Instead of BlockWrite, use intrim flushes of the same zlib Deflater
25
+
26
+ ## 4.2.2
27
+
28
+ * Rewrite small data writes to perform less calls to `pack`
29
+
30
+ ## 4.2.1
31
+
32
+ * Uniquify filenames during writes, so that the caller doesn't have to.
33
+
34
+ ## 4.2.0
35
+
36
+ * Make it possible to swap the destination for Streamer writes, to improve `Range` support in the
37
+ download server. Sometimes it might be useful to actually "redirect" the output to a different IO
38
+ or buffer, without having to provide our own implementation of this switching.
39
+
40
+ ## 4.1.0
41
+
42
+ * Implement brute-force straight-ahead reading of local file headers, for damaged or
43
+ incomplete ZIP files
44
+
45
+ ## 4.0.0
46
+
47
+ * Make reading local headers optional, since we need it but we don't have to use it for all archives. Ideally
48
+ we should only do it when a reasonable central directory cannot be found. This can also happen under normal
49
+ usage, when we are dealing with a ZIP-within-a-ZIP or when the end of the ZIP file has been truncated on
50
+ write.
51
+ * Make sure `Writable#write` returns the number of bytes written (fix `IO.copy_stream` compatibility)
52
+
53
+ ## 3.1.1
54
+
55
+ * Fix reading Zip64 extra fields. Only read fields that have corresponding "normal" fields set to overflow value.
56
+
57
+ ## 3.1.0
58
+
59
+ * Fix `FileReader` failing where the EOCD marker would be detected multiple times at the end of a ZIP, which
60
+ is something that _can_ happen during normal usage - a byte pattern has to appear twice to trigger the bug.
61
+ * Add support for archive comment customization
62
+
63
+ ## 2.8.1
64
+
65
+ * Fix the bug with older versions of The Unarchiver refusing to open our Zip64 files
66
+
67
+ ## 2.8.0
68
+
69
+ * Replace RubyZip with a clean-room ZIP writer, due to the overly elaborate Java-esque structure of RubyZip being hostile
70
+ to modifications. The straw that broke the camel's back in this case is the insistence of RubyZip on writing out padding
71
+ for the Zip64 extra fields in the local entries that it would never replace with useful data, which was breaking unarchiving
72
+ when using Windows Explorer.
73
+
74
+ ## 2.7.0
75
+
76
+ * Add `Streamer#write` so that the Streamer can be used as argument to `IO.copy_stream`
77
+
78
+ ## 2.6.1
79
+
80
+ * Fi 0-byte reads in RemoteIO of RemoteUncap
81
+
82
+ ## 2.6.0
83
+
84
+ * Set up open-source facilities (Github, Travis CI...)
85
+ * Add RemoteUncap for listing ZIP archives located on HTTP servers without having to download them.
86
+ RemoteUncap downloads the central directory only using HTTP `Range` headers.
87
+
88
+ ## 2.5.0
89
+
90
+ * Add Manifest for building a map of the ZIP file (for later Range support)
91
+
92
+ ## 2.4.3 (Internal rel)
93
+
94
+ * Extract [very_tiny_state_machine](https://rubygems.org/gems/very_tiny_state_machine) gem from ZipTricks
95
+
96
+ ## 2.4.1 (Internal rel)
97
+
98
+ * Include StreamCRC32 in the README
99
+
100
+ ## 2.3.1 (Internal rel)
101
+
102
+ * Restore a streaming CRC facility
103
+
104
+ ## 2.2.1 (Internal rel)
105
+
106
+ * Ensure WriteAndTell plays nice with strings in other encodings than BINARY
107
+
108
+ ## 2.2.0 (Internal rel)
109
+
110
+ * Fix bytes_written return from deflate_in_blocks
111
+ * Raise on invalid Streamer IO arguments
112
+ * Set the EFS flag for UTF-8 filenames
113
+ * Add a RackBody object for plugging ZipTricks into Rack
114
+ * Add an offset wrapper for IOs given to Streamer, to support size estimation
115
+ * Ensure the given compression level is supported
116
+
117
+ ## 2.0.0 (Internal rel)
118
+
119
+ * Implements streaming zip based on RubyZip
@@ -94,6 +94,7 @@ class ZipTricks::Streamer
94
94
  @out = stream
95
95
  @files = []
96
96
  @local_header_offsets = []
97
+ @filenames_set = Set.new
97
98
  @writer = writer
98
99
  end
99
100
 
@@ -183,7 +184,7 @@ class ZipTricks::Streamer
183
184
  crc, comp, uncomp = w.finish
184
185
 
185
186
  # Save the information into the entry for when the time comes to write out the central directory
186
- last_entry = @files[-1]
187
+ last_entry = @files.last
187
188
  last_entry.crc32 = crc
188
189
  last_entry.compressed_size = comp
189
190
  last_entry.uncompressed_size = uncomp
@@ -257,13 +258,14 @@ class ZipTricks::Streamer
257
258
 
258
259
  # Clean backslashes and uniqify filenames if there are duplicates
259
260
  filename = remove_backslash(filename)
260
- filename = uniquify_name(filename) if @files.any? { |e| e.filename == filename }
261
+ filename = uniquify_name(filename) if @filenames_set.include?(filename)
261
262
 
262
263
  raise UnknownMode, "Unknown compression mode #{storage_mode}" unless [STORED, DEFLATED].include?(storage_mode)
263
264
  raise Overflow, "Filename is too long" if filename.bytesize > 0xFFFF
264
265
 
265
266
  e = Entry.new(filename, crc32, compressed_size, uncompressed_size, storage_mode, mtime=Time.now.utc, use_data_descriptor)
266
267
  @files << e
268
+ @filenames_set << e.filename
267
269
  @local_header_offsets << @out.tell
268
270
  @writer.write_local_file_header(io: @out, gp_flags: e.gp_flags, crc32: e.crc32, compressed_size: e.compressed_size,
269
271
  uncompressed_size: e.uncompressed_size, mtime: e.mtime, filename: e.filename, storage_mode: e.storage_mode)
@@ -279,7 +281,6 @@ class ZipTricks::Streamer
279
281
  end
280
282
 
281
283
  def uniquify_name(filename)
282
- files = Set.new(@files.map(&:filename))
283
284
  copy_pattern = /\((\d+)\)$/ # we add (1), (2), (n) at the end of a filename if there is a duplicate
284
285
  parts = filename.split(".")
285
286
  ext = if parts.last =~ /gz|zip/ && parts.size > 2
@@ -297,7 +298,7 @@ class ZipTricks::Streamer
297
298
  fn_last_part = "#{fn_last_part} (#{duplicate_counter})"
298
299
  end
299
300
  new_filename = (parts + [fn_last_part, ext]).compact.join(".")
300
- return new_filename unless files.include?(new_filename)
301
+ return new_filename unless @filenames_set.include?(new_filename)
301
302
  duplicate_counter += 1
302
303
  end
303
304
  end
@@ -1,3 +1,3 @@
1
1
  module ZipTricks
2
- VERSION = '4.4.1'
2
+ VERSION = '4.4.2'
3
3
  end
data/zip_tricks.gemspec CHANGED
@@ -33,9 +33,11 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'rubyzip', '~> 1.1'
34
34
  spec.add_development_dependency 'terminal-table'
35
35
  spec.add_development_dependency 'range_utils'
36
+
36
37
  spec.add_development_dependency 'rack', '~> 1.6' # For Jeweler
37
38
  spec.add_development_dependency 'rake', '~> 10.4'
38
- spec.add_development_dependency "rspec", "~> 3.2.0", '< 3.3'
39
+ spec.add_development_dependency "rspec", "~> 3"
40
+ spec.add_development_dependency 'complexity_assert'
39
41
  spec.add_development_dependency 'coderay'
40
42
  spec.add_development_dependency "yard", "~> 0.9"
41
43
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zip_tricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.1
4
+ version: 4.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-04 00:00:00.000000000 Z
11
+ date: 2017-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,20 +100,28 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 3.2.0
104
- - - "<"
105
- - !ruby/object:Gem::Version
106
- version: '3.3'
103
+ version: '3'
107
104
  type: :development
108
105
  prerelease: false
109
106
  version_requirements: !ruby/object:Gem::Requirement
110
107
  requirements:
111
108
  - - "~>"
112
109
  - !ruby/object:Gem::Version
113
- version: 3.2.0
114
- - - "<"
110
+ version: '3'
111
+ - !ruby/object:Gem::Dependency
112
+ name: complexity_assert
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
115
116
  - !ruby/object:Gem::Version
116
- version: '3.3'
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
117
125
  - !ruby/object:Gem::Dependency
118
126
  name: coderay
119
127
  requirement: !ruby/object:Gem::Requirement
@@ -154,6 +162,7 @@ files:
154
162
  - ".rspec"
155
163
  - ".travis.yml"
156
164
  - ".yardopts"
165
+ - CHANGELOG.md
157
166
  - Gemfile
158
167
  - IMPLEMENTATION_DETAILS.md
159
168
  - LICENSE.txt
@@ -213,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
222
  version: '0'
214
223
  requirements: []
215
224
  rubyforge_project:
216
- rubygems_version: 2.4.5.1
225
+ rubygems_version: 2.6.11
217
226
  signing_key:
218
227
  specification_version: 4
219
228
  summary: Stream out ZIP files from Ruby