silent-postgres 0.0.1
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.
- data/MIT-LICENSE +20 -0
- data/README +9 -0
- data/lib/silent-postgres/railtie.rb +12 -0
- data/lib/silent-postgres.rb +26 -0
- data/silent-postgres.gemspec +9 -0
- metadata +74 -0
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2008 [name of plugin creator]
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
SilentPostgres
|
|
2
|
+
==============
|
|
3
|
+
|
|
4
|
+
Silences internal diagnostic messages from postgresql connection adapter.
|
|
5
|
+
|
|
6
|
+
Enabled only in development and test environments, skips production for
|
|
7
|
+
performance reasons - logging is probably disabled there anyway.
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2008 Łukasz Piestrzeniewicz, released under the MIT license
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Rails 3 initialization
|
|
2
|
+
module SilentPostgres
|
|
3
|
+
require 'rails'
|
|
4
|
+
class Railtie < Rails::Railtie
|
|
5
|
+
initializer 'default_value_for.insert_into_active_record' do
|
|
6
|
+
ActiveSupport.on_load :active_record do
|
|
7
|
+
puts "Silencing Postgres"
|
|
8
|
+
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:include, SilentPostgres)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
if %w(test development).include?(ENV["RAILS_ENV"])
|
|
2
|
+
|
|
3
|
+
require "silent-postgres/railtie"
|
|
4
|
+
|
|
5
|
+
module SilentPostgres
|
|
6
|
+
SILENCED_METHODS = %w(tables indexes column_definitions pk_and_sequence_for last_insert_id)
|
|
7
|
+
|
|
8
|
+
def self.included(base)
|
|
9
|
+
SILENCED_METHODS.each do |m|
|
|
10
|
+
base.send :alias_method_chain, m, :silencer
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
SILENCED_METHODS.each do |m|
|
|
15
|
+
eval <<-METHOD
|
|
16
|
+
def #{m}_with_silencer(*args)
|
|
17
|
+
@logger.silence do
|
|
18
|
+
#{m}_without_silencer(*args)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
METHOD
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = %q{silent-postgres}
|
|
3
|
+
s.version = "0.0.1"
|
|
4
|
+
s.summary = %q{Rails plugin that silences Postgresql connection adapter verbose output}
|
|
5
|
+
s.email = ['bragi@ragnarson.com', 'dolzenko@gmail.com']
|
|
6
|
+
s.homepage = %q{http://github.com/dolzenko/silent-postgres}
|
|
7
|
+
s.authors = ["Łukasz Piestrzeniewicz", "Evgeniy Dolzhenko"]
|
|
8
|
+
s.files = ["MIT-LICENSE", "README", "lib", "silent-postgres.gemspec", "lib/silent-postgres", "lib/silent-postgres/railtie.rb", "lib/silent-postgres.rb"]
|
|
9
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: silent-postgres
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 29
|
|
5
|
+
prerelease: false
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.0.1
|
|
11
|
+
platform: ruby
|
|
12
|
+
authors:
|
|
13
|
+
- "\xC5\x81ukasz Piestrzeniewicz"
|
|
14
|
+
- Evgeniy Dolzhenko
|
|
15
|
+
autorequire:
|
|
16
|
+
bindir: bin
|
|
17
|
+
cert_chain: []
|
|
18
|
+
|
|
19
|
+
date: 2010-09-15 00:00:00 -07:00
|
|
20
|
+
default_executable:
|
|
21
|
+
dependencies: []
|
|
22
|
+
|
|
23
|
+
description:
|
|
24
|
+
email:
|
|
25
|
+
- bragi@ragnarson.com
|
|
26
|
+
- dolzenko@gmail.com
|
|
27
|
+
executables: []
|
|
28
|
+
|
|
29
|
+
extensions: []
|
|
30
|
+
|
|
31
|
+
extra_rdoc_files: []
|
|
32
|
+
|
|
33
|
+
files:
|
|
34
|
+
- MIT-LICENSE
|
|
35
|
+
- README
|
|
36
|
+
- silent-postgres.gemspec
|
|
37
|
+
- lib/silent-postgres/railtie.rb
|
|
38
|
+
- lib/silent-postgres.rb
|
|
39
|
+
has_rdoc: true
|
|
40
|
+
homepage: http://github.com/dolzenko/silent-postgres
|
|
41
|
+
licenses: []
|
|
42
|
+
|
|
43
|
+
post_install_message:
|
|
44
|
+
rdoc_options: []
|
|
45
|
+
|
|
46
|
+
require_paths:
|
|
47
|
+
- lib
|
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
hash: 3
|
|
54
|
+
segments:
|
|
55
|
+
- 0
|
|
56
|
+
version: "0"
|
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
|
+
none: false
|
|
59
|
+
requirements:
|
|
60
|
+
- - ">="
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
hash: 3
|
|
63
|
+
segments:
|
|
64
|
+
- 0
|
|
65
|
+
version: "0"
|
|
66
|
+
requirements: []
|
|
67
|
+
|
|
68
|
+
rubyforge_project:
|
|
69
|
+
rubygems_version: 1.3.7
|
|
70
|
+
signing_key:
|
|
71
|
+
specification_version: 3
|
|
72
|
+
summary: Rails plugin that silences Postgresql connection adapter verbose output
|
|
73
|
+
test_files: []
|
|
74
|
+
|