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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88569c9725438f4ec79a2e475952cf7ba968ce2c
4
- data.tar.gz: d5811879b451a6ec5bead0540a2d1582a5b9f5d2
3
+ metadata.gz: da14b47f215c9bd8351d8fb3be17eb0593e0a60d
4
+ data.tar.gz: a2dc145ca5c5e9b0146237e125b9e11a1ed80231
5
5
  SHA512:
6
- metadata.gz: f2ea7ef342d68564e10f5831e65804106bc8af0b1f53f352d658f340c9bae6de15d18d7dfe375695869b7d7a5934787f9d8e491d1b3a6897690de0aa8bd70b03
7
- data.tar.gz: d0874c8447a1b1053bbb4b64f8d5435f9bcd232b0092b9caf4c679f7da91d6a318e29ad9d674d758f23418531b73d0fa99da68120144fa47f2d97cf39ebf71ba
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
- plugin :default_storage, cache: :tus # set Shrine::Storage::Tus as temporary storage
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[:tus] = Shrine::Storage::Tus.new
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
- plugin :default_storage, cache: :tus # set Shrine::Storage::Tus as temporary storage
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
 
@@ -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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "shrine-tus"
3
- gem.version = "0.1.0"
3
+ gem.version = "0.1.1"
4
4
 
5
5
  gem.required_ruby_version = ">= 2.1"
6
6
 
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.0
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-04-09 00:00:00.000000000 Z
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.5.1
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.