silent-oracle 0.1.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.
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.md ADDED
@@ -0,0 +1,8 @@
1
+ # SilentOracle
2
+
3
+ Silences internal diagnostic messages from the [Oracle Enhanced](https://github.com/rsim/oracle-enhanced) connection adapter.
4
+
5
+ Enabled only in development and test environments, skips production for
6
+ performance reasons - logging is probably disabled there anyway.
7
+
8
+ Based off of Łukasz Piestrzeniewicz and Evgeniy Dolzhenko's [silent-postgres](https://github.com/dolzenko/silent-postgres) gem, released under the MIT license.
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'silent-oracle'
@@ -0,0 +1,29 @@
1
+ if Rails.env.development? || Rails.env.test?
2
+ require "silent-oracle/railtie"
3
+
4
+ module SilentOracle
5
+ SILENCED_METHODS = %w(next_sequence_value tables has_primary_key_trigger? columns pk_and_sequence_for temporary_table?)
6
+ def self.included(base)
7
+ SILENCED_METHODS.each do |m|
8
+ base.send :alias_method_chain, m, :silencer
9
+ end
10
+ end
11
+
12
+ SILENCED_METHODS.each do |m|
13
+ m1, m2 = if m =~ /^(.*)\?$/
14
+ [$1, '?']
15
+ else
16
+ [m, nil]
17
+ end
18
+
19
+ eval <<-METHOD
20
+ def #{m1}_with_silencer#{m2}(*args)
21
+ @logger.silence do
22
+ #{m1}_without_silencer#{m2}(*args)
23
+ end
24
+ end
25
+ METHOD
26
+ end
27
+ end
28
+
29
+ end
@@ -0,0 +1,20 @@
1
+ module SilentOracle
2
+ def self.init!
3
+ ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.send(:include, SilentOracle)
4
+ rescue NameError
5
+ end
6
+
7
+ if defined?(Rails::Railtie)
8
+ # Rails 3
9
+ class Railtie < Rails::Railtie
10
+ initializer 'silent_oracle.insert_into_active_record' do
11
+ ActiveSupport.on_load :active_record do
12
+ SilentOracle.init!
13
+ end
14
+ end
15
+ end
16
+ else
17
+ # Rails 2
18
+ init!
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{silent-oracle}
5
+ s.version = "0.1.0"
6
+ s.summary = %q{Rails plugin that silences Oracle Enhanced connection adapter's verbose output.}
7
+ s.email = ['jason@tablexi.com']
8
+ s.homepage = %q{http://github.com/jhanggi/silent-oracle}
9
+ s.authors = ["Jason Hanggi"]
10
+ s.files = ["MIT-LICENSE", "README.md", "silent-oracle.gemspec", "lib/silent-oracle/railtie.rb", "lib/silent-oracle.rb", "init.rb"]
11
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: silent-oracle
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Jason Hanggi
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-09-25 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description:
22
+ email:
23
+ - jason@tablexi.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - MIT-LICENSE
32
+ - README.md
33
+ - silent-oracle.gemspec
34
+ - lib/silent-oracle/railtie.rb
35
+ - lib/silent-oracle.rb
36
+ - init.rb
37
+ has_rdoc: true
38
+ homepage: http://github.com/jhanggi/silent-oracle
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options: []
43
+
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ segments:
51
+ - 0
52
+ version: "0"
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project:
63
+ rubygems_version: 1.3.6
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Rails plugin that silences Oracle Enhanced connection adapter's verbose output.
67
+ test_files: []
68
+