rubyzip 3.0.2 → 3.2.2

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.
@@ -29,7 +29,7 @@ module Zip
29
29
 
30
30
  # Opens the indicated zip file. If a file with that name already
31
31
  # exists it will be overwritten.
32
- def initialize(file_name, stream: false, encrypter: nil)
32
+ def initialize(file_name, stream: false, encrypter: nil, suppress_extra_fields: false)
33
33
  super()
34
34
  @file_name = file_name
35
35
  @output_stream = if stream
@@ -43,6 +43,7 @@ module Zip
43
43
  @cdir = ::Zip::CentralDirectory.new
44
44
  @compressor = ::Zip::NullCompressor.instance
45
45
  @encrypter = encrypter || ::Zip::NullEncrypter.new
46
+ @suppress_extra_fields = suppress_extra_fields
46
47
  @closed = false
47
48
  @current_entry = nil
48
49
  end
@@ -51,19 +52,21 @@ module Zip
51
52
  # Same as #initialize but if a block is passed the opened
52
53
  # stream is passed to the block and closed when the block
53
54
  # returns.
54
- def open(file_name, encrypter: nil)
55
+ def open(file_name, encrypter: nil, suppress_extra_fields: false)
55
56
  return new(file_name) unless block_given?
56
57
 
57
- zos = new(file_name, stream: false, encrypter: encrypter)
58
+ zos = new(file_name, stream: false, encrypter: encrypter,
59
+ suppress_extra_fields: suppress_extra_fields)
58
60
  yield zos
59
61
  ensure
60
62
  zos.close if zos
61
63
  end
62
64
 
63
65
  # Same as #open but writes to a filestream instead
64
- def write_buffer(io = ::StringIO.new, encrypter: nil)
66
+ def write_buffer(io = ::StringIO.new, encrypter: nil, suppress_extra_fields: false)
65
67
  io.binmode if io.respond_to?(:binmode)
66
- zos = new(io, stream: true, encrypter: encrypter)
68
+ zos = new(io, stream: true, encrypter: encrypter,
69
+ suppress_extra_fields: suppress_extra_fields)
67
70
  yield zos
68
71
  zos.close_buffer
69
72
  end
@@ -75,7 +78,7 @@ module Zip
75
78
 
76
79
  finalize_current_entry
77
80
  update_local_headers
78
- @cdir.write_to_stream(@output_stream)
81
+ @cdir.write_to_stream(@output_stream, suppress_extra_fields: @suppress_extra_fields)
79
82
  @output_stream.close
80
83
  @closed = true
81
84
  end
@@ -86,7 +89,7 @@ module Zip
86
89
 
87
90
  finalize_current_entry
88
91
  update_local_headers
89
- @cdir.write_to_stream(@output_stream)
92
+ @cdir.write_to_stream(@output_stream, suppress_extra_fields: @suppress_extra_fields)
90
93
  @closed = true
91
94
  @output_stream.flush
92
95
  @output_stream
@@ -157,7 +160,7 @@ module Zip
157
160
  def init_next_entry(entry)
158
161
  finalize_current_entry
159
162
  @cdir << entry
160
- entry.write_local_entry(@output_stream)
163
+ entry.write_local_entry(@output_stream, suppress_extra_fields: @suppress_extra_fields)
161
164
  @encrypter.reset!
162
165
  @output_stream << @encrypter.header(entry.mtime)
163
166
  @compressor = get_compressor(entry)
@@ -178,7 +181,8 @@ module Zip
178
181
  pos = @output_stream.pos
179
182
  @cdir.each do |entry|
180
183
  @output_stream.pos = entry.local_header_offset
181
- entry.write_local_entry(@output_stream, rewrite: true)
184
+ entry.write_local_entry(@output_stream, suppress_extra_fields: @suppress_extra_fields,
185
+ rewrite: true)
182
186
  end
183
187
  @output_stream.pos = pos
184
188
  end
@@ -8,7 +8,7 @@ module Zip
8
8
  end
9
9
 
10
10
  def read(length = nil, outbuf = +'')
11
- return (length.nil? || length.zero? ? '' : nil) if eof
11
+ return (length.nil? || length.zero? ? '' : nil) if eof?
12
12
 
