rubyzip 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -0
- data/lib/zip.rb +1 -0
- data/lib/zip/central_directory.rb +9 -5
- data/lib/zip/constants.rb +18 -18
- data/lib/zip/crypto/decrypted_io.rb +4 -3
- data/lib/zip/crypto/traditional_encryption.rb +9 -9
- data/lib/zip/dos_time.rb +7 -7
- data/lib/zip/entry.rb +35 -28
- data/lib/zip/entry_set.rb +2 -0
- data/lib/zip/extra_field.rb +11 -9
- data/lib/zip/extra_field/generic.rb +9 -8
- data/lib/zip/extra_field/ntfs.rb +4 -0
- data/lib/zip/extra_field/old_unix.rb +3 -1
- data/lib/zip/extra_field/universal_time.rb +3 -0
- data/lib/zip/extra_field/unix.rb +3 -1
- data/lib/zip/extra_field/zip64.rb +4 -2
- data/lib/zip/file.rb +49 -38
- data/lib/zip/filesystem.rb +193 -177
- data/lib/zip/inflater.rb +5 -3
- data/lib/zip/input_stream.rb +6 -3
- data/lib/zip/ioextras.rb +1 -1
- data/lib/zip/ioextras/abstract_input_stream.rb +14 -9
- data/lib/zip/ioextras/abstract_output_stream.rb +1 -1
- data/lib/zip/output_stream.rb +14 -5
- data/lib/zip/pass_thru_compressor.rb +2 -2
- data/lib/zip/pass_thru_decompressor.rb +2 -2
- data/lib/zip/streamable_directory.rb +3 -3
- data/lib/zip/streamable_stream.rb +5 -4
- data/lib/zip/version.rb +1 -1
- data/samples/example.rb +2 -2
- data/samples/example_filesystem.rb +1 -1
- data/samples/gtk_ruby_zip.rb +19 -19
- data/samples/qtzip.rb +6 -6
- data/samples/write_simple.rb +2 -4
- data/samples/zipfind.rb +23 -22
- metadata +25 -19
data/samples/write_simple.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
$LOAD_PATH << '../lib'
|
4
4
|
|
5
5
|
require 'zip'
|
6
6
|
|
7
|
-
|
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
|
-
|
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,
|
13
|
-
Find.find(path) do |
|
14
|
-
yield(
|
15
|
-
next unless
|
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(
|
18
|
-
yield(
|
18
|
+
Zip::File.foreach(filename) do |entry|
|
19
|
+
yield(filename + File::SEPARATOR + entry.to_s)
|
19
20
|
end
|
20
|
-
rescue Errno::EACCES =>
|
21
|
-
puts
|
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,
|
27
|
-
find(path,
|
28
|
-
yield(
|
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 $
|
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 |
|
45
|
-
report_entry_found
|
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
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
return if args.size == 3
|
52
|
+
|
53
|
+
usage
|
54
|
+
exit
|
54
55
|
end
|
55
56
|
|
56
57
|
def self.usage
|
57
|
-
puts "Usage: #{$
|
58
|
+
puts "Usage: #{$PROGRAM_NAME} PATH ZIPFILENAME_PATTERN FILNAME_PATTERN"
|
58
59
|
end
|
59
60
|
|
60
|
-
def self.report_entry_found(
|
61
|
-
puts
|
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.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Simonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: coveralls
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
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: '
|
26
|
+
version: '0.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
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: '
|
40
|
+
version: '5.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
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: '
|
54
|
+
version: '0.10'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
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: '
|
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.
|
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.
|
88
|
+
version: '0.79'
|
83
89
|
description:
|
84
90
|
email:
|
85
91
|
- alex@simonov.me
|
@@ -140,9 +146,9 @@ licenses:
|
|
140
146
|
- BSD 2-Clause
|
141
147
|
metadata:
|
142
148
|
bug_tracker_uri: https://github.com/rubyzip/rubyzip/issues
|
143
|
-
changelog_uri: https://github.com/rubyzip/rubyzip/blob/v2.
|
144
|
-
documentation_uri: https://www.rubydoc.info/gems/rubyzip/2.
|
145
|
-
source_code_uri: https://github.com/rubyzip/rubyzip/tree/v2.
|
149
|
+
changelog_uri: https://github.com/rubyzip/rubyzip/blob/v2.3.0/Changelog.md
|
150
|
+
documentation_uri: https://www.rubydoc.info/gems/rubyzip/2.3.0
|
151
|
+
source_code_uri: https://github.com/rubyzip/rubyzip/tree/v2.3.0
|
146
152
|
wiki_uri: https://github.com/rubyzip/rubyzip/wiki
|
147
153
|
post_install_message:
|
148
154
|
rdoc_options: []
|