rubyzip 0.5.8 → 0.5.9
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.
Potentially problematic release.
This version of rubyzip might be problematic. Click here for more details.
- data/ChangeLog +37 -0
- data/NEWS +4 -0
- data/Rakefile +1 -1
- data/lib/zip/ioextras.rb +8 -0
- data/lib/zip/zip.rb +27 -6
- data/samples/qtzip.rb +101 -0
- data/samples/zipdialogui.rb +80 -0
- data/test/data/file2.txt.other +0 -0
- data/test/zipfilesystemtest.rb +4 -2
- data/test/ziptest.rb +22 -0
- data/test/zlibtest.rb +26 -0
- metadata +9 -3
    
        data/ChangeLog
    CHANGED
    
    | @@ -1,3 +1,40 @@ | |
| 1 | 
            +
            2005-08-07 14:27  thomas
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            	* lib/zip/zip.rb, NEWS: [no log message]
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            2005-08-06 11:12  thomas
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            	* lib/zip/: ioextras.rb, zip.rb: [no log message]
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            2005-08-03 18:54  thomas
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            	* lib/zip/zip.rb: Read/write in chunks to preserve memory
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            2005-07-02 15:08  thomas
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            	* lib/zip/zip.rb: Applied received patch concerning FreeBSD 4.5
         | 
| 16 | 
            +
            	  issue
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            2005-04-03 16:52  thomas
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            	* samples/.cvsignore: [no log message]
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            2005-04-03 16:50  thomas
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            	* samples/: qtzip.rb, zipdialogui.ui: Added a qt example
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            2005-03-31 21:58  thomas
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            	* lib/zip/zip.rb, test/ziptest.rb: [no log message]
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            2005-03-31 21:05  thomas
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            	* test/zipfilesystemtest.rb: [no log message]
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            2005-03-17 18:17  thomas
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            	* Rakefile: [no log message]
         | 
| 37 | 
            +
             | 
| 1 38 | 
             
            2005-03-17 18:11  thomas
         | 
| 2 39 |  | 
| 3 40 | 
             
            	* NEWS, README, lib/zip/zip.rb: [no log message]
         | 
    
        data/NEWS
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    
    
        data/lib/zip/ioextras.rb
    CHANGED
    
    | @@ -1,5 +1,13 @@ | |
| 1 1 | 
             
            module IOExtras  #:nodoc:
         | 
| 2 2 |  | 
| 3 | 
            +
              CHUNK_SIZE = 32768
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              def copy_stream(ostream, istream)
         | 
| 6 | 
            +
                s = ''
         | 
| 7 | 
            +
                ostream.write(istream.read(CHUNK_SIZE, s)) until istream.eof? 
         | 
| 8 | 
            +
              end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
             | 
| 3 11 | 
             
              # Implements kind_of? in order to pretend to be an IO object
         | 
| 4 12 | 
             
              module FakeIO
         | 
| 5 13 | 
             
                def kind_of?(object)
         | 
    
        data/lib/zip/zip.rb
    CHANGED
    
    | @@ -19,10 +19,12 @@ end | |
| 19 19 |  | 
| 20 20 | 
             
            module Zip
         | 
| 21 21 |  | 
| 22 | 
            -
              VERSION = '0.5. | 
| 22 | 
            +
              VERSION = '0.5.9'
         | 
| 23 23 |  | 
| 24 24 | 
             
              RUBY_MINOR_VERSION = RUBY_VERSION.split(".")[1].to_i
         | 
| 25 25 |  | 
| 26 | 
            +
              CHUNK_SIZE=32768
         | 
| 27 | 
            +
             | 
| 26 28 | 
             
              # Ruby 1.7.x compatibility
         | 
| 27 29 | 
             
              # In ruby 1.6.x and 1.8.0 reading from an empty stream returns 
         | 
| 28 30 | 
             
              # an empty string the first time and then nil.
         | 
| @@ -155,7 +157,6 @@ module Zip | |
| 155 157 |  | 
| 156 158 |  | 
| 157 159 | 
             
              class Decompressor  #:nodoc:all
         | 
| 158 | 
            -
                CHUNK_SIZE=32768
         | 
| 159 160 | 
             
                def initialize(inputStream)
         | 
| 160 161 | 
             
                  super()
         | 
| 161 162 | 
             
                  @inputStream=inputStream
         | 
| @@ -811,6 +812,13 @@ module Zip | |
| 811 812 | 
             
                  @entrySet[entry.parent_as_string]
         | 
