rubyzip 2.0.0 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,11 @@
1
1
  module Zip
2
2
  class StreamableDirectory < Entry
3
- def initialize(zipfile, entry, srcPath = nil, permissionInt = nil)
3
+ def initialize(zipfile, entry, src_path = nil, permission = nil)
4
4
  super(zipfile, entry)
5
5
 
6
6
  @ftype = :directory
7
- entry.get_extra_attributes_from_path(srcPath) if srcPath
8
- @unix_perms = permissionInt if permissionInt
7
+ entry.get_extra_attributes_from_path(src_path) if src_path
8
+ @unix_perms = permission if permission
9
9
  end
10
10
  end
11
11
  end
@@ -1,13 +1,8 @@
1
1
  module Zip
2
- class StreamableStream < DelegateClass(Entry) # nodoc:all
2
+ class StreamableStream < DelegateClass(Entry) # :nodoc:all
3
3
  def initialize(entry)
4
4
  super(entry)
5
- dirname = if zipfile.is_a?(::String)
6
- ::File.dirname(zipfile)
7
- else
8
- nil
9
- end
10
- @temp_file = Tempfile.new(::File.basename(name), dirname)
5
+ @temp_file = Tempfile.new(::File.basename(name))
11
6
  @temp_file.binmode
12
7
  end
13
8
 
@@ -27,6 +22,7 @@ module Zip
27
22
  unless @temp_file.closed?
28
23
  raise StandardError, "cannot open entry for reading while its open for writing - #{name}"
29
24
  end
25
+
30
26
  @temp_file.open # reopens tempfile from top
31
27
  @temp_file.binmode
32
28
  if block_given?
@@ -40,9 +36,9 @@ module Zip
40
36
  end
41
37
  end
42
38
 
43
- def write_to_zip_output_stream(aZipOutputStream)
44
- aZipOutputStream.put_next_entry(self)
45
- get_input_stream { |is| ::Zip::IOExtras.copy_stream(aZipOutputStream, is) }
39
+ def write_to_zip_output_stream(output_stream)
40
+ output_stream.put_next_entry(self)
41
+ get_input_stream { |is| ::Zip::IOExtras.copy_stream(output_stream, is) }
46
42
  end
47
43
 
48
44
  def clean_up
data/lib/zip/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Zip
2
- VERSION = '2.0.0'
2
+ VERSION = '2.3.2'
3
3
  end
data/samples/example.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $: << '../lib'
3
+ $LOAD_PATH << '../lib'
4
4
  system('zip example.zip example.rb gtk_ruby_zip.rb')
5
5
 
6
6
  require 'zip'
@@ -71,7 +71,7 @@ puts "Zip file splitted in #{part_zips_count} parts"
71
71
 
72
72
  # Track splitting an archive
73
73
  Zip::File.split('large_zip_file.zip', 1_048_576, true, 'part_zip_file') do |part_count, part_index, chunk_bytes, segment_bytes|
74
- puts "#{part_index} of #{part_count} part splitting: #{(chunk_bytes.to_f / segment_bytes.to_f * 100).to_i}%"
74
+ puts "#{part_index} of #{part_count} part splitting: #{(chunk_bytes.to_f / segment_bytes * 100).to_i}%"
75
75
  end
76
76
 
77
77
  # For other examples, look at zip.rb and ziptest.rb
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $: << '../lib'
3
+ $LOAD_PATH << '../lib'
4
4
 
5
5
  require 'zip/filesystem'
6
6
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $: << '../lib'
3
+ $LOAD_PATH << '../lib'
4
4
 
5
5
  $VERBOSE = true
6
6
 
@@ -18,14 +18,14 @@ class MainApp < Gtk::Window
18
18
  add(box)
19
19
 
20
20
  @zipfile = nil
