active_fedora_streamable 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +1 -1
- data/active_fedora_streamable.gemspec +3 -3
- data/lib/active_fedora_streamable.rb +21 -21
- metadata +128 -138
data/README.textile
CHANGED
@@ -3,7 +3,7 @@ An ActiveFedora mixin that allows a datastream dissemination response to be stre
|
|
3
3
|
Include the mixin in your ActiveFedora::Datastream subclass:
|
4
4
|
|
5
5
|
bc. class BigData < ActiveFedora::Datastream
|
6
|
-
include ActiveFedora::Datastreams
|
6
|
+
include ActiveFedora::Streamable::Datastreams
|
7
7
|
end
|
8
8
|
|
9
9
|
bc. class DataContainer < ActiveFedora::Base
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "active_fedora_streamable"
|
3
|
+
require "active_fedora_streamable/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "active_fedora_streamable"
|
7
|
-
s.version = ActiveFedora::Datastreams::
|
7
|
+
s.version = ActiveFedora::Streamable::Datastreams::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Benjamin Armintor"]
|
10
10
|
s.email = ["armintor@gmail.com"]
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.add_dependency('active-fedora', '>=4.2.0')
|
18
18
|
s.add_dependency("activesupport", '~>3.2.0')
|
19
|
-
s.add_dependency("rubydora", '~>0.5.
|
19
|
+
s.add_dependency("rubydora", '~>0.5.11')
|
20
20
|
s.add_development_dependency("yard")
|
21
21
|
s.add_development_dependency("RedCloth") # for RDoc formatting
|
22
22
|
s.add_development_dependency("rake")
|
@@ -1,29 +1,29 @@
|
|
1
1
|
require 'active-fedora'
|
2
|
-
module ActiveFedora
|
2
|
+
module ActiveFedora
|
3
3
|
module Streamable
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
4
|
+
module Datastreams
|
5
|
+
# the output of this method should be assigned to the response_body of a controller
|
6
|
+
# the bytes returned from the datastream dissemination will be written to the response
|
7
|
+
# piecemeal rather than being loaded into memory as a String
|
8
|
+
def stream(controller, parms=Hash.new)
|
9
|
+
parms = {:dsid=>self.dsid, :pid=>self.pid, :finished=>false}.merge parms
|
10
|
+
controller.headers['Last-Modified'] = self.lastModifiedDate || Time.now.ctime.to_s
|
11
|
+
if self.dsSize
|
12
|
+
controller.headers['Content-Length'] = self.dsSize.to_s
|
13
|
+
else
|
14
|
+
controller.headers['Transfer-Encoding'] = 'chunked'
|
15
|
+
end
|
16
|
+
#controller.response_body = ActiveFedora::Datastreams::Streamable::Streamer.new parms
|
17
|
+
controller.response_body = Enumerator.new do |blk|
|
18
|
+
repo = ActiveFedora::Base.connection_for_pid(parms[:pid])
|
19
|
+
repo.datastream_dissemination(parms) do |res|
|
20
|
+
res.read_body do |seg|
|
21
|
+
blk << seg
|
22
|
+
end
|
22
23
|
end
|
23
|
-
# this is a hack for https://github.com/archiloque/rest-client/issues/134
|
24
|
-
repo.client.options.delete :block_response
|
25
24
|
end
|
26
25
|
end
|
26
|
+
require 'active_fedora_streamable/version'
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
metadata
CHANGED
@@ -1,155 +1,154 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_fedora_streamable
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 0.1.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Benjamin Armintor
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-07-20 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: active-fedora
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 55
|
29
|
-
segments:
|
30
|
-
- 4
|
31
|
-
- 2
|
32
|
-
- 0
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 4.2.0
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: activesupport
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
25
|
none: false
|
41
|
-
requirements:
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 4.2.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: activesupport
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
42
35
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 15
|
45
|
-
segments:
|
46
|
-
- 3
|
47
|
-
- 2
|
48
|
-
- 0
|
36
|
+
- !ruby/object:Gem::Version
|
49
37
|
version: 3.2.0
|
50
38
|
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: rubydora
|
54
39
|
prerelease: false
|
55
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 3.2.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rubydora
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
56
49
|
none: false
|
57
|
-
requirements:
|
50
|
+
requirements:
|
58
51
|
- - ~>
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
segments:
|
62
|
-
- 0
|
63
|
-
- 5
|
64
|
-
- 9
|
65
|
-
version: 0.5.9
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.5.11
|
66
54
|
type: :runtime
|
67
|
-
version_requirements: *id003
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: yard
|
70
55
|
prerelease: false
|
71
|
-
|
72
|
-
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.5.11
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: yard
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
80
70
|
type: :development
|
81
|
-
version_requirements: *id004
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: RedCloth
|
84
71
|
prerelease: false
|
85
|
-
|
86
|
-
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: RedCloth
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
94
86
|
type: :development
|
95
|
-
version_requirements: *id005
|
96
|
-
- !ruby/object:Gem::Dependency
|
97
|
-
name: rake
|
98
87
|
prerelease: false
|
99
|
-
|
100
|
-
none: false
|
101
|
-
requirements:
|
102
|
-
- -
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rake
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
108
102
|
type: :development
|
109
|
-
version_requirements: *id006
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: rspec
|
112
103
|
prerelease: false
|
113
|
-
|
114
|
-
none: false
|
115
|
-
requirements:
|
116
|
-
- -
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspec
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
123
117
|
version: 2.9.0
|
124
118
|
type: :development
|
125
|
-
version_requirements: *id007
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: mocha
|
128
119
|
prerelease: false
|
129
|
-
|
130
|
-
none: false
|
131
|
-
requirements:
|
132
|
-
- -
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 2.9.0
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: mocha
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - '='
|
132
|
+
- !ruby/object:Gem::Version
|
139
133
|
version: 0.10.5
|
140
134
|
type: :development
|
141
|
-
|
142
|
-
|
143
|
-
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - '='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 0.10.5
|
142
|
+
description: An ActiveFedora mixin that allows a datastream dissemination response
|
143
|
+
to be streamed back in blocks without reading all content into memory.
|
144
|
+
email:
|
144
145
|
- armintor@gmail.com
|
145
146
|
executables: []
|
146
|
-
|
147
147
|
extensions: []
|
148
|
-
|
149
|
-
extra_rdoc_files:
|
148
|
+
extra_rdoc_files:
|
150
149
|
- LICENSE.txt
|
151
150
|
- README.textile
|
152
|
-
files:
|
151
|
+
files:
|
153
152
|
- Gemfile
|
154
153
|
- LICENSE.txt
|
155
154
|
- README.textile
|
@@ -157,37 +156,28 @@ files:
|
|
157
156
|
- lib/active_fedora_streamable.rb
|
158
157
|
homepage: https://github.com/cul/active_fedora_streamable
|
159
158
|
licenses: []
|
160
|
-
|
161
159
|
post_install_message:
|
162
160
|
rdoc_options: []
|
163
|
-
|
164
|
-
require_paths:
|
161
|
+
require_paths:
|
165
162
|
- lib
|
166
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
163
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
164
|
none: false
|
168
|
-
requirements:
|
169
|
-
- -
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
|
172
|
-
|
173
|
-
- 0
|
174
|
-
version: "0"
|
175
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ! '>='
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
170
|
none: false
|
177
|
-
requirements:
|
178
|
-
- -
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
|
181
|
-
segments:
|
182
|
-
- 0
|
183
|
-
version: "0"
|
171
|
+
requirements:
|
172
|
+
- - ! '>='
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
184
175
|
requirements: []
|
185
|
-
|
186
176
|
rubyforge_project:
|
187
177
|
rubygems_version: 1.8.24
|
188
178
|
signing_key:
|
189
179
|
specification_version: 3
|
190
|
-
summary: An ActiveFedora mixin that allows a datastream dissemination response to
|
180
|
+
summary: An ActiveFedora mixin that allows a datastream dissemination response to
|
181
|
+
be streamed back
|
191
182
|
test_files: []
|
192
|
-
|
193
183
|
has_rdoc:
|