| 812 813 | 
             
                end
         | 
| 813 814 |  | 
| 815 | 
            +
                def glob(pattern, flags = File::FNM_PATHNAME|File::FNM_DOTMATCH)
         | 
| 816 | 
            +
                  entries.select { 
         | 
| 817 | 
            +
            	|entry| 
         | 
| 818 | 
            +
            	File.fnmatch(pattern, entry.name.chomp('/'), flags) 
         | 
| 819 | 
            +
                  } 
         | 
| 820 | 
            +
                end	
         | 
| 821 | 
            +
             | 
| 814 822 | 
             
            #TODO    attr_accessor :auto_create_directories
         | 
| 815 823 | 
             
                protected
         | 
| 816 824 | 
             
                attr_accessor :entrySet
         | 
| @@ -898,10 +906,23 @@ module Zip | |
| 898 906 | 
             
            	io.seek(-MAX_END_OF_CENTRAL_DIRECTORY_STRUCTURE_SIZE, IO::SEEK_END)
         | 
| 899 907 | 
             
                  rescue Errno::EINVAL
         | 
| 900 908 | 
             
            	io.seek(0, IO::SEEK_SET)
         | 
| 901 | 
            -
                  rescue Errno::EFBIG # FreeBSD 4.9  | 
| 909 | 
            +
                  rescue Errno::EFBIG # FreeBSD 4.9 raise Errno::EFBIG instead of Errno::EINVAL
         | 
| 902 910 | 
             
            	io.seek(0, IO::SEEK_SET)
         | 
| 903 911 | 
             
                  end
         | 
| 904 | 
            -
                   | 
| 912 | 
            +
                  
         | 
| 913 | 
            +
                  # 'buf = io.read' substituted with lump of code to work around FreeBSD 4.5 issue
         | 
| 914 | 
            +
                  retried = false
         | 
| 915 | 
            +
                  buf = nil
         | 
| 916 | 
            +
                  begin
         | 
| 917 | 
            +
                    buf = io.read
         | 
| 918 | 
            +
                  rescue Errno::EFBIG # FreeBSD 4.5 may raise Errno::EFBIG
         | 
| 919 | 
            +
                    raise if (retried)
         | 
| 920 | 
            +
                    retried = true
         | 
| 921 | 
            +
            	
         | 
| 922 | 
            +
                    io.seek(0, IO::SEEK_SET)
         | 
| 923 | 
            +
                    retry
         | 
| 924 | 
            +
                  end
         | 
| 925 | 
            +
             | 
| 905 926 | 
             
                  sigIndex = buf.rindex([END_OF_CENTRAL_DIRECTORY_SIGNATURE].pack('V'))
         | 
| 906 927 | 
             
                  raise ZipError, "Zip end of central directory signature not found" unless sigIndex
         | 
| 907 928 | 
             
                  buf=buf.slice!((sigIndex+4)...(buf.size))
         | 
| @@ -1258,7 +1279,7 @@ module Zip | |
| 1258 1279 |  | 
| 1259 1280 | 
             
                def write_to_zip_output_stream(aZipOutputStream)
         | 
| 1260 1281 | 
             
                  aZipOutputStream.put_next_entry(self)
         | 
| 1261 | 
            -
                   | 
| 1282 | 
            +
                  get_input_stream { |is| copy_stream(aZipOutputStream, is) } 
         | 
| 1262 1283 | 
             
                end
         | 
| 1263 1284 |  | 
| 1264 1285 | 
             
                def == (other)
         | 
| @@ -1322,7 +1343,7 @@ module Zip | |
| 1322 1343 |  | 
| 1323 1344 | 
             
                def write_to_zip_output_stream(aZipOutputStream)
         | 
| 1324 1345 | 
             
                  aZipOutputStream.put_next_entry(self)
         | 
| 1325 | 
            -
                   | 
| 1346 | 
            +
                  get_input_stream { |is| copy_stream(aZipOutputStream, is) } 
         | 
| 1326 1347 | 
             
                end
         | 
| 1327 1348 | 
             
              end
         | 
| 1328 1349 |  | 
    
        data/samples/qtzip.rb
    ADDED
    
    | @@ -0,0 +1,101 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            $VERBOSE=true
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            $: << "../lib"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            require 'Qt'
         | 
| 8 | 
            +
            system('rbuic -o zipdialogui.rb zipdialogui.ui')
         | 