13
13
  if length.nil? || (@read_so_far + length) > decompressed_size
14
14
  length = decompressed_size - @read_so_far
@@ -18,11 +18,12 @@ module Zip
18
18
  input_stream.read(length, outbuf)
19
19
  end
20
20
 
21
- def eof
21
+ def eof?
22
22
  @read_so_far >= decompressed_size
23
23
  end
24
24
 
25
- alias eof? eof
25
+ # Alias for compatibility. Remove for version 4.
26
+ alias eof eof?
26
27
  end
27
28
 
28
29
  ::Zip::Decompressor.register(::Zip::COMPRESSION_METHOD_STORE, ::Zip::PassThruDecompressor)
@@ -3,7 +3,7 @@
3
3
  module Zip
4
4
  class StreamableStream < DelegateClass(Entry) # :nodoc:all
5
5
  def initialize(entry)
6
- super(entry)
6
+ super
7
7
  @temp_file = Tempfile.new(::File.basename(name))
8
8
  @temp_file.binmode
9
9
  end
data/lib/zip/version.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zip
4
- VERSION = '3.0.2'
4
+ # The version of the Rubyzip library.
5
+ VERSION = '3.2.2'
5
6
  end
data/lib/zip.rb CHANGED
@@ -30,6 +30,7 @@ require 'zip/crypto/decrypted_io'
30
30
  require 'zip/crypto/encryption'
31
31
  require 'zip/crypto/null_encryption'
32
32
  require 'zip/crypto/traditional_encryption'
33
+ require 'zip/crypto/aes_encryption'
33
34
  require 'zip/inflater'
34
35
  require 'zip/deflater'
35
36
  require 'zip/streamable_stream'
@@ -43,6 +44,7 @@ require 'zip/errors'
43
44
  # ::Dir APIs then `require 'zip/filesystem'` and see FileSystem.
44
45
  module Zip
45
46
  extend self
47
+
46
48
  attr_accessor :unicode_names,
47
49
  :on_exists_proc,
48
50
  :continue_on_exists_proc,
data/rubyzip.gemspec CHANGED
@@ -31,9 +31,9 @@ Gem::Specification.new do |s|
31
31
  s.add_development_dependency 'minitest', '~> 5.25'
32
32
  s.add_development_dependency 'rake', '~> 13.2'
33
33
  s.add_development_dependency 'rdoc', '~> 6.11'
34
- s.add_development_dependency 'rubocop', '~> 1.61.0'
35
- s.add_development_dependency 'rubocop-performance', '~> 1.20.0'
36
- s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
34
+ s.add_development_dependency 'rubocop', '~> 1.80.2'
35
+ s.add_development_dependency 'rubocop-performance', '~> 1.26.0'
36
+ s.add_development_dependency 'rubocop-rake', '~> 0.7.1'
37
37
  s.add_development_dependency 'simplecov', '~> 0.22.0'
38
38
  s.add_development_dependency 'simplecov-lcov', '~> 0.8'
39
39
  end
@@ -10,7 +10,7 @@ require 'zip'
10
10
 
11
11
  class MainApp < Gtk::Window
12
12
  def initialize
13
- super()
13
+ super
14
14
  set_usize(400, 256)
15
15
  set_title('rubyzip')
16
16
  signal_connect(Gtk::Window::SIGNAL_DESTROY) { Gtk.main_quit }
data/samples/qtzip.rb CHANGED
@@ -14,7 +14,7 @@ a = Qt::Application.new(ARGV)
14
14
 
15
15
  class ZipDialog < ZipDialogUI
16
16
  def initialize
17
- super()
17
+ super
18
18
  connect(child('add_button'), SIGNAL('clicked()'),
19
19
  self, SLOT('add_files()'))
