zip_tricks 2.6.1 → 2.7.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbb6bf8e96402a401c0bd282c77f48adb8b6e797
4
- data.tar.gz: 7fea8830d270a647f66edd6d89c2c04a4674c2f7
3
+ metadata.gz: 5cd89ab487709ccaf797ab39fa9507ee0ac793e1
4
+ data.tar.gz: 8c21a1106a9398dca0d4bb2e32bcb4a9f9b8b1ac
5
5
  SHA512:
6
- metadata.gz: f79662655eeccdaeede66019b345fa9274c264beedf48dbcb7098dcaceba10f86d881e5d27ce720c6c875adb5eb7c0d8352d79d9beb1dd4d320932896c164b34
7
- data.tar.gz: 0070e683f68a0f72c07dee4992d2213e604d73ee01df0ca7dcbbcd55dc9ab6ff66a26f0a8ecf0098495575b2e9fbda8b52044fb51ee436d58f7e53d20159428a
6
+ metadata.gz: d1bf6cfe7579dc8d0e21c625b135b06dcc036acb148ed197a0f1657f673bf5a77ce826a6df445b902a6dd556287c68cce7ce9aca080fe735cb405ceb5ac8f2bc
7
+ data.tar.gz: 9717bf12a2559c743b2855ce9ab78279968ff12c1b6036df07fb7db0d1b052955f3bd7b6e9faec6d608a84cbbe08e26eb81fc817ea2090d516a3ea83f9632811
@@ -62,6 +62,17 @@ class ZipTricks::Streamer
62
62
  self
63
63
  end
64
64
 
65
+ # Writes a part of a zip entry body (actual binary data of the entry) into the output stream,
66
+ # and returns the number of bytes written. Is implemented to make Streamer usable with
67
+ # `IO.copy_stream(from, to)`.
68
+ #
69
+ # @param binary_data [String] a String in binary encoding
70
+ # @return [Fixnum] the number of bytes written
71
+ def write(binary_data)
72
+ self << binary_data
73
+ binary_data.bytesize
74
+ end
75
+
65
76
  # Advances the internal IO pointer to keep the offsets of the ZIP file in check. Use this if you are going
66
77
  # to use accelerated writes to the socket (like the `sendfile()` call) after writing the headers, or if you
67
78
  # just need to figure out the size of the archive.
data/lib/zip_tricks.rb CHANGED
@@ -2,7 +2,7 @@ require 'zip'
2
2
  require 'very_tiny_state_machine'
3
3
 
4
4
  module ZipTricks
5
- VERSION = '2.6.1'
5
+ VERSION = '2.7.0'
6
6
 
7
7
  # Require all the sub-components except myself
8
8
  Dir.glob(__dir__ + '/**/*.rb').sort.each {|p| require p unless p == __FILE__ }
@@ -207,7 +207,7 @@ describe ZipTricks::Streamer do
207
207
  zip.add_stored_entry("first-file.bin", raw_file_1.size, Zlib.crc32(raw_file_1))
208
208
  zip << raw_file_1
209
209
  zip.add_stored_entry("второй-файл.bin", raw_file_2.size, Zlib.crc32(raw_file_2))
210
- zip << raw_file_2
210
+ IO.copy_stream(StringIO.new(raw_file_2), zip)
211
211
  zip.close
212
212
 
213
213
  zip_buf.flush
data/zip_tricks.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: zip_tricks 2.6.1 ruby lib
5
+ # stub: zip_tricks 2.7.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "zip_tricks"
9
- s.version = "2.6.1"
9
+ s.version = "2.7.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Julik Tarkhanov"]
14
- s.date = "2016-07-14"
14
+ s.date = "2016-07-15"
15
15
  s.description = "Makes rubyzip stream, for real"
16
16
  s.email = "me@julik.nl"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zip_tricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-14 00:00:00.000000000 Z
11
+ date: 2016-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip