zipstream 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fc4dea8b1609a7df0f0e68eadccf1d61c7c073ad
4
+ data.tar.gz: c4a408858eac58b00d9c71c7d4bc8c88678ca858
5
+ SHA512:
6
+ metadata.gz: a336f24de82b8adde80391a287a2f453d38aeb73f03be3ae9a475076fcb391ae822c53d8ef80b196ac3a7afc07417a832b163592a099b4dff0b9e008f279cdc6
7
+ data.tar.gz: 85e26d6863a6939ad362d5eef01382e8b4a962fb8e68487dcff59bc9efbaa6154204591931a308b86afcb1da64f73cbecfb79087ab3f230c90044a07a5b02d86
@@ -0,0 +1,4 @@
1
+ ���
2
+ �z�
3
+ O��J�t!57����G�Qy%a���kC<��N�疴���5�YdQ�EpM���дXJ+�Bj�\�=��N{�����.%^���!Z��c L �a�fߠ2����t㑻t�^�����
4
+ �4~�L�vJ��'f�"�P�����WB琡���*�� aG�-�W���]2$Ce]�@�����i6�
Binary file
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # ZipStream
1
+ # ZipStream [![Build Status](https://secure.travis-ci.org/sj26/zipstream.png?branch=master)](http://travis-ci.org/sj26/zipstream)
2
2
 
3
3
  Create zip files to a stream.
4
4
 
5
- Integration with Ruby on Rails means you can create a file, `index.zipstream`, which is a ruby file with a zip object:
5
+ Integration with Ruby on Rails means you can create a view, `index.zipstream`, which is a ruby file with a zip object:
6
6
 
7
7
  ```ruby
8
8
  @entries.each do |entry|
@@ -26,7 +26,7 @@ Giving you a zip file when rendered. More to come!
26
26
 
27
27
  Keep in mind that this will use one of your workers/threads/processes until the file is completely downloaded. We are using an iterated rack body which streams so if rack/web servers handle this nicely then you might be in luck.
28
28
 
29
- Tested with Rails 3.1 on REE 1.8.7 and MRI 1.9.3. Specs coming soon (tm).
29
+ Tested with Rails 3.1 on REE 1.8.7 and MRI 1.9.3.
30
30
 
31
31
  Large files are not yet handled efficiently. Coming soon!
32
32
 
@@ -38,4 +38,4 @@ Inspired by Rails Builder templates and http://pablotron.org/software/zipstream-
38
38
 
39
39
  Copyright (c) 2011 Samuel Cochran (sj26@sj26.com). Released under the MIT License, see [LICENSE][license] for details.
40
40
 
41
- [license]: https://github.com/sj26/zipstream/blob/master/LICENSE
41
+ [license]: https://github.com/sj26/zipstream/blob/master/LICENSE
@@ -3,8 +3,6 @@ require 'zlib'
3
3
 
4
4
  # Simple, streamable zip file creation
5
5
  class Zipstream
6
- VERSION = File.read File.expand_path '../../VERSION', __FILE__
7
-
8
6
  def initialize stream, options={}
9
7
  @stream = stream
10
8
  @length = 0
@@ -15,12 +13,17 @@ class Zipstream
15
13
  end
16
14
 
17
15
  def write name, data, options={}
18
- # Fails without specifying the window bits (odd!)
19
- deflater = Zlib::Deflate.new Zlib::BEST_COMPRESSION, -Zlib::MAX_WBITS
20
- zdata = deflater.deflate data, Zlib::FINISH
21
- deflater.close
16
+ if options[:method] == :store
17
+ zdata = data
18
+ method = 0x00
19
+ else
20
+ # Fails without specifying the window bits (odd!)
21
+ deflater = Zlib::Deflate.new Zlib::BEST_COMPRESSION, -Zlib::MAX_WBITS
22
+ zdata = deflater.deflate data, Zlib::FINISH
23
+ deflater.close
24
+ method = 0x08
25
+ end
22
26
 
23
- method = 0x08
24
27
  timestamp = dostime options[:datetime] || DateTime.now
25
28
  crc = Zlib.crc32 data
26
29
  zdata_length = zdata.length
@@ -33,10 +36,10 @@ class Zipstream
33
36
  @directory << [
34
37
  # central file header signature
35
38
  0x02014b50,
36
- # version made by
37
- (6 << 8) + 3,
38
- # version needed to extract
39
- (6 << 8) + 3,
39
+ # version made by - "DOS" & http://www.pkware.com/documents/casestudies/APPNOTE.TXT Version: 6.3.2
40
+ (0 << 8) & 63,
41
+ # version needed to extract - "DOS" & "2.0 - File is compressed using Deflate compression"
42
+ (0 << 8) & 20,
40
43
  # general purpose bit flag
41
44
  0x00,
42
45
  # compresion method (deflate or store)
@@ -70,8 +73,8 @@ class Zipstream
70
73
  @stream << [
71
74
  # local file header signature
72
75
  0x04034b50,
73
- # version needed to extract
74
- (6 << 8) + 3,
76
+ # version needed to extract - "DOS" & "2.0 - File is compressed using Deflate compression"
77
+ (0 << 8) & 20,
75
78
  # general purpose bit flag
76
79
  0x00,
77
80
  # compresion method (deflate or store)
@@ -123,10 +126,11 @@ class Zipstream
123
126
  protected
124
127
 
125
128
  def dostime datetime
126
- datetime.year << 25 | datetime.month << 21 | datetime.day << 16 | datetime.hour << 11 | datetime.min << 5 | datetime.sec >> 1
129
+ (datetime.year - 1980) << 25 | datetime.month << 21 | datetime.day << 16 | datetime.hour << 11 | datetime.min << 5 | datetime.sec >> 1
127
130
  end
128
131
  end
129
132
 
133
+ require 'zipstream/version'
130
134
  require 'zipstream/fiber'
131
135
  require 'zipstream/fiber_yielding_stream'
132
136
  require 'zipstream/body'
@@ -0,0 +1,3 @@
1
+ class Zipstream
2
+ VERSION = '0.1.3'
3
+ end
metadata CHANGED
@@ -1,27 +1,78 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zipstream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
5
- prerelease:
4
+ version: 0.1.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Samuel Cochran
9
8
  autorequire:
10
9
  bindir: bin
11
- cert_chain: []
12
- date: 2011-12-13 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDXDCCAkSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA6MQ0wCwYDVQQDDARzajI2
14
+ MRQwEgYKCZImiZPyLGQBGRYEc2oyNjETMBEGCgmSJomT8ixkARkWA2NvbTAeFw0x
15
+ MzAzMTEyMzIyMThaFw0xNDAzMTEyMzIyMThaMDoxDTALBgNVBAMMBHNqMjYxFDAS
16
+ BgoJkiaJk/IsZAEZFgRzajI2MRMwEQYKCZImiZPyLGQBGRYDY29tMIIBIjANBgkq
17
+ hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsr60Eo/ttCk8GMTMFiPr3GoYMIMFvLak
18
+ xSmTk9YGCB6UiEePB4THSSA5w6IPyeaCF/nWkDp3/BAam0eZMWG1IzYQB23TqIM0
19
+ 1xzcNRvFsn0aQoQ00k+sj+G83j3T5OOV5OZIlu8xAChMkQmiPd1NXc6uFv+Iacz7
20
+ kj+CMsI9YUFdNoU09QY0b+u+Rb6wDYdpyvN60YC30h0h1MeYbvYZJx/iZK4XY5zu
21
+ 4O/FL2ChjL2CPCpLZW55ShYyrzphWJwLOJe+FJ/ZBl6YXwrzQM9HKnt4titSNvyU
22
+ KzE3L63A3PZvExzLrN9u09kuWLLJfXB2sGOlw3n9t72rJiuBr3/OQQIDAQABo20w
23
+ azAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU99dfRjEKFyczTeIz
24
+ m3ZsDWrNC80wGAYDVR0RBBEwD4ENc2oyNkBzajI2LmNvbTAYBgNVHRIEETAPgQ1z
25
+ ajI2QHNqMjYuY29tMA0GCSqGSIb3DQEBBQUAA4IBAQArNvPoDTdElU79folErf7u
26
+ qFL/ZzuC53hyNG0bQGggKOZJ4PuzqI9AFGX6Viw+0iltZzuqo5WTuuOQknO1aJZl
27
+ hp3Jijjd/vpxFuwalQT6JcN9V0iz81KiI+9KPRDxedX4zK9PD4Be+ZJgZBOalk6U
28
+ gQM0w4nYX8KATozCgvkFvKOQrNBEa+BqPundb8r047VRuK9iPGaJJeBpBgXgCNQc
29
+ iAw+LFjcoeiI5naoCBHZ4uHGY0lXrxxcep3F/GFvKKYGrrI9c2j5awd0DaEzrCel
30
+ gtfuNEm5Q0pV0/XpT5PsXz/rGnsR4CS7BaIcx+bAwl5pRopCzCHfl5Igay1vefPZ
31
+ -----END CERTIFICATE-----
32
+ date: 2013-05-22 00:00:00.000000000 Z
13
33
  dependencies:
34
+ - !ruby/object:Gem::Dependency
35
+ name: rake
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ type: :development
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
14
48
  - !ruby/object:Gem::Dependency
15
49
  name: rspec
16
- requirement: &70305888673700 !ruby/object:Gem::Requirement
17
- none: false
50
+ requirement: !ruby/object:Gem::Requirement
18
51
  requirements:
19
52
  - - ~>
20
53
  - !ruby/object:Gem::Version
21
- version: 2.7.0
54
+ version: '2.8'
22
55
  type: :development
23
56
  prerelease: false
24
- version_requirements: *70305888673700
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.8'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rubyzip
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
25
76
  description:
26
77
  email: sj26@sj26.com
27
78
  executables: []
@@ -32,34 +83,33 @@ extra_rdoc_files:
32
83
  files:
33
84
  - README.md
34
85
  - LICENSE
35
- - VERSION
36
86
  - lib/zipstream/body.rb
37
87
  - lib/zipstream/fiber.rb
38
88
  - lib/zipstream/fiber_yielding_stream.rb
39
89
  - lib/zipstream/railtie.rb
90
+ - lib/zipstream/version.rb
40
91
  - lib/zipstream.rb
41
92
  homepage: http://github.com/sj26/zipstream
42
93
  licenses: []
94
+ metadata: {}
43
95
  post_install_message:
44
96
  rdoc_options: []
45
97
  require_paths:
46
98
  - lib
47
99
  required_ruby_version: !ruby/object:Gem::Requirement
48
- none: false
49
100
  requirements:
50
- - - ! '>='
101
+ - - '>='
51
102
  - !ruby/object:Gem::Version
52
103
  version: '0'
53
104
  required_rubygems_version: !ruby/object:Gem::Requirement
54
- none: false
55
105
  requirements:
56
- - - ! '>='
106
+ - - '>='
57
107
  - !ruby/object:Gem::Version
58
108
  version: '0'
59
109
  requirements: []
60
110
  rubyforge_project:
61
- rubygems_version: 1.8.11
111
+ rubygems_version: 2.0.3
62
112
  signing_key:
63
- specification_version: 3
113
+ specification_version: 4
64
114
  summary: Create zip files directly to a stream.
65
115
  test_files: []
Binary file
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.2