rubyzip 1.0.0 → 1.1.0

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.

@@ -17,7 +17,7 @@ module Zip
17
17
  attr_accessor :lineno
18
18
  attr_reader :pos
19
19
 
20
- def read(number_of_bytes = nil, buf = nil)
20
+ def read(number_of_bytes = nil, buf = '')
21
21
  tbuf = if @output_buffer.bytesize > 0
22
22
  if number_of_bytes <= @output_buffer.bytesize
23
23
  @output_buffer.slice!(0, number_of_bytes)
@@ -33,9 +33,12 @@ module Zip
33
33
  sysread(number_of_bytes, buf)
34
34
  end
35
35
 
36
- @pos += tbuf.length
36
+ if tbuf.nil? || tbuf.length == 0
37
+ return nil if number_of_bytes
38
+ return ""
39
+ end
37
40
 
38
- return nil unless tbuf
41
+ @pos += tbuf.length
39
42
 
40
43
  if buf
41
44
  buf.replace(tbuf)
@@ -1,6 +1,6 @@
1
1
  module Zip
2
- class NullDecompressor #:nodoc:all
3
- include Singleton
2
+ module NullDecompressor #:nodoc:all
3
+ extend self
4
4
 
5
5
  def sysread(numberOfBytes = nil, buf = nil)
6
6
  nil
@@ -1,5 +1,6 @@
1
1
  module Zip
2
- class NullInputStream < NullDecompressor #:nodoc:all
2
+ module NullInputStream #:nodoc:all
3
+ include ::Zip::NullDecompressor
3
4
  include ::Zip::IOExtras::AbstractInputStream
4
5
  end
5
6
  end
@@ -35,7 +35,7 @@ module Zip
35
35
  @entry_set = ::Zip::EntrySet.new
36
36
  @compressor = ::Zip::NullCompressor.instance
37
37
  @closed = false
38
- @currentEntry = nil
38
+ @current_entry = nil
39
39
  @comment = nil
40
40
  end
41
41
 
@@ -94,7 +94,7 @@ module Zip
94
94
  end
95
95
  new_entry.compression_method = compression_method if !compression_method.nil?
96
96
  init_next_entry(new_entry, level)
97
- @currentEntry = new_entry
97
+ @current_entry = new_entry
98
98
  end
99
99
 
100
100
  def copy_raw_entry(entry)
@@ -111,18 +111,18 @@ module Zip
111
111
  IOExtras.copy_stream_n(@output_stream, is, entry.compressed_size)
112
112
  end
113
113
  @compressor = NullCompressor.instance
114
- @currentEntry = nil
114
+ @current_entry = nil
115
115
  end
116
116
 
117
117
  private
118
118
 
119
119
  def finalize_current_entry
120
- return unless @currentEntry
120
+ return unless @current_entry
121
121
  finish
122
- @currentEntry.compressed_size = @output_stream.tell - @currentEntry.local_header_offset - @currentEntry.calculate_local_header_size
123
- @currentEntry.size = @compressor.size
124
- @currentEntry.crc = @compressor.crc
125
- @currentEntry = nil
122
+ @current_entry.compressed_size = @output_stream.tell - @current_entry.local_header_offset - @current_entry.calculate_local_header_size
123
+ @current_entry.size = @compressor.size
124
+ @current_entry.crc = @compressor.crc
125
+ @current_entry = nil
126
126
  @compressor = NullCompressor.instance
127
127
  end
128
128
 
@@ -146,7 +146,7 @@ module Zip
146
146
  pos = @output_stream.pos
147
147
  @entry_set.each do |entry|
148
148
  @output_stream.pos = entry.local_header_offset
149
- entry.write_local_entry(@output_stream)
149
+ entry.write_local_entry(@output_stream, true)
150
150
  end
151
151
  @output_stream.pos = pos
152
152
  end
@@ -8,7 +8,7 @@ module Zip
8
8
  @has_returned_empty_string = false
9
9
  end
10
10
 
11
- def sysread(number_of_bytes = nil, buf = nil)
11
+ def sysread(number_of_bytes = nil, buf = '')
12
12
  if input_finished?
13
13
  has_returned_empty_string_val = @has_returned_empty_string
14
14
  @has_returned_empty_string = true
@@ -16,7 +16,7 @@ module Zip
16
16
  return
17
17
  end
18
18
 
19
- if (number_of_bytes == nil || @read_so_far + number_of_bytes > @chars_to_read)
19
+ if number_of_bytes.nil? || @read_so_far + number_of_bytes > @chars_to_read
20
20
  number_of_bytes = @chars_to_read - @read_so_far
21
21
  end
22
22
  @read_so_far += number_of_bytes
@@ -1,3 +1,3 @@
1
1
  module Zip
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
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.0.0
4
+ version: 1.1.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: 2013-08-29 00:00:00.000000000 Z
11
+ date: 2013-11-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -37,6 +37,7 @@ files:
37
37
  - lib/zip/extra_field/universal_time.rb
38
38
  - lib/zip/extra_field/unix.rb
39
39
  - lib/zip/extra_field/zip64.rb
40
+ - lib/zip/extra_field/zip64_placeholder.rb
40
41
  - lib/zip/extra_field.rb
41
42
  - lib/zip/file.rb
42
43
  - lib/zip/filesystem.rb
@@ -56,7 +57,6 @@ files:
56
57
  - lib/zip/version.rb
57
58
  - lib/zip.rb
58
59
  - README.md
59
- - NEWS
60
60
  - TODO
61
61
  - Rakefile
62
62
  homepage: http://github.com/rubyzip/rubyzip
@@ -68,17 +68,17 @@ require_paths:
68
68
  - lib
69
69
  required_ruby_version: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - ! '>='
71
+ - - '>='
72
72
  - !ruby/object:Gem::Version
73
73
  version: 1.9.2
74
74
  required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - ! '>='
76
+ - - '>='
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  requirements: []
80
80
  rubyforge_project:
