rubyzip 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubyzip might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/zip/entry.rb +4 -0
- data/lib/zip/file.rb +1 -0
- data/lib/zip/output_stream.rb +1 -1
- data/lib/zip/streamable_stream.rb +4 -0
- data/lib/zip/version.rb +1 -1
- data/samples/example.rb +2 -2
- data/samples/example_recursive.rb +6 -7
- data/samples/gtkRubyzip.rb +5 -5
- data/samples/qtzip.rb +8 -8
- data/samples/write_simple.rb +1 -1
- data/samples/zipfind.rb +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4516159068d18e7d329c5c99b8bf098905c83b8
|
4
|
+
data.tar.gz: 1a689549ef8b554a649af9693d48d47a764d69bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e7bd98090597c65b5e43bfe8c7d7aaa86f3d956a15fd05b3211ba84301ad2669f85cc7ad8a54d8466aea5d87edcdfa2140dcf77f1dc11d248af81e585b09806
|
7
|
+
data.tar.gz: e49d4ecf677f7ee6311b16e9aba32b0d4893489baddb49bac5f5159d6a580251038e6df909ba5c1a136a0c50b2439df1097c3407d54daa8690388114555326eb
|
data/lib/zip/entry.rb
CHANGED
data/lib/zip/file.rb
CHANGED
data/lib/zip/output_stream.rb
CHANGED
data/lib/zip/version.rb
CHANGED
data/samples/example.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
$: << "../lib"
|
4
4
|
system("zip example.zip example.rb gtkRubyzip.rb")
|
5
5
|
|
6
|
-
require 'zip
|
6
|
+
require 'zip'
|
7
7
|
|
8
8
|
####### Using ZipInputStream alone: #######
|
9
9
|
|
@@ -23,7 +23,7 @@ Zip::InputStream.open("example.zip") {
|
|
23
23
|
zf = Zip::File.new("example.zip")
|
24
24
|
zf.each_with_index {
|
25
25
|
|entry, index|
|
26
|
-
|
26
|
+
|
27
27
|
puts "entry #{index} is #{entry.name}, size = #{entry.size}, compressed size = #{entry.compressed_size}"
|
28
28
|
# use zf.get_input_stream(entry) to get a ZipInputStream for the entry
|
29
29
|
# entry can be the ZipEntry object or any object which has a to_s method that
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'zip
|
1
|
+
require 'zip'
|
2
2
|
|
3
3
|
# This is a simple example which uses rubyzip to
|
4
4
|
# recursively generate a zip file from the contents of
|
@@ -7,7 +7,7 @@ require 'zip/zip'
|
|
7
7
|
#
|
8
8
|
# Usage:
|
9
9
|
# directoryToZip = "/tmp/input"
|
10
|
-
# outputFile = "/tmp/out.zip"
|
10
|
+
# outputFile = "/tmp/out.zip"
|
11
11
|
# zf = ZipFileGenerator.new(directoryToZip, outputFile)
|
12
12
|
# zf.write()
|
13
13
|
class ZipFileGenerator
|
@@ -20,7 +20,7 @@ class ZipFileGenerator
|
|
20
20
|
|
21
21
|
# Zip the input directory.
|
22
22
|
def write()
|
23
|
-
entries = Dir.entries(@inputDir); entries.delete("."); entries.delete("..")
|
23
|
+
entries = Dir.entries(@inputDir); entries.delete("."); entries.delete("..")
|
24
24
|
io = Zip::File.open(@outputFile, Zip::File::CREATE);
|
25
25
|
|
26
26
|
writeEntries(entries, "", io)
|
@@ -30,20 +30,19 @@ class ZipFileGenerator
|
|
30
30
|
# A helper method to make the recursion work.
|
31
31
|
private
|
32
32
|
def writeEntries(entries, path, io)
|
33
|
-
|
33
|
+
|
34
34
|
entries.each { |e|
|
35
35
|
zipFilePath = path == "" ? e : File.join(path, e)
|
36
36
|
diskFilePath = File.join(@inputDir, zipFilePath)
|
37
37
|
puts "Deflating " + diskFilePath
|
38
38
|
if File.directory?(diskFilePath)
|
39
39
|
io.mkdir(zipFilePath)
|
40
|
-
subdir =Dir.entries(diskFilePath); subdir.delete("."); subdir.delete("..")
|
40
|
+
subdir =Dir.entries(diskFilePath); subdir.delete("."); subdir.delete("..")
|
41
41
|
writeEntries(subdir, zipFilePath, io)
|
42
42
|
else
|
43
43
|
io.get_output_stream(zipFilePath) { |f| f.puts(File.open(diskFilePath, "rb").read())}
|
44
44
|
end
|
45
45
|
}
|
46
46
|
end
|
47
|
-
|
48
|
-
end
|
49
47
|
|
48
|
+
end
|
data/samples/gtkRubyzip.rb
CHANGED
@@ -5,7 +5,7 @@ $: << "../lib"
|
|
5
5
|
$VERBOSE = true
|
6
6
|
|
7
7
|
require 'gtk'
|
8
|
-
require 'zip
|
8
|
+
require 'zip'
|
9
9
|
|
10
10
|
class MainApp < Gtk::Window
|
11
11
|
def initialize
|
@@ -26,7 +26,7 @@ class MainApp < Gtk::Window
|
|
26
26
|
puts "Not implemented!"
|
27
27
|
}
|
28
28
|
box.pack_start(@buttonPanel, false, false, 0)
|
29
|
-
|
29
|
+
|
30
30
|
sw = Gtk::ScrolledWindow.new
|
31
31
|
sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
32
32
|
box.pack_start(sw, true, true, 0)
|
@@ -70,10 +70,10 @@ class MainApp < Gtk::Window
|
|
70
70
|
def open_zip(filename)
|
71
71
|
@zipfile = Zip::File.open(filename)
|
72
72
|
@clist.clear
|
73
|
-
@zipfile.each {
|
73
|
+
@zipfile.each {
|
74
74
|
|entry|
|
75
|
-
@clist.append([ entry.name,
|
76
|
-
entry.size.to_s,
|
75
|
+
@clist.append([ entry.name,
|
76
|
+
entry.size.to_s,
|
77
77
|
(100.0*entry.compressedSize/entry.size).to_s+"%" ])
|
78
78
|
}
|
79
79
|
end
|
data/samples/qtzip.rb
CHANGED
@@ -7,7 +7,7 @@ $: << "../lib"
|
|
7
7
|
require 'Qt'
|
8
8
|
system('rbuic -o zipdialogui.rb zipdialogui.ui')
|
9
9
|
require 'zipdialogui.rb'
|
10
|
-
require 'zip
|
10
|
+
require 'zip'
|
11
11
|
|
12
12
|
|
13
13
|
|
@@ -31,17 +31,17 @@ class ZipDialog < ZipDialogUI
|
|
31
31
|
def each(&proc)
|
32
32
|
Zip::File.foreach(@zip_filename, &proc)
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def refresh()
|
36
36
|
lv = child("entry_list_view")
|
37
37
|
lv.clear
|
38
|
-
each {
|
38
|
+
each {
|
39
39
|
|e|
|
40
40
|
lv.insert_item(Qt::ListViewItem.new(lv, e.name, e.size.to_s))
|
41
41
|
}
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
|
45
45
|
def load(zipfile)
|
46
46
|
@zip_filename = zipfile
|
47
47
|
refresh
|
@@ -49,9 +49,9 @@ class ZipDialog < ZipDialogUI
|
|
49
49
|
|
50
50
|
def add_files
|
51
51
|
l = Qt::FileDialog.getOpenFileNames(nil, nil, self)
|
52
|
-
zipfile {
|
53
|
-
|zf|
|
54
|
-
l.each {
|
52
|
+
zipfile {
|
53
|
+
|zf|
|
54
|
+
l.each {
|
55
55
|
|path|
|
56
56
|
zf.add(File.basename(path), path)
|
57
57
|
}
|
@@ -82,7 +82,7 @@ class ZipDialog < ZipDialogUI
|
|
82
82
|
else
|
83
83
|
zipfile { |zf| items.each { |e| zf.extract(e, File.join(d, e)) } }
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
end
|
87
87
|
|
88
88
|
slots 'add_files()', 'extract_files()'
|
data/samples/write_simple.rb
CHANGED
data/samples/zipfind.rb
CHANGED
@@ -4,7 +4,7 @@ $VERBOSE = true
|
|
4
4
|
|
5
5
|
$: << "../lib"
|
6
6
|
|
7
|
-
require 'zip
|
7
|
+
require 'zip'
|
8
8
|
require 'find'
|
9
9
|
|
10
10
|
module Zip
|
@@ -38,21 +38,21 @@ end
|
|
38
38
|
|
39
39
|
if __FILE__ == $0
|
40
40
|
module ZipFindConsoleRunner
|
41
|
-
|
41
|
+
|
42
42
|
PATH_ARG_INDEX = 0;
|
43
43
|
FILENAME_PATTERN_ARG_INDEX = 1;
|
44
44
|
ZIPFILE_PATTERN_ARG_INDEX = 2;
|
45
|
-
|
45
|
+
|
46
46
|
def self.run(args)
|
47
47
|
check_args(args)
|
48
|
-
Zip::ZipFind.find_file(args[PATH_ARG_INDEX],
|
48
|
+
Zip::ZipFind.find_file(args[PATH_ARG_INDEX],
|
49
49
|
args[FILENAME_PATTERN_ARG_INDEX],
|
50
50
|
args[ZIPFILE_PATTERN_ARG_INDEX]) {
|
51
51
|
|fileName|
|
52
52
|
report_entry_found fileName
|
53
53
|
}
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def self.check_args(args)
|
57
57
|
if (args.size != 3)
|
58
58
|
usage
|
@@ -63,11 +63,11 @@ if __FILE__ == $0
|
|
63
63
|
def self.usage
|
64
64
|
puts "Usage: #{$0} PATH ZIPFILENAME_PATTERN FILNAME_PATTERN"
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
def self.report_entry_found(fileName)
|
68
68
|
puts fileName
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
end
|
72
72
|
|
73
73
|
ZipFindConsoleRunner.run(ARGV)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyzip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Simonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|