21
- @buttonPanel = ButtonPanel.new
22
- @buttonPanel.openButton.signal_connect(Gtk::Button::SIGNAL_CLICKED) do
21
+ @button_panel = ButtonPanel.new
22
+ @button_panel.open_button.signal_connect(Gtk::Button::SIGNAL_CLICKED) do
23
23
  show_file_selector
24
24
  end
25
- @buttonPanel.extractButton.signal_connect(Gtk::Button::SIGNAL_CLICKED) do
25
+ @button_panel.extract_button.signal_connect(Gtk::Button::SIGNAL_CLICKED) do
26
26
  puts 'Not implemented!'
27
27
  end
28
- box.pack_start(@buttonPanel, false, false, 0)
28
+ box.pack_start(@button_panel, false, false, 0)
29
29
 
30
30
  sw = Gtk::ScrolledWindow.new
31
31
  sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
@@ -42,27 +42,27 @@ class MainApp < Gtk::Window
42
42
  end
43
43
 
44
44
  class ButtonPanel < Gtk::HButtonBox
45
- attr_reader :openButton, :extractButton
45
+ attr_reader :open_button, :extract_button
46
46
  def initialize
47
47
  super
48
48
  set_layout(Gtk::BUTTONBOX_START)
49
49
  set_spacing(0)
50
- @openButton = Gtk::Button.new('Open archive')
51
- @extractButton = Gtk::Button.new('Extract entry')
52
- pack_start(@openButton)
53
- pack_start(@extractButton)
50
+ @open_button = Gtk::Button.new('Open archive')
51
+ @extract_button = Gtk::Button.new('Extract entry')
52
+ pack_start(@open_button)
53
+ pack_start(@extract_button)
54
54
  end
55
55
  end
56
56
 
57
57
  def show_file_selector
58
- @fileSelector = Gtk::FileSelection.new('Open zip file')
59
- @fileSelector.show
60
- @fileSelector.ok_button.signal_connect(Gtk::Button::SIGNAL_CLICKED) do
61
- open_zip(@fileSelector.filename)
62
- @fileSelector.destroy
58
+ @file_selector = Gtk::FileSelection.new('Open zip file')
59
+ @file_selector.show
60
+ @file_selector.ok_button.signal_connect(Gtk::Button::SIGNAL_CLICKED) do
61
+ open_zip(@file_selector.filename)
62
+ @file_selector.destroy
63
63
  end
64
- @fileSelector.cancel_button.signal_connect(Gtk::Button::SIGNAL_CLICKED) do
65
- @fileSelector.destroy
64
+ @file_selector.cancel_button.signal_connect(Gtk::Button::SIGNAL_CLICKED) do
65
+ @file_selector.destroy
66
66
  end
67
67
  end
68
68
 
@@ -77,8 +77,8 @@ class MainApp < Gtk::Window
77
77
  end
78
78
  end
79
79
 
80
- mainApp = MainApp.new
80
+ main_app = MainApp.new
81
81
 
82
- mainApp.show_all
82
+ main_app.show_all
83
83
 
84
84
  Gtk.main
data/samples/qtzip.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  $VERBOSE = true
4
4
 
5
- $: << '../lib'
5
+ $LOAD_PATH << '../lib'
6
6
 
7
7
  require 'Qt'
8
8
  system('rbuic -o zipdialogui.rb zipdialogui.ui')
@@ -20,12 +20,12 @@ class ZipDialog < ZipDialogUI
20
20
  self, SLOT('extract_files()'))
21
21
  end
22
22
 
23
- def zipfile(&proc)
24
- Zip::File.open(@zip_filename, &proc)
23
+ def zipfile(&a_proc)
24
+ Zip::File.open(@zip_filename, &a_proc)
25
25
  end
26
26
 
27
- def each(&proc)
28
- Zip::File.foreach(@zip_filename, &proc)
27
+ def each(&a_proc)
28
+ Zip::File.foreach(@zip_filename, &a_proc)
29
29
  end
30
30
 
31
31
  def refresh
