valkyrie-shrine 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/circle.yml +2 -2
- data/lib/valkyrie/shrine/checksum/s3.rb +2 -1
- data/lib/valkyrie/shrine/version.rb +1 -1
- data/lib/valkyrie/storage/shrine.rb +35 -5
- data/valkyrie-shrine.gemspec +3 -3
- metadata +23 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7a482b7fc9181f9af0f7a9b9f4fa4d7cc131c9b30489414799b7a0cc16d2c26
|
4
|
+
data.tar.gz: f20feb6e99e26a0c7e4af2bd39b19f2ad5a90d369b142d699abedbaa23829d64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 547028b04de7538b83d9bb1685e3424722691be427c40a3c33545b646c5df99cb1ff01ea7b899c175bb330c0163c4359c5d437e6bda81063ae17e4efcbf03273
|
7
|
+
data.tar.gz: 824399812e4df139b35c13c0d45c0adcf35d5c41528ebd235b8d95ecd8d07d7a0b4ae0bb409bec0d7cefdc288dfae8522c1e6c79a39f36842b2ea6e7e6074623
|
data/circle.yml
CHANGED
@@ -2,7 +2,7 @@ version: 2
|
|
2
2
|
jobs:
|
3
3
|
build:
|
4
4
|
docker:
|
5
|
-
- image:
|
5
|
+
- image: cimg/ruby:2.6.1
|
6
6
|
environment:
|
7
7
|
BUNDLER_VERSION: 2.0.1
|
8
8
|
steps:
|
@@ -26,4 +26,4 @@ jobs:
|
|
26
26
|
command: bundle exec rubocop
|
27
27
|
- run:
|
28
28
|
name: Run Specs
|
29
|
-
command: bundle exec rspec spec
|
29
|
+
command: bundle exec rspec spec
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'shrine'
|
4
4
|
require 'digest/md5'
|
5
|
+
require 'securerandom'
|
5
6
|
|
6
7
|
module Valkyrie
|
7
8
|
module Storage
|
@@ -11,12 +12,41 @@ module Valkyrie
|
|
11
12
|
attr_reader :shrine, :verifier, :path_generator, :identifier_prefix
|
12
13
|
|
13
14
|
class IDPathGenerator
|
14
|
-
def initialize(base_path: nil)
|
15
|
-
@base_path = base_path
|
16
|
-
end
|
15
|
+
def initialize(base_path: nil); end
|
17
16
|
|
17
|
+
# @return [String]
|
18
18
|
def generate(resource:, file:, original_filename:)
|
19
|
-
|
19
|
+
# Because Valkyrie has to maintain compatibility with ActiveFedora via
|
20
|
+
# the wings adapter, the file passed to #upload has to be saved before
|
21
|
+
# its associated FileMetadata; this means that the resource provided
|
22
|
+
# here is the parent FileSet rather than the FileMetadata object. As
|
23
|
+
# a result, when we upload derivatives (like thumbnails) we have to
|
24
|
+
# pass the same resource as for the original file. If we relied on
|
25
|
+
# the resource.id to generate the ID for the StreamFile here, that
|
26
|
+
# would result in derivative uploads overwriting their originals.
|
27
|
+
# Thus we use a UUID, prefixed by the resource ID.
|
28
|
+
"#{resource.id}/#{SecureRandom.uuid}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class DelayedDownload
|
33
|
+
attr_reader :shrine, :id
|
34
|
+
def initialize(shrine, id)
|
35
|
+
@shrine = shrine
|
36
|
+
@id = id
|
37
|
+
end
|
38
|
+
|
39
|
+
def file
|
40
|
+
@file ||= shrine.open(id)
|
41
|
+
end
|
42
|
+
|
43
|
+
def method_missing(meth_name, *args, &block)
|
44
|
+
return super unless file.respond_to?(meth_name)
|
45
|
+
file.send(meth_name, *args, &block)
|
46
|
+
end
|
47
|
+
|
48
|
+
def respond_to_missing?(meth_name, include_private = false)
|
49
|
+
file.respond_to?(meth_name) || super
|
20
50
|
end
|
21
51
|
end
|
22
52
|
|
@@ -57,7 +87,7 @@ module Valkyrie
|
|
57
87
|
# @raise Valkyrie::StorageAdapter::FileNotFound if nothing is found
|
58
88
|
def find_by(id:)
|
59
89
|
raise Valkyrie::StorageAdapter::FileNotFound unless shrine.exists?(shrine_id_for(id))
|
60
|
-
Valkyrie::StorageAdapter::StreamFile.new(id: Valkyrie::ID.new(id.to_s), io:
|
90
|
+
Valkyrie::StorageAdapter::StreamFile.new(id: Valkyrie::ID.new(id.to_s), io: DelayedDownload.new(shrine, shrine_id_for(id)))
|
61
91
|
rescue Aws::S3::Errors::NoSuchKey
|
62
92
|
raise Valkyrie::StorageAdapter::FileNotFound
|
63
93
|
end
|
data/valkyrie-shrine.gemspec
CHANGED
@@ -24,15 +24,15 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.require_paths = ['lib']
|
25
25
|
|
26
26
|
spec.add_dependency 'aws-sdk-s3', '~> 1'
|
27
|
-
spec.add_dependency 'shrine', '
|
27
|
+
spec.add_dependency 'shrine', '>= 2.0', '< 4.0'
|
28
28
|
spec.add_dependency 'valkyrie', '> 1.0'
|
29
29
|
|
30
30
|
spec.add_development_dependency 'bixby', '~> 2.0.0.pre.beta1'
|
31
31
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
32
|
-
spec.add_development_dependency 'coveralls'
|
32
|
+
spec.add_development_dependency 'coveralls', '~> 0.8.3'
|
33
33
|
spec.add_development_dependency 'pry'
|
34
34
|
spec.add_development_dependency 'pry-byebug'
|
35
|
-
spec.add_development_dependency 'rake', '
|
35
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
36
36
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
37
37
|
spec.add_development_dependency 'simplecov'
|
38
38
|
spec.add_development_dependency 'actionpack'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valkyrie-shrine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brendan Quinn
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -28,16 +28,22 @@ dependencies:
|
|
28
28
|
name: shrine
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.0'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '4.0'
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: '2.0'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '4.0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: valkyrie
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +90,16 @@ dependencies:
|
|
84
90
|
name: coveralls
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
87
|
-
- - "
|
93
|
+
- - "~>"
|
88
94
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
95
|
+
version: 0.8.3
|
90
96
|
type: :development
|
91
97
|
prerelease: false
|
92
98
|
version_requirements: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
|
-
- - "
|
100
|
+
- - "~>"
|
95
101
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
102
|
+
version: 0.8.3
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
104
|
name: pry
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,16 +132,16 @@ dependencies:
|
|
126
132
|
name: rake
|
127
133
|
requirement: !ruby/object:Gem::Requirement
|
128
134
|
requirements:
|
129
|
-
- - "
|
135
|
+
- - ">="
|
130
136
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
137
|
+
version: 12.3.3
|
132
138
|
type: :development
|
133
139
|
prerelease: false
|
134
140
|
version_requirements: !ruby/object:Gem::Requirement
|
135
141
|
requirements:
|
136
|
-
- - "
|
142
|
+
- - ">="
|
137
143
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
144
|
+
version: 12.3.3
|
139
145
|
- !ruby/object:Gem::Dependency
|
140
146
|
name: rspec
|
141
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,7 +184,7 @@ dependencies:
|
|
178
184
|
- - ">="
|
179
185
|
- !ruby/object:Gem::Version
|
180
186
|
version: '0'
|
181
|
-
description:
|
187
|
+
description:
|
182
188
|
email:
|
183
189
|
- brendan-quinn@northwestern.edu
|
184
190
|
executables: []
|
@@ -207,7 +213,7 @@ homepage: https://github.com/samvera-labs/valkyrie-shrine
|
|
207
213
|
licenses:
|
208
214
|
- Apache-2.0
|
209
215
|
metadata: {}
|
210
|
-
post_install_message:
|
216
|
+
post_install_message:
|
211
217
|
rdoc_options: []
|
212
218
|
require_paths:
|
213
219
|
- lib
|
@@ -222,8 +228,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
228
|
- !ruby/object:Gem::Version
|
223
229
|
version: '0'
|
224
230
|
requirements: []
|
225
|
-
rubygems_version: 3.
|
226
|
-
signing_key:
|
231
|
+
rubygems_version: 3.1.4
|
232
|
+
signing_key:
|
227
233
|
specification_version: 4
|
228
234
|
summary: Shrine storage adapter for Valkyrie
|
229
235
|
test_files: []
|