disable_connection_pooling 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2a0ba71fa216578cd118369b92f366d6052f2bf4
4
+ data.tar.gz: 335d2b5eb0d767393f47a6836a8be5ec51f8732d
5
+ SHA512:
6
+ metadata.gz: 0e931a6034f60572599791d8ed17409650a9cb1ee569b001d5d2e1c02d63a37c595f923e5048a5c327969f8551c9d0f86f1584be4f9db7d465354833d4c98b9e
7
+ data.tar.gz: 9e1c75ed825301c39c8bb7c9a3d4a2e4b157d3986837999bbcc73d2cf24c42cb56513171851f5994b6fd095eb7fb2750a8520f6391ac0ebd038e63fd8d9e4f58
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --require spec_helper
2
+ --colour
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in disable_connection_pooling.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Genki Sugawara
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,44 @@
1
+ # DisableConnectionPooling
2
+
3
+ Disable the connection pooling of Rails
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'disable_connection_pooling'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install disable_connection_pooling
18
+
19
+ ## Usage
20
+
21
+ ### Gemfile
22
+
23
+ ```ruby
24
+ gem 'disable_connection_pooling'
25
+ ```
26
+
27
+ ### config/application.rb
28
+
29
+ ```ruby
30
+ module MyApp
31
+ class Application.configure do
32
+ ...
33
+ config.active_record.disable_connection_pooling = true
34
+ end
35
+ end
36
+ ```
37
+
38
+ ## Contributing
39
+
40
+ 1. Fork it
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create new Pull Request
@@ -0,0 +1,5 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new('spec')
5
+ task :default => :spec
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'disable_connection_pooling/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'disable_connection_pooling'
8
+ spec.version = DisableConnectionPooling::VERSION
9
+ spec.authors = ['Genki Sugawara']
10
+ spec.email = ['sgwr_dts@yahoo.co.jp']
11
+ spec.description = %q{Disable the connection pooling of Rails}
12
+ spec.summary = %q{Disable the connection pooling of Rails}
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'rspec', '>= 2.11.0'
24
+ end
@@ -0,0 +1,4 @@
1
+ module DisableConnectionPooling; end
2
+
3
+ require 'disable_connection_pooling/version'
4
+ require 'disable_connection_pooling/active_record_base'
@@ -0,0 +1,7 @@
1
+ require 'active_record/base'
2
+
3
+ class ActiveRecord::Base
4
+ def self.disable_connection_pooling=(disable)
5
+ require 'disable_connection_pooling/railtie' if disable
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ class DisableConnectionPooling::ClearAllConnections
2
+ def initialize(app)
3
+ @app = app
4
+ end
5
+
6
+ def call(env)
7
+ @app.call(env)
8
+ ensure
9
+ ActiveRecord::Base.clear_all_connections!
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'active_record/railtie'
2
+ require 'disable_connection_pooling/clear_all_connections'
3
+
4
+ class DisableConnectionPooling::Railtie < Rails::Railtie
5
+ config.app_middleware.delete 'ActiveRecord::QueryCache'
6
+ config.app_middleware.swap 'ActiveRecord::ConnectionAdapters::ConnectionManagement', 'DisableConnectionPooling::ClearAllConnections'
7
+
8
+ config.after_initialize do
9
+ ActiveRecord::Base.clear_all_connections!
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module DisableConnectionPooling
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,5 @@
1
+ describe 'dummy' do
2
+ it 'dummy' do
3
+ expect(1).to eq(1)
4
+ end
5
+ end
File without changes
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: disable_connection_pooling
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Genki Sugawara
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 2.11.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 2.11.0
55
+ description: Disable the connection pooling of Rails
56
+ email:
57
+ - sgwr_dts@yahoo.co.jp
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - .rspec
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - disable_connection_pooling.gemspec
69
+ - lib/disable_connection_pooling.rb
70
+ - lib/disable_connection_pooling/active_record_base.rb
71
+ - lib/disable_connection_pooling/clear_all_connections.rb
72
+ - lib/disable_connection_pooling/railtie.rb
73
+ - lib/disable_connection_pooling/version.rb
74
+ - spec/dummy_spec.rb
75
+ - spec/spec_helper.rb
76
+ homepage: ''
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.0.14
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Disable the connection pooling of Rails
100
+ test_files:
101
+ - spec/dummy_spec.rb
102
+ - spec/spec_helper.rb