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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98c2a1f933fa7b5dc217d8450ea754a16b01ae8b
4
- data.tar.gz: 8518dc1dcad5c912ec8304fa0dc8653d6879fc48
3
+ metadata.gz: a4516159068d18e7d329c5c99b8bf098905c83b8
4
+ data.tar.gz: 1a689549ef8b554a649af9693d48d47a764d69bb
5
5
  SHA512:
6
- metadata.gz: 0ab5b0f29e9750b02bd610f53fc7806e43d49766ab10ea7c85227124b53cde76098de7449101934fa619b46287d1b882c4891e6c9cb5cf5d16922d375161a942
7
- data.tar.gz: 18583ce2e539dfcaca7fb28688e70d838dad3b73835e585700ac01c91a06a0697984dff2d9781b7b956e7fd239654a4f4072468d17da4539ca124fe12670d6be
6
+ metadata.gz: 3e7bd98090597c65b5e43bfe8c7d7aaa86f3d956a15fd05b3211ba84301ad2669f85cc7ad8a54d8466aea5d87edcdfa2140dcf77f1dc11d248af81e585b09806
7
+ data.tar.gz: e49d4ecf677f7ee6311b16e9aba32b0d4893489baddb49bac5f5159d6a580251038e6df909ba5c1a136a0c50b2439df1097c3407d54daa8690388114555326eb
@@ -560,6 +560,10 @@ module Zip
560
560
  end
561
561
  end
562
562
 
563
+ def clean_up
564
+ # By default, do nothing
565
+ end
566
+
563
567
  private
564
568
 
565
569
  def set_time(binary_dos_date, binary_dos_time)
@@ -303,6 +303,7 @@ module Zip
303
303
  @entry_set.each do |e|
304
304
  e.write_to_zip_output_stream(zos)
305
305
  e.dirty = false
306
+ e.clean_up
306
307
  end
307
308
  zos.comment = comment
308
309
  end
@@ -55,7 +55,7 @@ module Zip
55
55
  end
56
56
 
57
57
  # Same as #open but writes to a filestream instead
58
- def write_buffer(io)
58
+ def write_buffer(io = ::StringIO.new(''))
59
59
  zos = new(io, true)
60
60
  yield zos
61
61
  zos.close_buffer
@@ -44,6 +44,10 @@ module Zip
44
44
  aZipOutputStream.put_next_entry(self)
45
45
  get_input_stream { |is| ::Zip::IOExtras.copy_stream(aZipOutputStream, is) }
46
46
  end
47
+
48
+ def clean_up
49
+ @temp_file.unlink
50
+ end
47
51
  end
48
52
  end
49
53
 
@@ -1,3 +1,3 @@
1
1
  module Zip
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.3'
3
3
  end
@@ -3,7 +3,7 @@
3
3
  $: << "../lib"
4
4
  system("zip example.zip example.rb gtkRubyzip.rb")
5
5
 
6
- require 'zip/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/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
@@ -5,7 +5,7 @@ $: << "../lib"
5
5
  $VERBOSE = true
6
6
 
7
7
  require 'gtk'
8
- require 'zip/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
@@ -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/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()'
@@ -2,7 +2,7 @@
2
2
 
3
3
  $: << "../lib"
4
4
 
5
- require 'zip/zip'
5
+ require 'zip'
6
6
 
7
7
  include Zip
8
8
 
@@ -4,7 +4,7 @@ $VERBOSE = true
4
4
 
5
5
  $: << "../lib"
6
6
 
7
- require 'zip/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.2
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-03-18 00:00:00.000000000 Z
11
+ date: 2014-04-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: