rubyzip 1.0.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +6 -14
  2. data/README.md +231 -46
  3. data/Rakefile +13 -5
  4. data/TODO +0 -1
  5. data/lib/zip/central_directory.rb +64 -29
  6. data/lib/zip/compressor.rb +1 -2
  7. data/lib/zip/constants.rb +59 -5
  8. data/lib/zip/crypto/decrypted_io.rb +40 -0
  9. data/lib/zip/crypto/encryption.rb +11 -0
  10. data/lib/zip/crypto/null_encryption.rb +43 -0
  11. data/lib/zip/crypto/traditional_encryption.rb +99 -0
  12. data/lib/zip/decompressor.rb +22 -4
  13. data/lib/zip/deflater.rb +11 -6
  14. data/lib/zip/dos_time.rb +27 -16
  15. data/lib/zip/entry.rb +299 -163
  16. data/lib/zip/entry_set.rb +22 -20
  17. data/lib/zip/errors.rb +17 -6
  18. data/lib/zip/extra_field/generic.rb +15 -14
  19. data/lib/zip/extra_field/ntfs.rb +94 -0
  20. data/lib/zip/extra_field/old_unix.rb +46 -0
  21. data/lib/zip/extra_field/universal_time.rb +46 -16
  22. data/lib/zip/extra_field/unix.rb +10 -9
  23. data/lib/zip/extra_field/zip64.rb +46 -6
  24. data/lib/zip/extra_field/zip64_placeholder.rb +15 -0
  25. data/lib/zip/extra_field.rb +32 -18
  26. data/lib/zip/file.rb +260 -160
  27. data/lib/zip/filesystem.rb +297 -276
  28. data/lib/zip/inflater.rb +23 -34
  29. data/lib/zip/input_stream.rb +130 -82
  30. data/lib/zip/ioextras/abstract_input_stream.rb +36 -22
  31. data/lib/zip/ioextras/abstract_output_stream.rb +4 -6
  32. data/lib/zip/ioextras.rb +4 -6
  33. data/lib/zip/null_compressor.rb +2 -2
  34. data/lib/zip/null_decompressor.rb +4 -12
  35. data/lib/zip/null_input_stream.rb +2 -1
  36. data/lib/zip/output_stream.rb +75 -45
  37. data/lib/zip/pass_thru_compressor.rb +6 -6
  38. data/lib/zip/pass_thru_decompressor.rb +14 -24
  39. data/lib/zip/streamable_directory.rb +3 -3
  40. data/lib/zip/streamable_stream.rb +21 -16
  41. data/lib/zip/version.rb +1 -1
  42. data/lib/zip.rb +42 -3
  43. data/samples/example.rb +30 -40
  44. data/samples/example_filesystem.rb +16 -18
  45. data/samples/example_recursive.rb +33 -28
  46. data/samples/gtk_ruby_zip.rb +84 -0
  47. data/samples/qtzip.rb +25 -34
  48. data/samples/write_simple.rb +10 -13
  49. data/samples/zipfind.rb +38 -45
  50. metadata +129 -28
  51. data/NEWS +0 -182
  52. data/samples/gtkRubyzip.rb +0 -86
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.
@@ -1,86 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $: << "../lib"
4
-
5
- $VERBOSE = true
6
-
7
- require 'gtk'
8
- require 'zip/zip'
9
-
10
- class MainApp < Gtk::Window
11
- def initialize
12
- super()
13
- set_usize(400, 256)
14
- set_title("rubyzip")
15
- signal_connect(Gtk::Window::SIGNAL_DESTROY) { Gtk.main_quit }
16
-
17
- box = Gtk::VBox.new(false, 0)
18
- add(box)
19
-
20
- @zipfile = nil
21
- @buttonPanel = ButtonPanel.new
22
- @buttonPanel.openButton.signal_connect(Gtk::Button::SIGNAL_CLICKED) {
23
- show_file_selector
24
- }
25
- @buttonPanel.extractButton.signal_connect(Gtk::Button::SIGNAL_CLICKED) {
26
- puts "Not implemented!"
27
- }
28
- box.pack_start(@buttonPanel, false, false, 0)
29
-
30
- sw = Gtk::ScrolledWindow.new
31
- sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
32
- box.pack_start(sw, true, true, 0)
33
-
34
- @clist = Gtk::CList.new(["Name", "Size", "Compression"])
35
- @clist.set_selection_mode(Gtk::SELECTION_BROWSE)
36
- @clist.set_column_width(0, 120)
37
- @clist.set_column_width(1, 120)
38
- @clist.signal_connect(Gtk::CList::SIGNAL_SELECT_ROW) {
39
- |w, row, column, event|
40
- @selected_row = row
41
- }
42
- sw.add(@clist)
43
- end
44
-
45
- class ButtonPanel < Gtk::HButtonBox
46
- attr_reader :openButton, :extractButton
47
- def initialize
48
- super
49
- set_layout(Gtk::BUTTONBOX_START)
50
- set_spacing(0)
51
- @openButton = Gtk::Button.new("Open archive")
52
- @extractButton = Gtk::Button.new("Extract entry")
53
- pack_start(@openButton)
54
- pack_start(@extractButton)
55
- end
56
- end
57
-
58
- def show_file_selector
59
- @fileSelector = Gtk::FileSelection.new("Open zip file")
60
- @fileSelector.show
61
- @fileSelector.ok_button.signal_connect(Gtk::Button::SIGNAL_CLICKED) {
62
- open_zip(@fileSelector.filename)
63
- @fileSelector.destroy
64
- }
65
- @fileSelector.cancel_button.signal_connect(Gtk::Button::SIGNAL_CLICKED) {
66
- @fileSelector.destroy
67
- }
68
- end
69
-
70
- def open_zip(filename)
71
- @zipfile = Zip::File.open(filename)
72
- @clist.clear
73
- @zipfile.each {
74
- |entry|
75
- @clist.append([ entry.name,
76
- entry.size.to_s,
77
- (100.0*entry.compressedSize/entry.size).to_s+"%" ])
78
- }
79
- end
80
- end
81
-
82
- mainApp = MainApp.new()
83
-
84
- mainApp.show_all
85
-
86
- Gtk.main