| 9 | 
            +
            require 'zipdialogui.rb'
         | 
| 10 | 
            +
            require 'zip/zip'
         | 
| 11 | 
            +
             | 
| 12 | 
            +
             | 
| 13 | 
            +
             | 
| 14 | 
            +
            a = Qt::Application.new(ARGV)
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            class ZipDialog < ZipDialogUI
         | 
| 17 | 
            +
             | 
| 18 | 
            +
             | 
| 19 | 
            +
              def initialize()
         | 
| 20 | 
            +
                super()
         | 
| 21 | 
            +
                connect(child('add_button'), SIGNAL('clicked()'),
         | 
| 22 | 
            +
                        self, SLOT('add_files()'))
         | 
| 23 | 
            +
                connect(child('extract_button'), SIGNAL('clicked()'),
         | 
| 24 | 
            +
                        self, SLOT('extract_files()'))
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
              def zipfile(&proc)
         | 
| 28 | 
            +
                Zip::ZipFile.open(@zip_filename, &proc)
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
              def each(&proc)
         | 
| 32 | 
            +
                Zip::ZipFile.foreach(@zip_filename, &proc)
         | 
| 33 | 
            +
              end
         | 
| 34 | 
            +
              
         | 
| 35 | 
            +
              def refresh()
         | 
| 36 | 
            +
                lv = child("entry_list_view")
         | 
| 37 | 
            +
                lv.clear
         | 
| 38 | 
            +
                each { 
         | 
| 39 | 
            +
                  |e|
         | 
| 40 | 
            +
                  lv.insert_item(Qt::ListViewItem.new(lv, e.name, e.size.to_s))
         | 
| 41 | 
            +
                }
         | 
| 42 | 
            +
              end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                
         | 
| 45 | 
            +
              def load(zipfile)
         | 
| 46 | 
            +
                @zip_filename = zipfile
         | 
| 47 | 
            +
                refresh
         | 
| 48 | 
            +
              end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
              def add_files
         | 
| 51 | 
            +
                l = Qt::FileDialog.getOpenFileNames(nil, nil, self)
         | 
| 52 | 
            +
                zipfile { 
         | 
| 53 | 
            +
                  |zf| 
         | 
| 54 | 
            +
                  l.each { 
         | 
| 55 | 
            +
                    |path|
         | 
| 56 | 
            +
                    zf.add(File.basename(path), path)
         | 
| 57 | 
            +
                  }
         | 
| 58 | 
            +
                }
         | 
| 59 | 
            +
                refresh
         | 
| 60 | 
            +
              end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
              def extract_files
         | 
| 63 | 
            +
                selected_items = []
         | 
| 64 | 
            +
                unselected_items = []
         | 
| 65 | 
            +
                lv_item = entry_list_view.first_child
         | 
| 66 | 
            +
                while (lv_item)
         | 
| 67 | 
            +
                  if entry_list_view.is_selected(lv_item)
         | 
| 68 | 
            +
                    selected_items << lv_item.text(0)
         | 
| 69 | 
            +
                  else
         | 
| 70 | 
            +
                    unselected_items << lv_item.text(0)
         | 
| 71 | 
            +
                  end
         | 
| 72 | 
            +
                  lv_item = lv_item.next_sibling
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
                puts "selected_items.size = #{selected_items.size}"
         | 
| 75 | 
            +
                puts "unselected_items.size = #{unselected_items.size}"
         | 
| 76 | 
            +
                items = selected_items.size > 0 ? selected_items : unselected_items
         | 
| 77 | 
            +
                puts "items.size = #{items.size}"
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                d = Qt::FileDialog.get_existing_directory(nil, self)
         | 
| 80 | 
            +
                if (!d)
         | 
| 81 | 
            +
                  puts "No directory chosen"
         | 
| 82 | 
            +
                else
         | 
| 83 | 
            +
                  zipfile { |zf| items.each { |e| zf.extract(e, File.join(d, e)) } }
         | 
| 84 | 
            +
                end
         | 
| 85 | 
            +
                
         | 
| 86 | 
            +
              end
         | 
| 87 | 
            +
             | 
| 88 | 
            +
              slots 'add_files()', 'extract_files()'
         | 
| 89 | 
            +
            end
         | 
| 90 | 
            +
             | 
| 91 | 
            +
            if !ARGV[0]
         | 
| 92 | 
            +
              puts "usage: #{$0} zipname"
         | 
