txgh-server 1.0.0.beta2 → 1.0.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 +4 -4
- data/lib/ext/zipline/output_stream.rb +62 -0
- data/lib/txgh-server/version.rb +1 -1
- data/txgh-server.gemspec +1 -1
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b61f30ae875a1c12d037ce7123cece67a1bd4a12
|
4
|
+
data.tar.gz: 35536bb56e5cee37208c0c8a8f64e60347a0f88a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d1655be5e922b9e6157bbc4791ca9dddddc8316df4459d4d3418e127076c2b8933de70dd43de9caab17a6d08a4e978fbde5455425ff43c62c3a832412caa3c0
|
7
|
+
data.tar.gz: 1f6ebab2ba51bf04f9e49fb6d03afcb7a7faef63492bcd6a1d84672b7aa5a6a02b5cf43ddbc085ee39338106065ecac198fc4f862c5d97636ab2f5370d72d01b
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Taken from https://github.com/fringd/zipline
|
2
|
+
# Didn't include zipline gem b/c it depends directly on rails and brings in a
|
3
|
+
# ton of useless dependencies
|
4
|
+
|
5
|
+
require 'stringio'
|
6
|
+
require 'zip'
|
7
|
+
|
8
|
+
# a ZipOutputStream that never rewinds output
|
9
|
+
# in order for that to be possible we store only uncompressed files
|
10
|
+
module Zipline
|
11
|
+
class OutputStream < Zip::OutputStream
|
12
|
+
|
13
|
+
#we need to be able to hand out own custom output in order to stream to browser
|
14
|
+
def initialize(io)
|
15
|
+
# Create an io stream thing
|
16
|
+
super StringIO.new, true
|
17
|
+
# Overwrite it with my own
|
18
|
+
@output_stream = io
|
19
|
+
end
|
20
|
+
|
21
|
+
def stream
|
22
|
+
@output_stream
|
23
|
+
end
|
24
|
+
|
25
|
+
def put_next_entry(entry_name, size)
|
26
|
+
new_entry = Zip::Entry.new(@file_name, entry_name)
|
27
|
+
|
28
|
+
#THIS IS THE MAGIC, tells zip to look after data for size, crc
|
29
|
+
new_entry.gp_flags = new_entry.gp_flags | 0x0008
|
30
|
+
|
31
|
+
super(new_entry)
|
32
|
+
|
33
|
+
# Uncompressed size in the local file header must be zero when bit 3
|
34
|
+
# of the general purpose flags is set, so set the size after the header
|
35
|
+
# has been written.
|
36
|
+
new_entry.size = size
|
37
|
+
end
|
38
|
+
|
39
|
+
# just reset state, no rewinding required
|
40
|
+
def finalize_current_entry
|
41
|
+
if current_entry
|
42
|
+
entry = current_entry
|
43
|
+
super
|
44
|
+
write_local_footer(entry)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def write_local_footer(entry)
|
49
|
+
@output_stream << [ 0x08074b50, entry.crc, entry.compressed_size, entry.size].pack('VVVV')
|
50
|
+
end
|
51
|
+
|
52
|
+
#never need to do this because we set correct sizes up front
|
53
|
+
def update_local_headers
|
54
|
+
nil
|
55
|
+
end
|
56
|
+
|
57
|
+
# helper to deal with difference between rubyzip 1.0 and 1.1
|
58
|
+
def current_entry
|
59
|
+
@currentEntry || @current_entry
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/lib/txgh-server/version.rb
CHANGED
data/txgh-server.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.add_dependency 'sinatra', '~> 1.4'
|
18
18
|
s.add_dependency 'sinatra-contrib', '~> 1.4'
|
19
19
|
s.add_dependency 'rubyzip', '>= 1.0', '<= 1.1.2'
|
20
|
-
s.add_dependency 'txgh', '
|
20
|
+
s.add_dependency 'txgh', '~> 5.4'
|
21
21
|
|
22
22
|
s.require_path = 'lib'
|
23
23
|
s.files = Dir['{lib,spec}/**/*', 'README.md', 'txgh-server.gemspec', 'LICENSE']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: txgh-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Jackowski
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-08-
|
12
|
+
date: 2016-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mime-types
|
@@ -77,16 +77,16 @@ dependencies:
|
|
77
77
|
name: txgh
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '5.4'
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '5.4'
|
90
90
|
description: An HTTP server for interacting with txgh.
|
91
91
|
email:
|
92
92
|
- mattjjacko@gmail.com
|
@@ -95,6 +95,7 @@ executables: []
|
|
95
95
|
extensions: []
|
96
96
|
extra_rdoc_files: []
|
97
97
|
files:
|
98
|
+
- lib/ext/zipline/output_stream.rb
|
98
99
|
- lib/txgh-server.rb
|
99
100
|
- lib/txgh-server/application.rb
|
100
101
|
- lib/txgh-server/download_handler.rb
|
@@ -158,9 +159,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
159
|
version: '0'
|
159
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
161
|
requirements:
|
161
|
-
- - "
|
162
|
+
- - ">="
|
162
163
|
- !ruby/object:Gem::Version
|
163
|
-
version:
|
164
|
+
version: '0'
|
164
165
|
requirements: []
|
165
166
|
rubyforge_project:
|
166
167
|
rubygems_version: 2.2.3
|