@@ -80,7 +80,7 @@ class ZipDialog < ZipDialogUI
80
80
  end
81
81
 
82
82
  unless ARGV[0]
83
- puts "usage: #{$0} zipname"
83
+ puts "usage: #{$PROGRAM_NAME} zipname"
84
84
  exit
85
85
  end
86
86
 
@@ -1,12 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $: << '../lib'
3
+ $LOAD_PATH << '../lib'
4
4
 
5
5
  require 'zip'
6
6
 
7
- include Zip
8
-
9
- OutputStream.open('simple.zip') do |zos|
7
+ ::Zip::OutputStream.open('simple.zip') do |zos|
10
8
  zos.put_next_entry 'entry.txt'
11
9
  zos.puts 'Hello world'
12
10
  end
data/samples/zipfind.rb CHANGED
@@ -2,36 +2,37 @@
2
2
 
3
3
  $VERBOSE = true
4
4
 
5
- $: << '../lib'
5
+ $LOAD_PATH << '../lib'
6
6
 
7
7
  require 'zip'
8
8
  require 'find'
9
9
 
10
10
  module Zip
11
11
  module ZipFind
12
- def self.find(path, zipFilePattern = /\.zip$/i)
13
- Find.find(path) do |fileName|
14
- yield(fileName)
15
- next unless zipFilePattern.match(fileName) && File.file?(fileName)
12
+ def self.find(path, zip_file_pattern = /\.zip$/i)
13
+ Find.find(path) do |filename|
14
+ yield(filename)
15
+ next unless zip_file_pattern.match(filename) && File.file?(filename)
16
+
16
17
  begin
17
- Zip::File.foreach(fileName) do |zipEntry|
18
- yield(fileName + File::SEPARATOR + zipEntry.to_s)
18
+ Zip::File.foreach(filename) do |entry|
19
+ yield(filename + File::SEPARATOR + entry.to_s)
19
20
  end
20
- rescue Errno::EACCES => ex
21
- puts ex
21
+ rescue Errno::EACCES => e
22
+ puts e
22
23
  end
23
24
  end
24
25
  end
25
26
 
26
- def self.find_file(path, fileNamePattern, zipFilePattern = /\.zip$/i)
27
- find(path, zipFilePattern) do |fileName|
28
- yield(fileName) if fileNamePattern.match(fileName)
27
+ def self.find_file(path, filename_pattern, zip_file_pattern = /\.zip$/i)
28
+ find(path, zip_file_pattern) do |filename|
29
+ yield(filename) if filename_pattern.match(filename)
29
30
  end
30
31
  end
31
32
  end
32
33
  end
33
34
 
34
- if $0 == __FILE__
35
+ if $PROGRAM_NAME == __FILE__
35
36
  module ZipFindConsoleRunner
36
37
  PATH_ARG_INDEX = 0
37
38
  FILENAME_PATTERN_ARG_INDEX = 1
@@ -41,24 +42,24 @@ if $0 == __FILE__
41
42
  check_args(args)
42
43
  Zip::ZipFind.find_file(args[PATH_ARG_INDEX],
43
44
  args[FILENAME_PATTERN_ARG_INDEX],
44
- args[ZIPFILE_PATTERN_ARG_INDEX]) do |fileName|
45
- report_entry_found fileName
45
+ args[ZIPFILE_PATTERN_ARG_INDEX]) do |filename|
46
+ report_entry_found filename
46
47
  end
47
48
  end
48
49
 
49
50
  def self.check_args(args)
50
- if args.size != 3
51
- usage
52
- exit
53
- end
51
+ return if args.size == 3
52
+
53
+ usage
54
+ exit
54
55
  end
55
56
 
56
57
  def self.usage
57
- puts "Usage: #{$0} PATH ZIPFILENAME_PATTERN FILNAME_PATTERN"
58
+ puts "Usage: #{$PROGRAM_NAME} PATH ZIPFILENAME_PATTERN FILNAME_PATTERN"
58
59
  end