| 93 | 
            +
              exit
         | 
| 94 | 
            +
            end
         | 
| 95 | 
            +
             | 
| 96 | 
            +
            zd = ZipDialog.new
         | 
| 97 | 
            +
            zd.load(ARGV[0])
         | 
| 98 | 
            +
             | 
| 99 | 
            +
            a.mainWidget = zd
         | 
| 100 | 
            +
            zd.show()
         | 
| 101 | 
            +
            a.exec()
         | 
| @@ -0,0 +1,80 @@ | |
| 1 | 
            +
            # Form implementation generated from reading ui file 'zipdialogui.ui'
         | 
| 2 | 
            +
            #
         | 
| 3 | 
            +
            # Created: Sun Apr 3 16:49:38 2005
         | 
| 4 | 
            +
            #      by: The QtRuby User Interface Compiler (rbuic)
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            # WARNING! All changes made in this file will be lost!
         | 
| 7 | 
            +
             | 
| 8 | 
            +
             | 
| 9 | 
            +
            require 'Qt'
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            class ZipDialogUI < Qt::Dialog
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                attr_reader :entry_list_view
         | 
| 14 | 
            +
                attr_reader :add_button
         | 
| 15 | 
            +
                attr_reader :extract_button
         | 
| 16 | 
            +
                attr_reader :close_button
         | 
| 17 | 
            +
             | 
| 18 | 
            +
             | 
| 19 | 
            +
                def initialize(*k)
         | 
| 20 | 
            +
                    super(*k)
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                    if name.nil?
         | 
| 23 | 
            +
                    	setName("ZipDialogUI")
         | 
| 24 | 
            +
                    end
         | 
| 25 | 
            +
                    setSizeGripEnabled(true)
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                    @ZipDialogUILayout = Qt::HBoxLayout.new(self, 11, 6, 'ZipDialogUILayout')
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                    @entry_list_view = Qt::ListView.new(self, "entry_list_view")
         | 
| 30 | 
            +
                    @entry_list_view.addColumn(trUtf8("Entry"))
         | 
| 31 | 
            +
                    @entry_list_view.addColumn(trUtf8("Size"))
         | 
| 32 | 
            +
                    @entry_list_view.setMinimumSize( Qt::Size.new(150, 200) )
         | 
| 33 | 
            +
                    @entry_list_view.setResizePolicy( Qt::ScrollView::Manual )
         | 
| 34 | 
            +
                    @entry_list_view.setSelectionMode( Qt::ListView::Extended )
         | 
| 35 | 
            +
                    @entry_list_view.setResizeMode( Qt::ListView::AllColumns )
         | 
| 36 | 
            +
                    @ZipDialogUILayout.addWidget(@entry_list_view)
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                    @layout2 = Qt::VBoxLayout.new(nil, 0, 6, 'layout2')
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                    @add_button = Qt::PushButton.new(self, "add_button")
         | 
| 41 | 
            +
                    @add_button.setAutoDefault( true )
         | 
| 42 | 
            +
                    @layout2.addWidget(@add_button)
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                    @extract_button = Qt::PushButton.new(self, "extract_button")
         | 
| 45 | 
            +
                    @extract_button.setAutoDefault( true )
         | 
| 46 | 
            +
                    @layout2.addWidget(@extract_button)
         | 
| 47 | 
            +
                    @Spacer1 = Qt::SpacerItem.new(20, 160, Qt::SizePolicy::Minimum, Qt::SizePolicy::Expanding)
         | 
| 48 | 
            +
                    @layout2.addItem(@Spacer1)
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                    @close_button = Qt::PushButton.new(self, "close_button")
         | 
| 51 | 
            +
                    @close_button.setAutoDefault( true )
         | 
| 52 | 
            +
                    @close_button.setDefault( true )
         | 
| 53 | 
            +
                    @layout2.addWidget(@close_button)
         | 
| 54 | 
            +
                    @ZipDialogUILayout.addLayout(@layout2)
         | 
| 55 | 
            +
                    languageChange()
         | 
| 56 | 
            +
                    resize( Qt::Size.new(416, 397).expandedTo(minimumSizeHint()) )
         | 
| 57 | 
            +
                    clearWState( WState_Polished )
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                    Qt::Object.connect(@close_button, SIGNAL("clicked()"), self, SLOT("accept()") )
         | 
| 60 | 
            +
                end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                #
         | 
