active_record_host_pool 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/active_record_host_pool/connection_adapter_mixin.rb +2 -10
- data/lib/active_record_host_pool/connection_proxy.rb +2 -2
- data/lib/active_record_host_pool/pool_proxy.rb +1 -7
- data/lib/active_record_host_pool/version.rb +1 -1
- data/test/helper.rb +2 -2
- data/test/test_arhp.rb +1 -0
- metadata +22 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '018bdc07dc5428ae890589b96fbf3748d46ef5abc2625c61278ac50ffa079923'
|
4
|
+
data.tar.gz: 101a032eba4e5628106fd4ae8a83c66f52bb68d89f0baad5180ec41c83a932ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ea8bf1c7704be6d72c97be06dfc084a2a66aa0e64848fcabcbbbcb6c73b360517f9737eac8d0e6459e8b6c85d236d36ea7f2a8bf8ed697a46c9d2eb0eca5d3a
|
7
|
+
data.tar.gz: 6eeb13fbd13582106e01bd8fc8a560eeef690d4c375926d17ebccae96b385ca8d4d3e2a75372fc99efad09e7e1bc90e06fc4417d21b3e5deada1ee940f8e347a
|
@@ -1,11 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
begin
|
5
|
-
require "active_record/connection_adapters/#{adapter}"
|
6
|
-
rescue LoadError
|
7
|
-
end
|
8
|
-
end
|
3
|
+
require "active_record/connection_adapters/mysql2_adapter"
|
9
4
|
|
10
5
|
module ActiveRecordHostPool
|
11
6
|
module DatabaseSwitch
|
@@ -132,7 +127,4 @@ module ActiveRecord
|
|
132
127
|
end
|
133
128
|
end
|
134
129
|
|
135
|
-
|
136
|
-
next unless ActiveRecord::ConnectionAdapters.const_defined?(k)
|
137
|
-
ActiveRecord::ConnectionAdapters.const_get(k).class_eval { include ActiveRecordHostPool::DatabaseSwitch }
|
138
|
-
end
|
130
|
+
ActiveRecord::ConnectionAdapters::Mysql2Adapter.include(ActiveRecordHostPool::DatabaseSwitch)
|
@@ -35,8 +35,8 @@ module ActiveRecordHostPool
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# Override Delegator#respond_to_missing? to allow private methods to be accessed without warning
|
38
|
-
def respond_to_missing?(
|
39
|
-
__getobj__.respond_to?(
|
38
|
+
def respond_to_missing?(name, include_private)
|
39
|
+
__getobj__.respond_to?(name, include_private)
|
40
40
|
end
|
41
41
|
|
42
42
|
def private_methods(all = true)
|
@@ -86,13 +86,7 @@ module ActiveRecordHostPool
|
|
86
86
|
|
87
87
|
def rescuable_errors
|
88
88
|
@rescuable_errors ||= begin
|
89
|
-
e = []
|
90
|
-
if Object.const_defined?("Mysql")
|
91
|
-
e << Mysql::Error
|
92
|
-
end
|
93
|
-
if Object.const_defined?("Mysql2")
|
94
|
-
e << Mysql2::Error
|
95
|
-
end
|
89
|
+
e = [Mysql2::Error]
|
96
90
|
if ActiveRecord.const_defined?("NoDatabaseError")
|
97
91
|
e << ActiveRecord::NoDatabaseError
|
98
92
|
end
|
data/test/helper.rb
CHANGED
@@ -23,7 +23,7 @@ module ARHPTestSetup
|
|
23
23
|
|
24
24
|
def arhp_create_models
|
25
25
|
return if Object.const_defined?('Test1')
|
26
|
-
eval <<-
|
26
|
+
eval <<-RUBY
|
27
27
|
class Test1 < ActiveRecord::Base
|
28
28
|
self.table_name = "tests"
|
29
29
|
establish_connection(:test_host_1_db_1)
|
@@ -53,7 +53,7 @@ module ARHPTestSetup
|
|
53
53
|
self.table_name = "tests"
|
54
54
|
establish_connection(:test_host_2_db_5)
|
55
55
|
end
|
56
|
-
|
56
|
+
RUBY
|
57
57
|
end
|
58
58
|
|
59
59
|
def current_database(klass)
|
data/test/test_arhp.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_host_pool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Osheroff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 3.2.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '6.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,15 +29,15 @@ dependencies:
|
|
29
29
|
version: 3.2.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '6.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: mysql2
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
|
-
type: :
|
40
|
+
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
@@ -45,7 +45,7 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: bump
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
@@ -59,21 +59,21 @@ dependencies:
|
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: mocha
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: '0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
74
|
+
version: '0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: phenix
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
@@ -87,35 +87,35 @@ dependencies:
|
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
90
|
+
name: rake
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
95
|
+
version: 12.0.0
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 12.0.0
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
104
|
+
name: rubocop
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: 0.55.0
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
116
|
+
version: 0.55.0
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
118
|
+
name: shoulda
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - ">="
|
@@ -129,19 +129,19 @@ dependencies:
|
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
132
|
+
name: wwtd
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
135
|
- - ">="
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: 0
|
137
|
+
version: '0'
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: 0
|
144
|
+
version: '0'
|
145
145
|
description: ''
|
146
146
|
email:
|
147
147
|
- ben@gimbo.net
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
184
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.6
|
185
|
+
rubygems_version: 2.7.6
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Allow ActiveRecord to share a connection to multiple databases on the same
|