81
- rubygems_version: 2.0.3
81
+ rubygems_version: 2.0.6
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: rubyzip is a ruby module for reading and writing zip files
data/NEWS DELETED
@@ -1,182 +0,0 @@
1
- = Version 1.0.0
2
-
3
- Changed the API for gem. Now it can be used without require param in Gemfile.
4
- Added read-only support for Zip64 files.
5
- Added support for setting Unicode file names.
6
-
7
- = Version 0.9.9
8
-
9
- Added support for backslashes in zip files (generated by the default Windows
10
- zip packer for example) and comment sections with the comment length set to zero
11
- even though there is actually a comment.
12
-
13
- = Version 0.9.8
14
-
15
- Fixed: "Unitialized constant NullInputStream" error
16
-
17
- = Version 0.9.5
18
-
19
- Removed support for loading ruby in zip files (ziprequire.rb).
20
-
21
- = Version 0.9.4
22
-
23
- Changed ZipOutputStream.put_next_entry signature (API CHANGE!). Now
24
- allows comment, extra field and compression method to be specified.
25
-
26
- = Version 0.9.3
27
-
28
- Fixed: Added ZipEntry::name_encoding which retrieves the character
29
- encoding of the name and comment of the entry. Also added convenience
30
- methods ZipEntry::name_in(enc) and ZipEntry::comment_in(enc) for
31
- getting zip entry names and comments in a specified character
32
- encoding.
33
-
34
- = Version 0.9.2
35
-
36
- Fixed: Renaming an entry failed if the entry's new name was a
37
- different length than its old name. (Diego Barros)
38
-
39
- = Version 0.9.1
40
-
41
- Added symlink support and support for unix file permissions. Reduced
42
- memory usage during decompression.
43
-
44
- New methods ZipFile::[follow_symlinks, restore_times, restore_permissions, restore_ownership].
45
- New methods ZipEntry::unix_perms, ZipInputStream::eof?.
46
- Added documentation and test for new ZipFile::extract.
47
- Added some of the API suggestions from sf.net #1281314.
48
- Applied patch for sf.net bug #1446926.
49
- Applied patch for sf.net bug #1459902.
50
- Rework ZipEntry and delegate classes.
51
-
52
- = Version 0.5.12
53
-
54
- Fixed problem with writing binary content to a ZipFile in MS Windows.
55
-
56
- = Version 0.5.11
57
-
58
- Fixed name clash file method copy_stream from fileutils.rb. Fixed
59
- problem with references to constant CHUNK_SIZE.
60
- ZipInputStream/AbstractInputStream read is now buffered like ruby IO's
61
- read method, which means that read and gets etc can be mixed. The
62
- unbuffered read method has been renamed to sysread.
63
-
64
- = Version 0.5.10
65
-
66
- Fixed method name resolution problem with FileUtils::copy_stream and
67
- IOExtras::copy_stream.
68
-
69
- = Version 0.5.9
70
-
71
- Fixed serious memory consumption issue
72
-
73
- = Version 0.5.8
74
-
75
- Fixed install script.
76
-
77
- = Version 0.5.7
78
-
79
- install.rb no longer assumes it is being run from the toplevel source
80
- dir. Directory structure changed to reflect common ruby library
81
- project structure. Migrated from RubyUnit to Test::Unit format. Now
82
- uses Rake to build source packages and gems and run unit tests.
83
-
84
- = Version 0.5.6
85
-
86
- Fix for FreeBSD 4.9 which returns Errno::EFBIG instead of
87
- Errno::EINVAL for some invalid seeks. Fixed 'version needed to
88
- extract'-field incorrect in local headers.
89
-
90
- = Version 0.5.5
91
-
92
- Fix for a problem with writing zip files that concerns only ruby 1.8.1.
93
-
94
- = Version 0.5.4
95
-
96
- Significantly reduced memory footprint when modifying zip files.
97
-
98
- = Version 0.5.3
99
-
100
- Added optimization to avoid decompressing and recompressing individual
101
- entries when modifying a zip archive.
102
-
103
- = Version 0.5.2
104
-
105
- Fixed ZipFile corruption bug in ZipFile class. Added basic unix
106
- extra-field support.
107
-
108
- = Version 0.5.1
109
-
110
- Fixed ZipFile.get_output_stream bug.
111
-
112
- = Version 0.5.0
113
-
114
- List of changes:
115
- * Ruby 1.8.0 and ruby-zlib 0.6.0 compatibility
116
- * Changed method names from camelCase to rubys underscore style.
117
- * Installs to zip/ subdir instead of directly to site_ruby
118
- * Added ZipFile.directory and ZipFile.file - each method return an
119
- object that can be used like Dir and File only for the contents of the
120
- zip file.
121
- * Added sample application zipfind which works like Find.find, only
122
- Zip::ZipFind.find traverses into zip archives too.
123
-
124
- Bug fixes:
125
- * AbstractInputStream.each_line with non-default separator
126
-
127
-
128
- = Version 0.5.0a
129
-
130
- Source reorganized. Added ziprequire, which can be used to load ruby
131
- modules from a zip file, in a fashion similar to jar files in
132
- Java. Added gtkRubyzip, another sample application. Implemented
133
- ZipInputStream.lineno and ZipInputStream.rewind
134
-
135
- Bug fixes:
136
-
137
- * Read and write date and time information correctly for zip entries.
138
- * Fixed read() using separate buffer, causing mix of gets/readline/read to
139
- cause problems.
140
-
141
- = Version 0.4.2
142
-
143
- Performance optimizations. Test suite runs in half the time.
144
-
145
- = Version 0.4.1
146
-
147
- Windows compatibility fixes.
148
-
149
- = Version 0.4.0
150
-
151
- Zip::ZipFile is now mutable and provides a more convenient way of
152
- modifying zip archives than Zip::ZipOutputStream. Operations for
153
- adding, extracting, renaming, replacing and removing entries to zip
154
- archives are now available.
155
-
156
- Runs without warnings with -w switch.
157
-
158
- Install script install.rb added.
159
-
160
-
161
- = Version 0.3.1
162
-
163
- Rudimentary support for writing zip archives.
164
-
165
-
166
- = Version 0.2.2
167
-
168
- Fixed and extended unit test suite. Updated to work with ruby/zlib
169
- 0.5. It doesn't work with earlier versions of ruby/zlib.
170
-
171
-
172
- = Version 0.2.0
173
-
174
- Class ZipFile added. Where ZipInputStream is used to read the
175
- individual entries in a zip file, ZipFile reads the central directory
176
- in the zip archive, so you can get to any entry in the zip archive
177
- without having to skipping through all the preceeding entries.
178
-
179
-
180
- = Version 0.1.0
181
-
182
- First working version of ZipInputStream.