| 63 | 
            +
                #  Sets the strings of the subwidgets using the current
         | 
| 64 | 
            +
                #  language.
         | 
| 65 | 
            +
                #
         | 
| 66 | 
            +
                def languageChange()
         | 
| 67 | 
            +
                    setCaption(trUtf8("Rubyzip"))
         | 
| 68 | 
            +
                    @entry_list_view.header().setLabel( 0, trUtf8("Entry") )
         | 
| 69 | 
            +
                    @entry_list_view.header().setLabel( 1, trUtf8("Size") )
         | 
| 70 | 
            +
                    @add_button.setText( trUtf8("&Add...") )
         | 
| 71 | 
            +
                    @add_button.setAccel( Qt::KeySequence.new(trUtf8("Alt+A")) )
         | 
| 72 | 
            +
                    @extract_button.setText( trUtf8("&Extract...") )
         | 
| 73 | 
            +
                    @extract_button.setAccel( Qt::KeySequence.new(trUtf8("Alt+E")) )
         | 
| 74 | 
            +
                    @close_button.setText( trUtf8("&Close") )
         | 
| 75 | 
            +
                    @close_button.setAccel( Qt::KeySequence.new(trUtf8("Alt+C")) )
         | 
| 76 | 
            +
                end
         | 
| 77 | 
            +
                protected :languageChange
         | 
| 78 | 
            +
             | 
| 79 | 
            +
             | 
| 80 | 
            +
            end
         | 
| 
            File without changes
         | 
    
        data/test/zipfilesystemtest.rb
    CHANGED
    
    | @@ -456,8 +456,10 @@ class ZipFsFileNonmutatingTest < Test::Unit::TestCase | |
| 456 456 | 
             
              end
         | 
| 457 457 |  | 
| 458 458 | 
             
              def test_popen
         | 
| 459 | 
            -
                 | 
| 460 | 
            -
             | 
| 459 | 
            +
                cmd = /mswin/i =~ RUBY_PLATFORM ? 'dir' : 'ls'
         | 
| 460 | 
            +
             | 
| 461 | 
            +
                assert_equal(File.popen(cmd)          { |f| f.read }, 
         | 
| 462 | 
            +
            		  @zipFile.file.popen(cmd) { |f| f.read })
         | 
| 461 463 | 
             
              end
         | 
| 462 464 |  | 
| 463 465 | 
             
            # Can be added later
         | 
    
        data/test/ziptest.rb
    CHANGED
    
    | @@ -813,6 +813,28 @@ class ZipEntrySetTest < Test::Unit::TestCase | |
| 813 813 | 
             
                assert_equal(entries[3], entrySet.parent(entries[4]))
         | 
| 814 814 | 
             
                assert_equal(entries[3], entrySet.parent(entries[5]))
         | 
| 815 815 | 
             
              end
         | 
| 816 | 
            +
             | 
| 817 | 
            +
              def test_glob
         | 
| 818 | 
            +
                res = @zipEntrySet.glob('name[2-4]')
         | 
| 819 | 
            +
                assert_equal(3, res.size)
         | 
| 820 | 
            +
                assert_equal(ZIP_ENTRIES[1,3], res)
         | 
| 821 | 
            +
              end
         | 
| 822 | 
            +
             | 
| 823 | 
            +
              def test_glob2
         | 
| 824 | 
            +
                entries = [ 
         | 
| 825 | 
            +
                  ZipEntry.new("zf.zip", "a/"),
         | 
| 826 | 
            +
                  ZipEntry.new("zf.zip", "a/b/b1"),
         | 
| 827 | 
            +
                  ZipEntry.new("zf.zip", "a/b/c/"),
         | 
| 828 | 
            +
                  ZipEntry.new("zf.zip", "a/b/c/c1")
         | 
| 829 | 
            +
                ]
         | 
| 830 | 
            +
                entrySet = ZipEntrySet.new(entries)
         | 
| 831 | 
            +
             | 
| 832 | 
            +
                assert_equal(entries[0,1], entrySet.glob("*"))
         | 
| 833 | 
            +
            #    assert_equal(entries[FIXME], entrySet.glob("**"))
         | 
| 834 | 
            +
            #    res = entrySet.glob('a*')
         | 
| 835 | 
            +
            #    assert_equal(entries.size, res.size)
         | 
| 836 | 
            +
            #    assert_equal(entrySet.map { |e| e.name }, res.map { |e| e.name })
         | 
