zip-container 5.0.0 → 6.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a530c28c4a1a55dd29e2f84a8ebafef6549271353f62f915625ae9756afbaf1
4
- data.tar.gz: c26a6e991c7ddf7f1ef86542addd4a44d2ea68a3abac69b049ca21718f20ac71
3
+ metadata.gz: 8e69fb9eb9080e5005ca5fc86fdc0e0b969c8e8133202052f8c611d6aa464fb7
4
+ data.tar.gz: e8a0304bbb0a37b40db0723711d2273fee038a911a5e1e9807b6ea2fb6a3346a
5
5
  SHA512:
6
- metadata.gz: e5ccf5519877655da4060b48b3084b830897c5aa51b739cf5e340a3c46c355d0bbf84adc84e638979c303d39081047b12a6dc8015c9233fb6eecabd60b63afd7
7
- data.tar.gz: 04ac82e77f79d02ad2445fa92095a89eaf642f6b713f84cfc0eddcb73f0ef716663bd234afd9ac586daccfa5f5d0d347a81687d26fd85607766b3e91008fef71
6
+ metadata.gz: 102ab9d00ed83fb7fb2117c72995b047fbc3325a494e2b9b6887fd4138a9513e43a7e770efd46b990344a43034df9fc4e9390834e26f58aa879dfece54ee1a93
7
+ data.tar.gz: 88192ce0b2a3c915e936ac3b0f165c91f968edf9e343829f4ad45852d9731a46c067acda5ae034775be2655fb026f101b50934a006668ee562df4692e9a59e60
data/CHANGES.md CHANGED
@@ -7,8 +7,8 @@
7
7
  * Add a code of conduct.
8
8
  * Add contributing guidelines.
9
9
  * Move to README.md (and update).
10
- * Update minimum ruby version required to 2.7.
11
- * Update RubyZip version to v2.4.
10
+ * Update minimum ruby version required to 3.0.
11
+ * Update RubyZip version to v3.0.
12
12
  * Ensure 'managed_directory' is required at the top-level.
13
13
  * Add note README about ruby and RubyZip versions.
14
14
  * Apply frozen_string_literal magic comment to all files.
@@ -17,6 +17,7 @@
17
17
 
18
18
  ### Internal/tooling:
19
19
 
20
+ * Add Ruby 3.4 to the CI tests.
20
21
  * Update Rake version.
21
22
  * Update and add metadata in the gemspec.
22
23
  * Just use a constant for the gem version string.
data/README.md CHANGED
@@ -22,15 +22,15 @@ If you are wanting to work with UCF files in particular, there is a Ruby Gem tha
22
22
 
23
23
  This library has two entry points.
24
24
 
