refile-postgres 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +13 -0
- data/README.md +4 -1
- data/Rakefile +8 -0
- data/lib/refile/postgres/backend.rb +4 -4
- data/lib/refile/postgres/version.rb +1 -1
- data/postgres-setup +4 -0
- data/refile-postgres.gemspec +5 -4
- data/spec/spec_helper.rb +7 -1
- metadata +30 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b129c61ee4581d4e99e9ac827bdb184bd0b2fff9
|
4
|
+
data.tar.gz: d62df92b49170bf5e007befe10efdd15f1a11b04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27a0484362b9297d92ac3fd2714532e8c4a26b89b83958f7b8db01ca7cc63257a6ccd912dff6475c90e14a1b86d7fa36ba77dc33e3af0884c3903fadc5fea814
|
7
|
+
data.tar.gz: 56252a7a16c0439306200c7311d2c7f4bbfa8039c6e45e9d1abba4e883e1f0ff1cfc4bc3826748c195f8491d1bb93a09773b80aadea1c0f3bd53a6077ce8b4a9
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
A PostgreSQL backend for [Refile](https://github.com/elabs/refile).
|
4
4
|
|
5
|
+
[![Build Status](https://travis-ci.org/krists/refile-postgres.svg?branch=master)](https://travis-ci.org/krists/refile-postgres)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/krists/refile-postgres/badges/gpa.svg)](https://codeclimate.com/github/krists/refile-postgres)
|
7
|
+
|
5
8
|
## Why?
|
6
9
|
|
7
10
|
* You want to store all your data in one place to simplify backups and replication
|
@@ -35,7 +38,7 @@ Or install it yourself as:
|
|
35
38
|
Generate migration for table were to store list of attachments.
|
36
39
|
|
37
40
|
$ rails g refile:postgres:migration
|
38
|
-
|
41
|
+
|
39
42
|
Run the migrations
|
40
43
|
|
41
44
|
$ rake db:migrate
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ module Refile
|
|
6
6
|
RegistryTableDoesNotExistError = Class.new(StandardError)
|
7
7
|
DEFAULT_REGISTRY_TABLE = "refile_attachments"
|
8
8
|
DEFAULT_NAMESPACE = "default"
|
9
|
-
|
9
|
+
PG_LARGE_OBJECT_METADATA_TABLE = "pg_largeobject_metadata"
|
10
10
|
READ_CHUNK_SIZE = 3000
|
11
11
|
INIT_CONNECTION_ARG_ERROR_MSG = "When initializing new Refile::Postgres::Backend first argument should be an instance of PG::Connection or a lambda/proc that returns it. When using ActiveRecord it is available as ActiveRecord::Base.connection.raw_connection"
|
12
12
|
|
@@ -86,8 +86,8 @@ module Refile
|
|
86
86
|
verify_id def exists?(id)
|
87
87
|
connection.exec_params(%{
|
88
88
|
SELECT count(*) FROM #{registry_table}
|
89
|
-
INNER JOIN #{
|
90
|
-
ON #{registry_table}.id = #{
|
89
|
+
INNER JOIN #{PG_LARGE_OBJECT_METADATA_TABLE}
|
90
|
+
ON #{registry_table}.id = #{PG_LARGE_OBJECT_METADATA_TABLE}.oid
|
91
91
|
WHERE #{registry_table}.namespace = $1::varchar
|
92
92
|
AND #{registry_table}.id = $2::integer;
|
93
93
|
}, [namespace, id.to_s.to_i]) do |result|
|
@@ -118,7 +118,7 @@ module Refile
|
|
118
118
|
ensure_in_transaction do
|
119
119
|
connection.exec_params(%{
|
120
120
|
SELECT * FROM #{registry_table}
|
121
|
-
INNER JOIN #{
|
121
|
+
INNER JOIN #{PG_LARGE_OBJECT_METADATA_TABLE} ON #{registry_table}.id = #{PG_LARGE_OBJECT_METADATA_TABLE}.oid
|
122
122
|
WHERE #{registry_table}.namespace = $1::varchar;
|
123
123
|
}, [namespace]) do |result|
|
124
124
|
result.each_row do |row|
|
data/postgres-setup
ADDED
data/refile-postgres.gemspec
CHANGED
@@ -18,14 +18,15 @@ 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.5"
|
22
22
|
spec.add_dependency "pg"
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler"
|
24
|
+
spec.add_development_dependency "bundler"
|
25
25
|
spec.add_development_dependency "rspec"
|
26
26
|
spec.add_development_dependency "webmock"
|
27
27
|
spec.add_development_dependency "pry"
|
28
28
|
spec.add_development_dependency "pry-stack_explorer"
|
29
|
-
spec.add_development_dependency "rails", "~> 4.1
|
30
|
-
spec.add_development_dependency "rake"
|
29
|
+
spec.add_development_dependency "rails", "~> 4.2.1"
|
30
|
+
spec.add_development_dependency "rake"
|
31
|
+
spec.add_development_dependency "codeclimate-test-reporter"
|
31
32
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,19 @@
|
|
1
|
+
require "codeclimate-test-reporter"
|
2
|
+
CodeClimate::TestReporter.start
|
3
|
+
|
1
4
|
$LOAD_PATH.unshift(File.join(Gem::Specification.find_by_name("refile").gem_dir, "spec"))
|
2
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
|
+
|
3
7
|
require "refile/spec_helper"
|
4
8
|
require "pg"
|
5
9
|
require "pry"
|
6
10
|
require "refile/postgres"
|
7
11
|
|
12
|
+
WebMock.disable!(:except => [:codeclimate_test_reporter])
|
13
|
+
|
8
14
|
RSpec.configure do |config|
|
9
15
|
config.before(:all) do
|
10
|
-
connection = PG.connect(dbname: 'refile_test')
|
16
|
+
connection = PG.connect(host: 'localhost', dbname: 'refile_test', user: 'refile_postgres_test_user', password: 'refilepostgres')
|
11
17
|
connection.exec %{ DROP TABLE IF EXISTS #{Refile::Postgres::Backend::DEFAULT_REGISTRY_TABLE} CASCADE; }
|
12
18
|
connection.exec %{
|
13
19
|
CREATE TABLE IF NOT EXISTS #{Refile::Postgres::Backend::DEFAULT_REGISTRY_TABLE}
|
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.1.
|
4
|
+
version: 1.1.3
|
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-
|
11
|
+
date: 2015-06-11 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.5
|
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.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pg
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,28 +114,42 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 4.1
|
117
|
+
version: 4.2.1
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 4.1
|
124
|
+
version: 4.2.1
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rake
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: codeclimate-test-reporter
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
description: Postgres database as a backend for Refile. Uses "Large Objects". See
|
140
154
|
http://www.postgresql.org/docs/9.3/static/largeobjects.html for more info.
|
141
155
|
email:
|
@@ -145,6 +159,7 @@ extensions: []
|
|
145
159
|
extra_rdoc_files: []
|
146
160
|
files:
|
147
161
|
- ".gitignore"
|
162
|
+
- ".travis.yml"
|
148
163
|
- Berksfile
|
149
164
|
- Berksfile.lock
|
150
165
|
- Gemfile
|
@@ -170,6 +185,7 @@ files:
|
|
170
185
|
- lib/refile/postgres/backend/reader.rb
|
171
186
|
- lib/refile/postgres/smart_transaction.rb
|
172
187
|
- lib/refile/postgres/version.rb
|
188
|
+
- postgres-setup
|
173
189
|
- refile-postgres.gemspec
|
174
190
|
- spec/refile/postgres/backend_spec.rb
|
175
191
|
- spec/spec_helper.rb
|