shrine-sql 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/shrine/storage/sql.rb +9 -10
- data/shrine-sql.gemspec +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd4558ab7415f7bf9bc17edf472b67c633e39743
|
4
|
+
data.tar.gz: bc98343ce8f0cae8e783d785393edc769437fa93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ed75b1997eb5efc0f05c2845bf9012f804713de7ef18f862d1aeb2cb02906f22d4d18a477e607f5937aa43d94c3bffa39b3c66cc17b0b13cd680b554628d43d
|
7
|
+
data.tar.gz: 1afc2718b07b48f2385f69fcabbc1724cb631f53a85a3b3d24fbfc732cb301cc1f97d532ba7c7c55701bbd9cb069d5ff1a16eed7391474baf213c7d02e3d1372
|
data/README.md
CHANGED
data/lib/shrine/storage/sql.rb
CHANGED
@@ -15,8 +15,8 @@ class Shrine
|
|
15
15
|
@dataset = @database[table]
|
16
16
|
end
|
17
17
|
|
18
|
-
def upload(io, id,
|
19
|
-
generated_id = store(io, id,
|
18
|
+
def upload(io, id, **options)
|
19
|
+
generated_id = store(io, id, **options)
|
20
20
|
id.replace(generated_id.to_s + File.extname(id))
|
21
21
|
end
|
22
22
|
|
@@ -52,8 +52,7 @@ class Shrine
|
|
52
52
|
def url(id, **options)
|
53
53
|
end
|
54
54
|
|
55
|
-
def clear!
|
56
|
-
raise Shrine::Confirm unless confirm == :confirm
|
55
|
+
def clear!
|
57
56
|
dataset.delete
|
58
57
|
end
|
59
58
|
|
@@ -66,19 +65,19 @@ class Shrine
|
|
66
65
|
|
67
66
|
private
|
68
67
|
|
69
|
-
def store(io, id,
|
68
|
+
def store(io, id, **options)
|
70
69
|
if copyable?(io, id)
|
71
|
-
copy(io, id,
|
70
|
+
copy(io, id, **options)
|
72
71
|
else
|
73
|
-
insert(io, id,
|
72
|
+
insert(io, id, **options)
|
74
73
|
end
|
75
74
|
end
|
76
75
|
|
77
|
-
def insert(io, id,
|
78
|
-
dataset.insert(content: io.read, metadata:
|
76
|
+
def insert(io, id, shrine_metadata: {})
|
77
|
+
dataset.insert(content: io.read, metadata: shrine_metadata.to_json)
|
79
78
|
end
|
80
79
|
|
81
|
-
def copy(io, id,
|
80
|
+
def copy(io, id, shrine_metadata: {})
|
82
81
|
record = io.storage.find(io.id).select(:content, :metadata)
|
83
82
|
dataset.insert([:content, :metadata], record)
|
84
83
|
end
|
data/shrine-sql.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "shrine-sql"
|
3
|
-
gem.version = "1.0
|
3
|
+
gem.version = "1.1.0"
|
4
4
|
|
5
5
|
gem.required_ruby_version = ">= 2.1"
|
6
6
|
|
@@ -10,10 +10,10 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["janko.marohnic@gmail.com"]
|
11
11
|
gem.license = "MIT"
|
12
12
|
|
13
|
-
gem.files = Dir["README.md", "LICENSE.txt", "lib/**/*.rb", "
|
13
|
+
gem.files = Dir["README.md", "LICENSE.txt", "lib/**/*.rb", "*.gemspec"]
|
14
14
|
gem.require_path = "lib"
|
15
15
|
|
16
|
-
gem.add_dependency "shrine", "~>
|
16
|
+
gem.add_dependency "shrine", "~> 2.0"
|
17
17
|
gem.add_dependency "sequel"
|
18
18
|
gem.add_dependency "down", ">= 1.0.3"
|
19
19
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shrine-sql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shrine
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sequel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|