| 837 | 
            +
              end
         | 
| 816 838 | 
             
            end
         | 
| 817 839 |  | 
| 818 840 |  | 
    
        data/test/zlibtest.rb
    ADDED
    
    | @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            $VERBOSE = true
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            $: << "../lib"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            require 'test/unit'
         | 
| 8 | 
            +
            require 'zlib'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            include Zlib
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            class ZLibTest < Test::Unit::TestCase
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              def test_BufError
         | 
| 15 | 
            +
                inflater = Zlib::Inflate.new(-Zlib::MAX_WBITS)
         | 
| 16 | 
            +
                s = ""
         | 
| 17 | 
            +
                File.open("data/file1.txt.deflatedData") {
         | 
| 18 | 
            +
                  |is|
         | 
| 19 | 
            +
                  while (!inflater.finished?)
         | 
| 20 | 
            +
                    s += inflater.inflate(is.read(1))
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
                }
         | 
| 23 | 
            +
                puts s
         | 
| 24 | 
            +
                assert_equal(File.read("data/file1.txt"), s)
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,10 +1,10 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 | 
            -
            rubygems_version: 0.8. | 
| 2 | 
            +
            rubygems_version: 0.8.11
         | 
| 3 3 | 
             
            specification_version: 1
         | 
| 4 4 | 
             
            name: rubyzip
         | 
| 5 5 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 6 | 
            -
              version: 0.5. | 
| 7 | 
            -
            date: 2005- | 
| 6 | 
            +
              version: 0.5.9
         | 
| 7 | 
            +
            date: 2005-08-07 00:00:00 +02:00
         | 
| 8 8 | 
             
            summary: rubyzip is a ruby module for reading and writing zip files
         | 
| 9 9 | 
             
            require_paths: 
         | 
| 10 10 | 
             
              - lib
         | 
| @@ -24,6 +24,8 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement | |
| 24 24 | 
             
                    version: 0.0.0
         | 
| 25 25 | 
             
              version: 
         | 
| 26 26 | 
             
            platform: ruby
         | 
| 27 | 
            +
            signing_key: 
         | 
| 28 | 
            +
            cert_chain: 
         | 
| 27 29 | 
             
            authors: 
         | 
| 28 30 | 
             
              - Thomas Sondergaard
         | 
| 29 31 | 
             
            files: 
         | 
| @@ -33,17 +35,20 @@ files: | |
| 33 35 | 
             
              - ChangeLog
         | 
| 34 36 | 
             
              - install.rb
         | 
| 35 37 | 
             
              - Rakefile
         | 
| 38 | 
            +
              - samples/zipdialogui.rb
         | 
| 36 39 | 
             
              - samples/example.rb
         | 
| 37 40 | 
             
              - samples/example_filesystem.rb
         | 
| 38 41 | 
             
              - samples/gtkRubyzip.rb
         | 
| 39 42 | 
             
              - samples/write_simple.rb
         | 
| 40 43 | 
             
              - samples/zipfind.rb
         | 
| 44 | 
            +
              - samples/qtzip.rb
         | 
| 41 45 | 
             
              - test/gentestfiles.rb
         | 
| 42 46 | 
             
              - test/ioextrastest.rb
         | 
| 43 47 | 
             
              - test/stdrubyexttest.rb
         | 
| 44 48 | 
             
              - test/zipfilesystemtest.rb
         | 
| 45 49 | 
             
              - test/ziprequiretest.rb
         | 
| 46 50 | 
             
              - test/ziptest.rb
         | 
| 51 | 
            +
              - test/zlibtest.rb
         | 
| 47 52 | 
             
              - test/alltests.rb
         | 
| 48 53 | 
             
              - test/data/file1.txt
         | 
| 49 54 | 
             
              - test/data/file1.txt.deflatedData
         | 
| @@ -53,6 +58,7 @@ files: | |
| 53 58 | 
             
              - test/data/rubycode2.zip
         | 
| 54 59 | 
             
              - test/data/testDirectory.bin
         | 
| 55 60 | 
             
              - test/data/zipWithDirs.zip
         | 
| 61 | 
            +
              - test/data/file2.txt.other
         | 
| 56 62 | 
             
              - lib/zip/ioextras.rb
         | 
| 57 63 | 
             
              - lib/zip/stdrubyext.rb
         | 
| 58 64 | 
             
              - lib/zip/tempfile_bugfixed.rb
         |