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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7723e0cc3727c9b97d1fff400a8ba0844c7c661
4
- data.tar.gz: f3913286722cb4a27c46d1099b9f7a6fc0d7a343
3
+ metadata.gz: 1a2de86a2c55176c8278b78261c65b7cdd2527ba
4
+ data.tar.gz: abea52a0825fc8b2dae5be27e90c8dc0d71ec770
5
5
  SHA512:
6
- metadata.gz: c46f8679708f2f6d0b040ad5c4b77e447828f2af382775aa9eb8cc41cd7cc8c3aabcd7d5bb63224659a85c47c9de76d5ab3791daed573ce86875b26dd0b947fa
7
- data.tar.gz: cb311303267ac2dc99e2d019f1b0ec92cf1c1260e1e2dcb8d0693ec399acaced2368f825d76ff9853b77b342410f8292c9922a56cc31f58552d6f89f69a038e6
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)
@@ -1,5 +1,5 @@
1
1
  module Refile
2
2
  module Postgres
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -1,3 +1,4 @@
1
+ require "refile/backend_macros"
1
2
  require "refile/postgres/version"
2
3
  require "refile/postgres/smart_transaction"
3
4
  require "refile/postgres/backend"
@@ -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.1
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-15 00:00:00.000000000 Z
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: '0.5'
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: '0.5'
26
+ version: 0.5.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pg
29
29
  requirement: !ruby/object:Gem::Requirement