59
60
 
60
- def self.report_entry_found(fileName)
61
- puts fileName
61
+ def self.report_entry_found(filename)
62
+ puts filename
62
63
  end
63
64
  end
64
65
 
metadata CHANGED
@@ -1,85 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyzip
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Simonov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-25 00:00:00.000000000 Z
11
+ date: 2021-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: coveralls
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '10.3'
19
+ version: '0.7'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '10.3'
26
+ version: '0.7'
27
27
  - !ruby/object:Gem::Dependency
28
- name: pry
28
+ name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.10'
33
+ version: '5.4'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.10'
40
+ version: '5.4'
41
41
  - !ruby/object:Gem::Dependency
42
- name: minitest
42
+ name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '5.4'
47
+ version: '0.10'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '5.4'
54
+ version: '0.10'
55
55
  - !ruby/object:Gem::Dependency
56
- name: coveralls
56
+ name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.7'
61
+ version: '12.3'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 12.3.3
62
65
  type: :development
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
65
68
  requirements:
66
69
  - - "~>"
67
70
  - !ruby/object:Gem::Version
68
- version: '0.7'
71
+ version: '12.3'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 12.3.3
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: rubocop
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
79
  - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: 0.49.1
81
+ version: '0.79'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: 0.49.1
88
+ version: '0.79'
83
89
  description:
84
90
  email:
85
91
  - alex@simonov.me
@@ -94,6 +100,7 @@ files:
94
100
  - lib/zip/central_directory.rb
95
101
  - lib/zip/compressor.rb
96
102
  - lib/zip/constants.rb
103
+ - lib/zip/crypto/decrypted_io.rb
97
104
  - lib/zip/crypto/encryption.rb
98
105
  - lib/zip/crypto/null_encryption.rb
99
106
  - lib/zip/crypto/traditional_encryption.rb
@@ -139,11 +146,27 @@ licenses:
139
146
  - BSD 2-Clause
140
147
  metadata:
141
148
  bug_tracker_uri: https://github.com/rubyzip/rubyzip/issues
142
- changelog_uri: https://github.com/rubyzip/rubyzip/blob/v2.0.0/Changelog.md
143
- documentation_uri: https://www.rubydoc.info/gems/rubyzip/2.0.0
144
- source_code_uri: https://github.com/rubyzip/rubyzip/tree/v2.0.0
149
+ changelog_uri: https://github.com/rubyzip/rubyzip/blob/v2.3.2/Changelog.md
150
+ documentation_uri: https://www.rubydoc.info/gems/rubyzip/2.3.2
151
+ source_code_uri: https://github.com/rubyzip/rubyzip/tree/v2.3.2
145
152
  wiki_uri: https://github.com/rubyzip/rubyzip/wiki
146
- post_install_message:
153
+ post_install_message: |
154
+ RubyZip 3.0 is coming!
155
+ **********************
156
+
157
+ The public API of some Rubyzip classes has been modernized to use named
158
+ parameters for optional arguments. Please check your usage of the
159
+ following classes:
160
+ * `Zip::File`
161
+ * `Zip::Entry`
162
+ * `Zip::InputStream`
163
+ * `Zip::OutputStream`
164
+
165
+ Please ensure that your Gemfiles and .gemspecs are suitably restrictive
166
+ to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.3.0).
167
+ See https://github.com/rubyzip/rubyzip for details. The Changelog also
168
+ lists other enhancements and bugfixes that have been implemented since
169
+ version 2.3.0.
147
170
  rdoc_options: []
148
171
  require_paths:
149
172
  - lib
@@ -158,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
181
  - !ruby/object:Gem::Version
159
182
  version: '0'
160
183
  requirements: []
161
- rubygems_version: 3.0.3
184
+ rubygems_version: 3.1.4
162
185
  signing_key:
163
186
  specification_version: 4
164
187
  summary: rubyzip is a ruby module for reading and writing zip files