def extract stream, destination
      Gem::Package::TarReader.new(stream) do |tar|
        path = nil
        tar.each do |entry|
          if entry.full_name == '././@LongLink'
            path = File.join(destination, entry.read.strip)
            next
          end
          path ||= File.join(destination, entry.full_name)
          if entry.directory?
            if File.exist?(path) and not File.directory?(path)
              raise IOError.new("Not a directory: #{path}")
            end
            FileUtils.mkdir_p path, :mode => entry.header.mode, :verbose => false
          elsif entry.file?
            if File.exist?(path) and not File.file?(path)
              raise IOError.new("Not a file: #{path}")
            end
            File.open path, "wb" do |fd|
              while (chunk = entry.read(1024))
                fd.write chunk
              end
            end
            FileUtils.chmod entry.header.mode, path, :verbose => false
          end
          path = nil
        end
      end
      true
    end
def extract stream, destination
      Gem::Package::TarReader.new(stream) do |tar|
        path = nil
        tar.each do |entry|
          if entry.full_name == '././@LongLink'
            path = File.join(destination, entry.read.strip)
            next
          end
          path ||= File.join(destination, entry.full_name)
          if entry.directory?
            if File.exist?(path) and not File.directory?(path)
              raise IOError.new("Not a directory: #{path}")
            end
            FileUtils.mkdir_p path, :mode => entry.header.mode, :verbose => false
          elsif entry.file?
            if File.exist?(path) and not File.file?(path)
              raise IOError.new("Not a file: #{path}")
            end
            File.open path, "wb" do |fd|
              while (chunk = entry.read(1024))
                fd.write chunk
              end
            end
            FileUtils.chmod entry.header.mode, path, :verbose => false
          end
          path = nil
        end
      end
      true
    end
:nodoc: