shrine-tus 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -3
- data/lib/shrine/plugins/tus.rb +2 -1
- data/shrine-tus.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da14b47f215c9bd8351d8fb3be17eb0593e0a60d
|
4
|
+
data.tar.gz: a2dc145ca5c5e9b0146237e125b9e11a1ed80231
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0459a0600f217dcdb3ae88c235c5d444c87c20ce2714c59152d8b7c57a11fdf996e7a3d19a0e2b4203a1e6d21278bf645ae95a0b0addda58e27f8ae6a3a370fe'
|
7
|
+
data.tar.gz: 5fa4c13fb15a3f0251b110713125a4d088d0efd849b934a908f4525b0094d4d8b406f00dcda7db4b04644ab1adb18a7e2c246b6e3a3411b9f18690b861b553f7
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ a database record and move it to permanent Shrine storage.
|
|
15
15
|
|
16
16
|
```rb
|
17
17
|
class VideoUploader < Shrine
|
18
|
-
|
18
|
+
# ...
|
19
19
|
end
|
20
20
|
```
|
21
21
|
```rb
|
@@ -38,11 +38,15 @@ gem "shrine-url", "~> 0.3" # dependency of Shrine::Storage::Tus
|
|
38
38
|
```rb
|
39
39
|
require "shrine/storage/tus"
|
40
40
|
|
41
|
-
Shrine.storages
|
41
|
+
Shrine.storages = {
|
42
|
+
cache: Shrine::Storage::YourTemporaryStorage.new(...),
|
43
|
+
store: Shrine::Storage::YourPermanentStorage.new(...),
|
44
|
+
tus: Shrine::Storage::Tus.new,
|
45
|
+
}
|
42
46
|
```
|
43
47
|
```rb
|
44
48
|
class VideoUploader < Shrine
|
45
|
-
|
49
|
+
storages[:cache] = storages[:tus] # set Shrine::Storage::Tus as temporary storage
|
46
50
|
end
|
47
51
|
```
|
48
52
|
|
@@ -79,6 +83,9 @@ class VideoUploader < Shrine
|
|
79
83
|
end
|
80
84
|
```
|
81
85
|
|
86
|
+
Note that this last approach doesn't use `Shrine::Storage::Tus`, so you don't
|
87
|
+
need to add `shrine-url` to your Gemfile.
|
88
|
+
|
82
89
|
For more details, and an explanation of pros and cons for each of the
|
83
90
|
approaches, see [shrine-tus-demo].
|
84
91
|
|
data/lib/shrine/plugins/tus.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "json"
|
2
|
+
require "uri"
|
2
3
|
|
3
4
|
class Shrine
|
4
5
|
module Plugins
|
@@ -7,7 +8,7 @@ class Shrine
|
|
7
8
|
def assign(value)
|
8
9
|
if value.is_a?(String) && value != ""
|
9
10
|
data = JSON.parse(value)
|
10
|
-
data["id"] = tus_url_to_storage_id(data["id"], cache.storage)
|
11
|
+
data["id"] = tus_url_to_storage_id(data["id"], cache.storage) if URI.regexp =~ data["id"]
|
11
12
|
super(data.to_json)
|
12
13
|
else
|
13
14
|
super
|
data/shrine-tus.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shrine-tus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
142
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
143
|
+
rubygems_version: 2.6.11
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: Provides storage and plugin for easier integration between Shrine and tus-ruby-server.
|