25
- The main `ZipContainer::File` class largely mimics the rubyzip [`Zip::File`](https://www.rubydoc.info/gems/rubyzip/2.4.1/Zip/File) and [`Zip::FileSystem`](https://www.rubydoc.info/gems/rubyzip/2.4.1/Zip/FileSystem) APIs so much of what you can do with them are supported for ZIP Containers. There is also [API documentation](http://hainesr.github.io/ruby-zip-container/) with much more detail and any differences explained.
25
+ The main `ZipContainer::File` class largely mimics the rubyzip [`Zip::File`](https://www.rubydoc.info/gems/rubyzip/3.0.1/Zip/File) and [`Zip::FileSystem`](https://www.rubydoc.info/gems/rubyzip/3.0.1/Zip/FileSystem) APIs so much of what you can do with them are supported for ZIP Containers. There is also [API documentation](http://hainesr.github.io/ruby-zip-container/) with much more detail and any differences explained.
26
26
 
27
- The `ZipContainer::Dir` class mimics, where possible, the core ruby [`Dir` API](http://ruby-doc.org/core-1.9.3/Dir.html).
27
+ The `ZipContainer::Dir` class mimics, where possible, the core ruby [`Dir` API](https://rubyapi.org/3.0/o/dir).
28
28
 
29
29
  There are some examples of how to use the library provided in the examples directory. See the contents of the tests directory for even more.
30
30
 
31
31
  #### Versions
32
32
 
33
- Version 5 of this library will be the last to support Ruby 2.7 and the last to support RubyZip 2.4. Version 6 will require at least Ruby 3.0 and RubyZip 3.0.
33
+ Version 5 of this library was the last to support Ruby 2.7 and the last to support RubyZip 2.4. Version 6 requires at least Ruby 3.0 and RubyZip 3.0.
34
34
 
35
35
  ### What this library can not do yet
36
36
 
@@ -66,8 +66,8 @@ module ZipContainer
66
66
  # Here we fake up the connection to the rubyzip filesystem classes so
67
67
  # that they also respect the reserved names that we define.
68
68
  mapped_zip = ::Zip::FileSystem::ZipFileNameMapper.new(self)
69
- @fs_dir = ::Zip::FileSystem::ZipFsDir.new(mapped_zip)
70
- @fs_file = ::Zip::FileSystem::ZipFsFile.new(mapped_zip)
69
+ @fs_dir = ::Zip::FileSystem::Dir.new(mapped_zip)
70
+ @fs_file = ::Zip::FileSystem::File.new(mapped_zip)
71
71
  @fs_dir.file = @fs_file
72
72
  @fs_file.dir = @fs_dir
73
73
  end
@@ -79,8 +79,13 @@ module ZipContainer
79
79
  #
80
80
  # Create a new ZipContainer file on disk with the specified mimetype.
81
81
  def self.create(filename, mimetype)
82
- ::Zip::OutputStream.open(filename) do |stream|
83
- stream.put_next_entry(MIMETYPE_FILE, nil, nil, ::Zip::Entry::STORED)
82
+ # The mimetype file must be first in the archive, and uncompressed.
83
+ mimetype_entry = Zip::Entry.new(
84
+ nil, MIMETYPE_FILE, compression_method: Zip::Entry::STORED
85
+ )
86
+
87
+ Zip::OutputStream.open(filename) do |stream|
88
+ stream.put_next_entry(mimetype_entry)
84
89
  stream.write mimetype
85
90
  end
86
91
 
@@ -155,7 +160,7 @@ module ZipContainer
155
160
  alias close commit
156
161
 
157
162
  # :call-seq:
158
- # dir -> Zip::ZipFsDir
163
+ # dir -> Zip::FileSystem::Dir
159
164
  #
160
165
  # Returns an object which can be used like ruby's built in +Dir+ (class)
161
166
  # object, except that it works on the ZipContainer file on which this
@@ -167,7 +172,7 @@ module ZipContainer
167
172
  end
168
173
 
169
174
  # :call-seq:
170
- # file -> Zip::ZipFsFile
175
+ # file -> Zip::FileSystem::File
171
176
  #
172
177
  # Returns an object which can be used like ruby's built in +File+ (class)
173
178
  # object, except that it works on the ZipContainer file on which this
@@ -209,8 +214,8 @@ module ZipContainer
209
214
  end
210
215
 
211
216
  # :call-seq:
212
- # get_output_stream(entry, permission = nil) -> stream
213
- # get_output_stream(entry, permission = nil) {|stream| ...}
217
+ # get_output_stream(entry, permissions: nil) -> stream
218
+ # get_output_stream(entry, permissions: nil) {|stream| ...}
214
219
  #
215
220
  # Returns an output stream to the specified entry. If a block is passed
216
221
  # the stream object is passed to the block and the stream is automatically
@@ -218,12 +223,12 @@ module ZipContainer
218
223
  #
219
224
  # See the rubyzip documentation for details of the +permission_int+
220
225
  # parameter.
221
- def get_output_stream(entry, permission = nil, &block)
226
+ def get_output_stream(entry, permissions: nil, &block)
222
227
  if reserved_entry?(entry) || managed_directory?(entry)
223
228
  raise ReservedNameClashError, entry.to_s
224
229
  end
225
230
 
226
- @container.get_output_stream(entry, permission, &block)
231
+ @container.get_output_stream(entry, permissions: permissions, &block)
227
232
  end
228
233
 
229
234
  # :call-seq:
@@ -32,7 +32,7 @@
32
32
  #
33
33
  # Author: Robert Haines
34
34
 
35
- require 'zip' # Remove this when we update to rubyzip 3.x.
35
+ require 'zip' # Remove this when rubyzip fixes its require tree.
36
36
  require 'zip/entry'
37
37
 
38
38
  ##
@@ -32,6 +32,8 @@
32
32
  #
33
33
  # Author: Robert Haines
34
34
 
35
+ ##
35
36
  module ZipContainer
36
- VERSION = '5.0.0' # :nodoc:
37
+ # The current version of the ZipContainer library.
38
+ VERSION = '6.0.0'
37
39
  end
data/lib/zip-container.rb CHANGED
@@ -32,6 +32,7 @@
32
32
  #
33
33
  # Author: Robert Haines
34
34
 
35
+ require_relative 'zip-container/version'
35
36
  require_relative 'zip-container/file'
36
37
  require_relative 'zip-container/dir'
37
38
  require_relative 'zip-container/managed_directory'
@@ -63,9 +63,9 @@ Gem::Specification.new do |s|
63
63
  'rubygems_mfa_required' => 'true'
64
64
  }
65
65
 
66
- s.required_ruby_version = '>= 2.7'
66
+ s.required_ruby_version = '>= 3.0'
67
67
 
68
- s.add_runtime_dependency 'rubyzip', '~> 2.4'
68
+ s.add_runtime_dependency 'rubyzip', '~> 3.0'
69
69
 
70
70
  s.add_development_dependency 'minitest', '~> 5.25'
71
71
  s.add_development_dependency 'os', '~> 1.1.4'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zip-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Haines
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-08-09 00:00:00.000000000 Z
12
+ date: 2025-08-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubyzip
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '2.4'
20
+ version: '3.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '2.4'
27
+ version: '3.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: minitest
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -205,9 +205,9 @@ licenses:
205
205
  - BSD
206
206
  metadata:
207
207
  bug_tracker_uri: https://github.com/hainesr/ruby-zip-container/issues
208
- changelog_uri: https://github.com/hainesr/ruby-zip-container/blob/v5.0.0/CHANGES.md
208
+ changelog_uri: https://github.com/hainesr/ruby-zip-container/blob/v6.0.0/CHANGES.md
209
209
  documentation_uri: https://hainesr.github.io/ruby-zip-container
210
- source_code_uri: https://github.com/hainesr/ruby-zip-container/tree/v5.0.0
210
+ source_code_uri: https://github.com/hainesr/ruby-zip-container/tree/v6.0.0
211
211
  rubygems_mfa_required: 'true'
212
212
  post_install_message:
213
213
  rdoc_options: []
@@ -217,7 +217,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
217
217
  requirements:
218
218
  - - ">="
219
219
  - !ruby/object:Gem::Version
220
- version: '2.7'
220
+ version: '3.0'
221
221
  required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  requirements:
223
223
  - - ">="