postgresql_lo_streamer 0.1.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +10 -2
- data/app/controllers/postgresql_lo_streamer/lo_controller.rb +7 -2
- data/lib/postgresql_lo_streamer/configuration.rb +15 -0
- data/lib/postgresql_lo_streamer/version.rb +1 -1
- data/lib/postgresql_lo_streamer.rb +10 -0
- metadata +34 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5028060daeb00b344cfd60c7d6d5a0677d28c290
|
4
|
+
data.tar.gz: 2ffc5a2221863a7379d109e83122dc8ded49f005
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 373c5432bbf17eaa52fd777e84751282870c1ebb3db77c2cf21d08ed98aeadf856a363001a2850600c1528010b8234749ee188c76f03467ad34a33097063b246
|
7
|
+
data.tar.gz: 7185e3b987ea8f3cf8f2c0e0f4961793e6bce819791138e4ca9d4743f18ae5be9dc89e139c00e9095c1c097a5d9fd410ddad4b9153c7ac9064c1feddf325a9ca
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
# postgresql_lo_streamer [![Build Status](https://
|
1
|
+
# postgresql_lo_streamer [![Build Status](https://travis-ci.org/diogob/postgresql_lo_streamer.svg?branch=master)](https://travis-ci.org/diogob/postgresql_lo_streamer)
|
2
2
|
|
3
3
|
This gem adds to your application a controller that can read PostgreSQL Large Objects and stream them to a HTTP client.
|
4
4
|
|
5
|
-
For more information on PostgreSQL Large Objects you can take a look at the [
|
5
|
+
For more information on PostgreSQL Large Objects you can take a look at the [official docs](http://www.postgresql.org/docs/9.2/static/largeobjects.html)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -10,6 +10,14 @@ Add it to your Gemfile:
|
|
10
10
|
|
11
11
|
gem 'postgresql_lo_streamer'
|
12
12
|
|
13
|
+
### Configuration
|
14
|
+
|
15
|
+
You can adjust default file streaming headers by tweaking configuration options:
|
16
|
+
|
17
|
+
PostgresqlLoStreamer.configure do |config|
|
18
|
+
config.options = {:type => 'image/png', :disposition => 'inline'}
|
19
|
+
end
|
20
|
+
|
13
21
|
|
14
22
|
Add to your `config/routes.rb` the mount url where you are going to retrieve the files.
|
15
23
|
The following example will create a route `/image_file/:id` where :id is the oid of the Large Object in the database:
|
@@ -3,8 +3,7 @@
|
|
3
3
|
module PostgresqlLoStreamer
|
4
4
|
class LoController < ActionController::Base
|
5
5
|
def stream
|
6
|
-
|
7
|
-
send_file_headers!({:type => 'image/png', :disposition => 'inline'})
|
6
|
+
send_file_headers! configuration.options
|
8
7
|
self.status = 200
|
9
8
|
self.response_body = Enumerator.new do |y|
|
10
9
|
connection.transaction do
|
@@ -20,5 +19,11 @@ module PostgresqlLoStreamer
|
|
20
19
|
def connection
|
21
20
|
@con ||= ActiveRecord::Base.connection.raw_connection
|
22
21
|
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def configuration
|
26
|
+
PostgresqlLoStreamer.configuration
|
27
|
+
end
|
23
28
|
end
|
24
29
|
end
|
@@ -1,4 +1,14 @@
|
|
1
1
|
require "postgresql_lo_streamer/engine"
|
2
|
+
require "postgresql_lo_streamer/configuration"
|
2
3
|
|
3
4
|
module PostgresqlLoStreamer
|
5
|
+
class << self
|
6
|
+
def configure
|
7
|
+
yield configuration
|
8
|
+
end
|
9
|
+
|
10
|
+
def configuration
|
11
|
+
@configuration ||= Configuration.new
|
12
|
+
end
|
13
|
+
end
|
4
14
|
end
|
metadata
CHANGED
@@ -1,55 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postgresql_lo_streamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diogo Biazus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '4.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: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-its
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: pg
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
description: A simple engine of one controller that will use PostgreSQL LO interface
|
@@ -60,15 +74,16 @@ executables: []
|
|
60
74
|
extensions: []
|
61
75
|
extra_rdoc_files: []
|
62
76
|
files:
|
77
|
+
- MIT-LICENSE
|
78
|
+
- README.md
|
79
|
+
- Rakefile
|
63
80
|
- app/controllers/postgresql_lo_streamer/lo_controller.rb
|
64
81
|
- config/routes.rb
|
82
|
+
- lib/postgresql_lo_streamer.rb
|
83
|
+
- lib/postgresql_lo_streamer/configuration.rb
|
65
84
|
- lib/postgresql_lo_streamer/engine.rb
|
66
85
|
- lib/postgresql_lo_streamer/version.rb
|
67
|
-
- lib/postgresql_lo_streamer.rb
|
68
86
|
- lib/tasks/postgresql_lo_streamer_tasks.rake
|
69
|
-
- MIT-LICENSE
|
70
|
-
- Rakefile
|
71
|
-
- README.md
|
72
87
|
homepage: https://github.com/diogob/postgresql_lo_streamer
|
73
88
|
licenses: []
|
74
89
|
metadata: {}
|
@@ -78,17 +93,17 @@ require_paths:
|
|
78
93
|
- lib
|
79
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
95
|
requirements:
|
81
|
-
- -
|
96
|
+
- - ">="
|
82
97
|
- !ruby/object:Gem::Version
|
83
98
|
version: '0'
|
84
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
100
|
requirements:
|
86
|
-
- -
|
101
|
+
- - ">="
|
87
102
|
- !ruby/object:Gem::Version
|
88
103
|
version: '0'
|
89
104
|
requirements: []
|
90
105
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.5.1
|
92
107
|
signing_key:
|
93
108
|
specification_version: 4
|
94
109
|
summary: A Rails engine to stream PostgreSQL Large Objects to clients
|