refile-postgres 1.0.1 → 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/lib/refile/postgres/backend.rb +9 -8
- data/lib/refile/postgres/version.rb +1 -1
- data/lib/refile/postgres.rb +1 -0
- data/refile-postgres.gemspec +1 -1
- 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: 1a2de86a2c55176c8278b78261c65b7cdd2527ba
|
4
|
+
data.tar.gz: abea52a0825fc8b2dae5be27e90c8dc0d71ec770
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9e4c4f0a39e3619b6025477e66a5ef0712e01f2a026ccd6fa8c3a3ea9960416143e8bc2d4ae0a8f3c26043c852a808f0c54b4400e48bc0472347ec414f4e66f
|
7
|
+
data.tar.gz: ce97cd02b32db7f53dca3b3456c34d11f70e77f33a14ac1f7079591e2d3341c29ae9005f41eb04f27d71bfaa8510a2be9c4a4e662db20f1dfb55041380c415d9
|
@@ -2,6 +2,7 @@ module Refile
|
|
2
2
|
module Postgres
|
3
3
|
class Backend
|
4
4
|
include SmartTransaction
|
5
|
+
extend Refile::BackendMacros
|
5
6
|
RegistryTableDoesNotExistError = Class.new(StandardError)
|
6
7
|
DEFAULT_REGISTRY_TABLE = "refile_attachments"
|
7
8
|
DEFAULT_NAMESPACE = "default"
|
@@ -36,8 +37,8 @@ module Refile
|
|
36
37
|
@registry_table
|
37
38
|
end
|
38
39
|
|
39
|
-
def upload(uploadable)
|
40
|
-
Refile.verify_uploadable(uploadable, max_size)
|
40
|
+
verify_uploadable def upload(uploadable)
|
41
|
+
# Refile.verify_uploadable(uploadable, max_size)
|
41
42
|
oid = connection.lo_creat
|
42
43
|
ensure_in_transaction do
|
43
44
|
begin
|
@@ -57,7 +58,7 @@ module Refile
|
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
60
|
-
def open(id)
|
61
|
+
verify_id def open(id)
|
61
62
|
if exists?(id)
|
62
63
|
Reader.new(connection, id)
|
63
64
|
else
|
@@ -65,7 +66,7 @@ module Refile
|
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
|
-
def read(id)
|
69
|
+
verify_id def read(id)
|
69
70
|
if exists?(id)
|
70
71
|
open(id).read
|
71
72
|
else
|
@@ -73,11 +74,11 @@ module Refile
|
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
76
|
-
def get(id)
|
77
|
+
verify_id def get(id)
|
77
78
|
Refile::File.new(self, id)
|
78
79
|
end
|
79
80
|
|
80
|
-
def exists?(id)
|
81
|
+
verify_id def exists?(id)
|
81
82
|
connection.exec_params(%{
|
82
83
|
SELECT count(*) FROM #{registry_table}
|
83
84
|
INNER JOIN #{PG_LARGE_OBJECT_TABLE}
|
@@ -89,7 +90,7 @@ module Refile
|
|
89
90
|
end
|
90
91
|
end
|
91
92
|
|
92
|
-
def size(id)
|
93
|
+
verify_id def size(id)
|
93
94
|
if exists?(id)
|
94
95
|
open(id).size
|
95
96
|
else
|
@@ -97,7 +98,7 @@ module Refile
|
|
97
98
|
end
|
98
99
|
end
|
99
100
|
|
100
|
-
def delete(id)
|
101
|
+
verify_id def delete(id)
|
101
102
|
if exists?(id)
|
102
103
|
ensure_in_transaction do
|
103
104
|
connection.lo_unlink(id.to_s.to_i)
|
data/lib/refile/postgres.rb
CHANGED
data/refile-postgres.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "refile", "~> 0.5"
|
21
|
+
spec.add_dependency "refile", "~> 0.5.3"
|
22
22
|
spec.add_dependency "pg"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.7"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refile-postgres
|
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
|
- Krists Ozols
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: refile
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.5.3
|
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: 0.5.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pg
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|