postgresql_lo_streamer 0.1.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d3171f3ae20cdd0af715fb940b14fdb6d6500ff
4
- data.tar.gz: 92af3833601de601419fab9203cd2ac87fad3db6
3
+ metadata.gz: 5028060daeb00b344cfd60c7d6d5a0677d28c290
4
+ data.tar.gz: 2ffc5a2221863a7379d109e83122dc8ded49f005
5
5
  SHA512:
6
- metadata.gz: 0a47682ca4897d710075558ee30cb6c85c4f0b7733409149e192e710dbbf2de687fc94302eac4dd792418a1f053fc03363704be309d487cfa90b9022186c387b
7
- data.tar.gz: e8c10c09dd4cb52d240c8d1ec8a4c1c70625aee1e60c5b0bdb3b3ebca908b720bc2d83084dbac2847cf077b85c9459189affb5dc5b1875c90fabd98edeb14b09
6
+ metadata.gz: 373c5432bbf17eaa52fd777e84751282870c1ebb3db77c2cf21d08ed98aeadf856a363001a2850600c1528010b8234749ee188c76f03467ad34a33097063b246
7
+ data.tar.gz: 7185e3b987ea8f3cf8f2c0e0f4961793e6bce819791138e4ca9d4743f18ae5be9dc89e139c00e9095c1c097a5d9fd410ddad4b9153c7ac9064c1feddf325a9ca
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2012 YOURNAME
1
+ Copyright 2016 Diogo Biazus
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # postgresql_lo_streamer [![Build Status](https://secure.travis-ci.org/diogob/postgresql_lo_streamer.png)](http://travis-ci.org/diogob/postgresql_lo_streamer)
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 [oficial docs](http://www.postgresql.org/docs/9.2/static/largeobjects.html)
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
- # TODO: make this headers configurable
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
@@ -0,0 +1,15 @@
1
+ class PostgresqlLoStreamer::Configuration
2
+ attr_accessor :options
3
+
4
+ def initialize
5
+ self.reset
6
+ end
7
+
8
+ def options
9
+ @options
10
+ end
11
+
12
+ def reset
13
+ self.options = {:type => 'image/png', :disposition => 'inline'}
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module PostgresqlLoStreamer
2
- VERSION = "0.1.2"
2
+ VERSION = "1.0.0"
3
3
  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.1.2
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: 2013-09-23 00:00:00.000000000 Z
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: 3.2.8
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: 3.2.8
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: 2.11.0
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: 2.11.0
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.0.7
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