20
20
  connect(child('extract_button'), SIGNAL('clicked()'),
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyzip
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Haines
8
8
  - John Lees-Miller
9
9
  - Alexander Simonov
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2025-08-21 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: minitest
@@ -60,42 +59,42 @@ dependencies:
60
59
  requirements:
61
60
  - - "~>"
62
61
  - !ruby/object:Gem::Version
63
- version: 1.61.0
62
+ version: 1.80.2
64
63
  type: :development
65
64
  prerelease: false
66
65
  version_requirements: !ruby/object:Gem::Requirement
67
66
  requirements:
68
67
  - - "~>"
69
68
  - !ruby/object:Gem::Version
70
- version: 1.61.0
69
+ version: 1.80.2
71
70
  - !ruby/object:Gem::Dependency
72
71
  name: rubocop-performance
73
72
  requirement: !ruby/object:Gem::Requirement
74
73
  requirements:
75
74
  - - "~>"
76
75
  - !ruby/object:Gem::Version
77
- version: 1.20.0
76
+ version: 1.26.0
78
77
  type: :development
79
78
  prerelease: false
80
79
  version_requirements: !ruby/object:Gem::Requirement
81
80
  requirements:
82
81
  - - "~>"
83
82
  - !ruby/object:Gem::Version
84
- version: 1.20.0
83
+ version: 1.26.0
85
84
  - !ruby/object:Gem::Dependency
86
85
  name: rubocop-rake
87
86
  requirement: !ruby/object:Gem::Requirement
88
87
  requirements:
89
88
  - - "~>"
90
89
  - !ruby/object:Gem::Version
91
- version: 0.6.0
90
+ version: 0.7.1
92
91
  type: :development
93
92
  prerelease: false
94
93
  version_requirements: !ruby/object:Gem::Requirement
95
94
  requirements:
96
95
  - - "~>"
97
96
  - !ruby/object:Gem::Version
98
- version: 0.6.0
97
+ version: 0.7.1
99
98
  - !ruby/object:Gem::Dependency
100
99
  name: simplecov
101
100
  requirement: !ruby/object:Gem::Requirement
@@ -124,7 +123,6 @@ dependencies:
124
123
  - - "~>"
125
124
  - !ruby/object:Gem::Version
126
125
  version: '0.8'
127
- description:
128
126
  email:
129
127
  - hainesr@gmail.com
130
128
  - jdleesmiller@gmail.com
@@ -141,6 +139,7 @@ files:
141
139
  - lib/zip/central_directory.rb
142
140
  - lib/zip/compressor.rb
143
141
  - lib/zip/constants.rb
142
+ - lib/zip/crypto/aes_encryption.rb
144
143
  - lib/zip/crypto/decrypted_io.rb
145
144
  - lib/zip/crypto/encryption.rb
146
145
  - lib/zip/crypto/null_encryption.rb
@@ -153,6 +152,7 @@ files:
153
152
  - lib/zip/entry_set.rb
154
153
  - lib/zip/errors.rb
155
154
  - lib/zip/extra_field.rb
155
+ - lib/zip/extra_field/aes.rb
156
156
  - lib/zip/extra_field/generic.rb
157
157
  - lib/zip/extra_field/ntfs.rb
158
158
  - lib/zip/extra_field/old_unix.rb
@@ -195,12 +195,11 @@ licenses:
195
195
  - BSD-2-Clause
196
196
  metadata:
197
197
  bug_tracker_uri: https://github.com/rubyzip/rubyzip/issues
198
- changelog_uri: https://github.com/rubyzip/rubyzip/blob/v3.0.2/Changelog.md
199
- documentation_uri: https://www.rubydoc.info/gems/rubyzip/3.0.2
200
- source_code_uri: https://github.com/rubyzip/rubyzip/tree/v3.0.2
198
+ changelog_uri: https://github.com/rubyzip/rubyzip/blob/v3.2.2/Changelog.md
199
+ documentation_uri: https://www.rubydoc.info/gems/rubyzip/3.2.2
200
+ source_code_uri: https://github.com/rubyzip/rubyzip/tree/v3.2.2
201
201
  wiki_uri: https://github.com/rubyzip/rubyzip/wiki
202
202
  rubygems_mfa_required: 'true'
203
- post_install_message:
204
203
  rdoc_options: []
205
204
  require_paths:
206
205
  - lib
@@ -215,8 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
214
  - !ruby/object:Gem::Version
216
215
  version: '0'
217
216
  requirements: []
218
- rubygems_version: 3.4.1
219
- signing_key:
217
+ rubygems_version: 3.7.2
220
218
  specification_version: 4
221
219
  summary: rubyzip is a ruby module for reading and writing zip files
222
220
  test_files: []