fresh_connection 2.4.4 → 3.0.0.rc1
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 +4 -4
- data/.travis.yml +3 -3
- data/Appraisals +12 -11
- data/README.md +1 -1
- data/fresh_connection.gemspec +4 -4
- data/gemfiles/rails50.gemfile +2 -2
- data/gemfiles/rails51.gemfile +2 -2
- data/gemfiles/rails52.gemfile +10 -0
- data/lib/fresh_connection/abstract_connection_manager.rb +1 -22
- data/lib/fresh_connection/access_control.rb +2 -0
- data/lib/fresh_connection/check_adapter.rb +25 -0
- data/lib/fresh_connection/connection_manager.rb +1 -0
- data/lib/fresh_connection/connection_specification.rb +2 -14
- data/lib/fresh_connection/executor_hook.rb +2 -0
- data/lib/fresh_connection/extend/adapters/m2_adapter.rb +30 -0
- data/lib/fresh_connection/extend/adapters/pg_adapter.rb +41 -0
- data/lib/fresh_connection/extend/ar_abstract_adapter.rb +23 -49
- data/lib/fresh_connection/extend/ar_base.rb +5 -39
- data/lib/fresh_connection/extend/ar_relation.rb +1 -6
- data/lib/fresh_connection/extend/ar_relation_merger.rb +2 -0
- data/lib/fresh_connection/extend/ar_statement_cache.rb +10 -2
- data/lib/fresh_connection/extend.rb +5 -4
- data/lib/fresh_connection/rack/connection_management.rb +2 -0
- data/lib/fresh_connection/railtie.rb +1 -0
- data/lib/fresh_connection/replica_connection_handler.rb +1 -0
- data/lib/fresh_connection/version.rb +3 -1
- data/lib/fresh_connection.rb +2 -8
- metadata +30 -24
- data/gemfiles/rails42.gemfile +0 -10
- data/lib/fresh_connection/connection_factory.rb +0 -24
- data/lib/fresh_connection/deprecation.rb +0 -15
- data/lib/fresh_connection/railtie_for_rails4.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f071f5d9fa46ddea60fe9aaa63b65c7d8093e89cf39b46572ca163031ff8a3f0
|
4
|
+
data.tar.gz: a7b476a6274122a2010437b290d2ea664481ca85d10b8e81317bd40ba3c12c1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d97fd00f930e1fa5c1bac79422fb8e7fc183abf3d7b5b44dc6c00095d68268b4e62bd62c2e7205d2c34b063b7aa650aed69c20d97e7c728194ec089158c2673
|
7
|
+
data.tar.gz: 5d7f25ab66ccc092f506d83702cb9d74f64582e4ea71ed3ce220950fd569dd6f00bb4cb25238e8208b73a69f7e752ab25a4f15e11b266252f7a9d30feb85f497
|
data/.travis.yml
CHANGED
@@ -14,12 +14,12 @@ cache: bundler
|
|
14
14
|
rvm:
|
15
15
|
- 2.2.9
|
16
16
|
- 2.3.6
|
17
|
-
- 2.4.
|
18
|
-
- 2.5.
|
17
|
+
- 2.4.4
|
18
|
+
- 2.5.1
|
19
19
|
gemfile:
|
20
|
-
- gemfiles/rails42.gemfile
|
21
20
|
- gemfiles/rails50.gemfile
|
22
21
|
- gemfiles/rails51.gemfile
|
22
|
+
- gemfiles/rails52.gemfile
|
23
23
|
matrix:
|
24
24
|
fast_finish: true
|
25
25
|
bundler_args: --jobs 3 --retry 3
|
data/Appraisals
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
-
appraise "rails42" do
|
2
|
-
gem 'activerecord', '~> 4.2.0'
|
3
|
-
gem 'activesupport', '~> 4.2.0'
|
4
|
-
gem 'mysql2', '>= 0.3.13', '< 0.5'
|
5
|
-
gem 'pg', '~> 0.15'
|
6
|
-
end
|
7
|
-
|
8
1
|
appraise "rails50" do
|
9
2
|
gem 'activerecord', '~> 5.0.0'
|
10
3
|
gem 'activesupport', '~> 5.0.0'
|
11
|
-
gem 'mysql2', '>= 0.3.18', '< 0.
|
12
|
-
gem 'pg', '
|
4
|
+
gem 'mysql2', '>= 0.3.18', '< 0.6.0'
|
5
|
+
gem 'pg', '>= 0.18', '< 2.0'
|
13
6
|
end
|
14
7
|
|
15
8
|
appraise "rails51" do
|
16
9
|
gem 'activerecord', '~> 5.1.0'
|
17
10
|
gem 'activesupport', '~> 5.1.0'
|
18
|
-
gem 'mysql2', '>= 0.3.18', '< 0.
|
19
|
-
gem 'pg', '
|
11
|
+
gem 'mysql2', '>= 0.3.18', '< 0.6.0'
|
12
|
+
gem 'pg', '>= 0.18', '< 2.0'
|
13
|
+
end
|
14
|
+
|
15
|
+
appraise "rails52" do
|
16
|
+
gem 'activerecord', '5.2.0.rc2'
|
17
|
+
gem 'activesupport', '5.2.0.rc2'
|
18
|
+
#gem 'mysql2', '>= 0.4.4', '< 0.6.0'
|
19
|
+
gem 'mysql2', '~> 0.4.4'
|
20
|
+
gem 'pg', '>= 0.18', '< 2.0'
|
20
21
|
end
|
data/README.md
CHANGED
@@ -49,7 +49,7 @@ If you wish to ensure that queries are directed to the DB master, call `read_mas
|
|
49
49
|
```ruby
|
50
50
|
Article.where(id: 1).read_master
|
51
51
|
|
52
|
-
Account.count
|
52
|
+
Account.read_master.count
|
53
53
|
```
|
54
54
|
|
55
55
|
Within transactions, all queries are connected to the DB master.
|
data/fresh_connection.gemspec
CHANGED
@@ -21,12 +21,12 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.required_ruby_version = '>= 2.2'
|
23
23
|
|
24
|
-
spec.add_dependency 'activerecord', '>=
|
25
|
-
spec.add_dependency 'activesupport', '>=
|
24
|
+
spec.add_dependency 'activerecord', '>= 5.0.0', '< 5.3'
|
25
|
+
spec.add_dependency 'activesupport', '>= 5.0.0', '< 5.3'
|
26
26
|
spec.add_dependency 'concurrent-ruby', '~> 1.0.0'
|
27
27
|
|
28
|
-
spec.add_development_dependency 'mysql2', '>= 0.3.
|
29
|
-
spec.add_development_dependency 'pg', '
|
28
|
+
spec.add_development_dependency 'mysql2', '>= 0.3.18', '< 0.6.0'
|
29
|
+
spec.add_development_dependency 'pg', '>= 0.18', '< 2.0'
|
30
30
|
spec.add_development_dependency "bundler", ">= 1.3.0", "< 2.0"
|
31
31
|
spec.add_development_dependency "rake", ">= 0.8.7"
|
32
32
|
spec.add_development_dependency 'appraisal'
|
data/gemfiles/rails50.gemfile
CHANGED
data/gemfiles/rails51.gemfile
CHANGED
@@ -1,18 +1,7 @@
|
|
1
|
-
|
2
|
-
require 'fresh_connection/deprecation'
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
3
|
module FreshConnection
|
5
4
|
class AbstractConnectionManager
|
6
|
-
class << self
|
7
|
-
def method_added(name)
|
8
|
-
return unless name == :slave_connection
|
9
|
-
|
10
|
-
ActiveSupport::Deprecation.warn(
|
11
|
-
"'slave_connection' has been deprecated. use 'replica_connection' instead."
|
12
|
-
)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
5
|
attr_reader :spec_name
|
17
6
|
|
18
7
|
def initialize(spec_name = nil)
|
@@ -34,16 +23,6 @@ module FreshConnection
|
|
34
23
|
def recovery?
|
35
24
|
raise NotImplementedError
|
36
25
|
end
|
37
|
-
|
38
|
-
def replica_group
|
39
|
-
FreshConnection::Deprecation.warn(replica_group: :spec_name)
|
40
|
-
spec_name
|
41
|
-
end
|
42
|
-
|
43
|
-
def slave_group
|
44
|
-
FreshConnection::Deprecation.warn(slave_group: :spec_name)
|
45
|
-
spec_name
|
46
|
-
end
|
47
26
|
end
|
48
27
|
end
|
49
28
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FreshConnection
|
4
|
+
module CheckAdapter
|
5
|
+
def self.check(klass)
|
6
|
+
if mysql?(klass)
|
7
|
+
:mysql
|
8
|
+
elsif postgresql?(klass)
|
9
|
+
:postgresql
|
10
|
+
else
|
11
|
+
nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.mysql?(klass)
|
16
|
+
return false unless defined?(::ActiveRecord::ConnectionAdapters::Mysql2Adapter)
|
17
|
+
klass == ::ActiveRecord::ConnectionAdapters::Mysql2Adapter
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.postgresql?(klass)
|
21
|
+
return false unless defined?(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
22
|
+
klass == ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'active_support'
|
2
3
|
require 'active_support/core_ext'
|
3
4
|
|
@@ -18,9 +19,6 @@ module FreshConnection
|
|
18
19
|
ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver.new(@spec_name => build_config)
|
19
20
|
end
|
20
21
|
|
21
|
-
# when building a spec from envars, there may be no database.yml file, so
|
22
|
-
# be careful to avoid implicit dependency on it or derived contents.
|
23
|
-
|
24
22
|
def build_config
|
25
23
|
config = base_config.with_indifferent_access
|
26
24
|
|
@@ -35,17 +33,7 @@ module FreshConnection
|
|
35
33
|
if database_group_url
|
36
34
|
config_from_url
|
37
35
|
else
|
38
|
-
|
39
|
-
|
40
|
-
if !c && @spec_name == "replica" && config.key?("slave")
|
41
|
-
# provide backward-compatibility with :slave profile
|
42
|
-
ActiveSupport::Deprecation.warn(
|
43
|
-
"'slave' in database.yml is deprecated and will ignored from version 2.5.0. use 'replica' instead."
|
44
|
-
)
|
45
|
-
c = config["slave"]
|
46
|
-
end
|
47
|
-
|
48
|
-
c
|
36
|
+
config[@spec_name]
|
49
37
|
end
|
50
38
|
end
|
51
39
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FreshConnection
|
4
|
+
module Extend
|
5
|
+
module M2Adapter
|
6
|
+
def select_all(*args)
|
7
|
+
change_connection { super }
|
8
|
+
end
|
9
|
+
|
10
|
+
def select_rows(*args)
|
11
|
+
change_connection { super }
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def change_connection
|
17
|
+
return yield unless FreshConnection::AccessControl.replica_access?
|
18
|
+
|
19
|
+
master_connection = @connection
|
20
|
+
begin
|
21
|
+
replica_connection = @model_class.replica_connection
|
22
|
+
@connection = replica_connection.raw_connection
|
23
|
+
yield
|
24
|
+
ensure
|
25
|
+
@connection = master_connection
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FreshConnection
|
4
|
+
module Extend
|
5
|
+
module PgAdapter
|
6
|
+
def select_all(*args)
|
7
|
+
change_connection { super }
|
8
|
+
end
|
9
|
+
|
10
|
+
def select_rows(*args)
|
11
|
+
change_connection { super }
|
12
|
+
end
|
13
|
+
|
14
|
+
def select_values(*args)
|
15
|
+
change_connection { super }
|
16
|
+
end
|
17
|
+
|
18
|
+
def select_value(*args)
|
19
|
+
change_connection { super }
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def change_connection
|
25
|
+
return yield unless FreshConnection::AccessControl.replica_access?
|
26
|
+
|
27
|
+
master_connection = @connection
|
28
|
+
master_statements = @statements
|
29
|
+
begin
|
30
|
+
replica_connection = @model_class.replica_connection
|
31
|
+
@connection = replica_connection.raw_connection
|
32
|
+
@statements = replica_connection.instance_variable_get(:@statements)
|
33
|
+
yield
|
34
|
+
ensure
|
35
|
+
@connection = master_connection
|
36
|
+
@statements = master_statements
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -1,62 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'fresh_connection/check_adapter'
|
3
|
+
|
1
4
|
module FreshConnection
|
2
5
|
module Extend
|
3
6
|
module ArAbstractAdapter
|
4
|
-
def
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
master_connection.query_cache
|
16
|
-
end
|
17
|
-
|
18
|
-
def query_cache_enabled
|
19
|
-
return @query_cache_enabled unless master_connection
|
20
|
-
master_connection.query_cache_enabled
|
21
|
-
end
|
22
|
-
|
23
|
-
def cache(&block)
|
24
|
-
return super unless master_connection
|
25
|
-
master_connection.cache(&block)
|
26
|
-
end
|
27
|
-
|
28
|
-
def enable_query_cache!
|
29
|
-
return super unless master_connection
|
30
|
-
master_connection.enable_query_cache!
|
31
|
-
end
|
32
|
-
|
33
|
-
def disable_query_cache!
|
34
|
-
return super unless master_connection
|
35
|
-
master_connection.disable_query_cache!
|
36
|
-
end
|
37
|
-
|
38
|
-
def uncached(&block)
|
39
|
-
return super unless master_connection
|
40
|
-
master_connection.uncached(&block)
|
7
|
+
def inherited(klass)
|
8
|
+
klass.prepend BaseAdapter
|
9
|
+
|
10
|
+
case FreshConnection::CheckAdapter.check(klass)
|
11
|
+
when :mysql
|
12
|
+
require 'fresh_connection/extend/adapters/m2_adapter'
|
13
|
+
klass.prepend M2Adapter
|
14
|
+
when :postgresql
|
15
|
+
require 'fresh_connection/extend/adapters/pg_adapter'
|
16
|
+
klass.prepend PgAdapter
|
17
|
+
end
|
41
18
|
end
|
19
|
+
end
|
42
20
|
|
43
|
-
|
44
|
-
|
45
|
-
|
21
|
+
module BaseAdapter
|
22
|
+
def self.prepended(base)
|
23
|
+
base.send :attr_writer, :model_class
|
46
24
|
end
|
47
25
|
|
48
|
-
def
|
49
|
-
|
50
|
-
@query_cache_enabled = master_connection.query_cache_enabled
|
26
|
+
def log(*args)
|
27
|
+
args[1] = "[#{replica_spec_name}] #{args[1]}" if replica_spec_name
|
51
28
|
super
|
52
29
|
end
|
53
30
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
return super unless master_connection
|
58
|
-
@query_cache = master_connection.query_cache
|
59
|
-
super
|
31
|
+
def replica_spec_name
|
32
|
+
return nil if !defined?(@model_class) || !@model_class
|
33
|
+
@model_class.replica_connection_specification_name
|
60
34
|
end
|
61
35
|
end
|
62
36
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
require 'fresh_connection/access_control'
|
3
3
|
require 'fresh_connection/replica_connection_handler'
|
4
4
|
|
@@ -19,19 +19,15 @@ module FreshConnection
|
|
19
19
|
|
20
20
|
def replica_connection_specification_name=(spec_name)
|
21
21
|
spec_name = spec_name.to_s
|
22
|
-
spec_name = "replica" if spec_name.empty?
|
22
|
+
spec_name = "replica" if spec_name.empty?
|
23
23
|
|
24
24
|
@replica_connection_specification_name = spec_name
|
25
25
|
end
|
26
26
|
|
27
27
|
def connection
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
replica_c = replica_connection
|
32
|
-
replica_c.master_connection = master_c
|
33
|
-
replica_c.replica_spec_name = replica_connection_specification_name if logger && logger.debug?
|
34
|
-
replica_c
|
28
|
+
c = super
|
29
|
+
c.model_class = self
|
30
|
+
c
|
35
31
|
end
|
36
32
|
|
37
33
|
def read_master
|
@@ -72,36 +68,6 @@ module FreshConnection
|
|
72
68
|
replica_connection_handler.recovery?(replica_connection_specification_name)
|
73
69
|
end
|
74
70
|
|
75
|
-
def slave_connection
|
76
|
-
FreshConnection::Deprecation.warn(slave_connection: :replica_connection)
|
77
|
-
replica_connection
|
78
|
-
end
|
79
|
-
|
80
|
-
def clear_all_slave_connections!
|
81
|
-
FreshConnection::Deprecation.warn(clear_all_slave_connections!: :clear_all_replica_connections!)
|
82
|
-
clear_all_replica_connections!
|
83
|
-
end
|
84
|
-
|
85
|
-
def slave_connection_put_aside!
|
86
|
-
FreshConnection::Deprecation.warn(slave_connection_put_aside!: :replica_connection_put_aside!)
|
87
|
-
replica_connection_put_aside!
|
88
|
-
end
|
89
|
-
|
90
|
-
def slave_connection_recovery?
|
91
|
-
FreshConnection::Deprecation.warn(slave_connection_recovery?: :replica_connection_recovery?)
|
92
|
-
replica_connection_recovery?
|
93
|
-
end
|
94
|
-
|
95
|
-
def replica_group
|
96
|
-
FreshConnection::Deprecation.warn(replica_group: :replica_connection_specification_name)
|
97
|
-
replica_connection_specification_name
|
98
|
-
end
|
99
|
-
|
100
|
-
def slave_group
|
101
|
-
FreshConnection::Deprecation.warn(slave_group: :replica_connection_specification_name)
|
102
|
-
replica_connection_specification_name
|
103
|
-
end
|
104
|
-
|
105
71
|
private
|
106
72
|
|
107
73
|
def replica_connection_handler
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module FreshConnection
|
4
4
|
module Extend
|
@@ -58,11 +58,6 @@ module FreshConnection
|
|
58
58
|
connection.open_transactions == 0 && !read_master_value
|
59
59
|
end
|
60
60
|
|
61
|
-
def enable_slave_access
|
62
|
-
FreshConnection::Deprecation.warn(enable_slave_access: :enable_replica_access)
|
63
|
-
enable_replica_access
|
64
|
-
end
|
65
|
-
|
66
61
|
private
|
67
62
|
|
68
63
|
def exec_queries
|
@@ -1,8 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module FreshConnection
|
2
4
|
module Extend
|
3
5
|
module ArStatementCache
|
4
|
-
|
5
|
-
|
6
|
+
if ActiveRecord::VERSION::MINOR == 2
|
7
|
+
def execute(params, connection, &block)
|
8
|
+
klass.all.manage_access { super }
|
9
|
+
end
|
10
|
+
else
|
11
|
+
def execute(params, klass, connection, &block)
|
12
|
+
klass.all.manage_access { super }
|
13
|
+
end
|
6
14
|
end
|
7
15
|
end
|
8
16
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'active_support'
|
2
3
|
|
3
4
|
ActiveSupport.on_load(:active_record) do
|
@@ -8,8 +9,8 @@ ActiveSupport.on_load(:active_record) do
|
|
8
9
|
require 'fresh_connection/extend/ar_abstract_adapter'
|
9
10
|
|
10
11
|
ActiveRecord::Base.extend FreshConnection::Extend::ArBase
|
11
|
-
ActiveRecord::Relation.
|
12
|
-
ActiveRecord::Relation::Merger.
|
13
|
-
ActiveRecord::StatementCache.
|
14
|
-
ActiveRecord::ConnectionAdapters::AbstractAdapter.
|
12
|
+
ActiveRecord::Relation.prepend FreshConnection::Extend::ArRelation
|
13
|
+
ActiveRecord::Relation::Merger.prepend FreshConnection::Extend::ArRelationMerger
|
14
|
+
ActiveRecord::StatementCache.prepend FreshConnection::Extend::ArStatementCache
|
15
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.extend FreshConnection::Extend::ArAbstractAdapter
|
15
16
|
end
|
data/lib/fresh_connection.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'fresh_connection/connection_manager'
|
2
3
|
|
3
4
|
module FreshConnection
|
@@ -15,11 +16,4 @@ module FreshConnection
|
|
15
16
|
end
|
16
17
|
|
17
18
|
require 'fresh_connection/extend'
|
18
|
-
|
19
|
-
if defined?(Rails)
|
20
|
-
if Rails::VERSION::MAJOR.to_i == 4
|
21
|
-
require 'fresh_connection/railtie_for_rails4'
|
22
|
-
else
|
23
|
-
require 'fresh_connection/railtie'
|
24
|
-
end
|
25
|
-
end
|
19
|
+
require 'fresh_connection/railtie' if defined?(Rails)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fresh_connection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tsukasa OISHI
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,40 +16,40 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.0.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '5.
|
22
|
+
version: '5.3'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 5.0.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5.
|
32
|
+
version: '5.3'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activesupport
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 5.0.0
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '5.
|
42
|
+
version: '5.3'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 5.0.0
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '5.
|
52
|
+
version: '5.3'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: concurrent-ruby
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,34 +70,40 @@ dependencies:
|
|
70
70
|
requirements:
|
71
71
|
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: 0.3.
|
73
|
+
version: 0.3.18
|
74
74
|
- - "<"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 0.6.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.3.
|
83
|
+
version: 0.3.18
|
84
84
|
- - "<"
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
86
|
+
version: 0.6.0
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
88
|
name: pg
|
89
89
|
requirement: !ruby/object:Gem::Requirement
|
90
90
|
requirements:
|
91
|
-
- - "
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0.18'
|
94
|
+
- - "<"
|
92
95
|
- !ruby/object:Gem::Version
|
93
|
-
version: '0
|
96
|
+
version: '2.0'
|
94
97
|
type: :development
|
95
98
|
prerelease: false
|
96
99
|
version_requirements: !ruby/object:Gem::Requirement
|
97
100
|
requirements:
|
98
|
-
- - "
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.18'
|
104
|
+
- - "<"
|
99
105
|
- !ruby/object:Gem::Version
|
100
|
-
version: '0
|
106
|
+
version: '2.0'
|
101
107
|
- !ruby/object:Gem::Dependency
|
102
108
|
name: bundler
|
103
109
|
requirement: !ruby/object:Gem::Requirement
|
@@ -208,18 +214,19 @@ files:
|
|
208
214
|
- bin/setup
|
209
215
|
- bin/test
|
210
216
|
- fresh_connection.gemspec
|
211
|
-
- gemfiles/rails42.gemfile
|
212
217
|
- gemfiles/rails50.gemfile
|
213
218
|
- gemfiles/rails51.gemfile
|
219
|
+
- gemfiles/rails52.gemfile
|
214
220
|
- lib/fresh_connection.rb
|
215
221
|
- lib/fresh_connection/abstract_connection_manager.rb
|
216
222
|
- lib/fresh_connection/access_control.rb
|
217
|
-
- lib/fresh_connection/
|
223
|
+
- lib/fresh_connection/check_adapter.rb
|
218
224
|
- lib/fresh_connection/connection_manager.rb
|
219
225
|
- lib/fresh_connection/connection_specification.rb
|
220
|
-
- lib/fresh_connection/deprecation.rb
|
221
226
|
- lib/fresh_connection/executor_hook.rb
|
222
227
|
- lib/fresh_connection/extend.rb
|
228
|
+
- lib/fresh_connection/extend/adapters/m2_adapter.rb
|
229
|
+
- lib/fresh_connection/extend/adapters/pg_adapter.rb
|
223
230
|
- lib/fresh_connection/extend/ar_abstract_adapter.rb
|
224
231
|
- lib/fresh_connection/extend/ar_base.rb
|
225
232
|
- lib/fresh_connection/extend/ar_relation.rb
|
@@ -227,7 +234,6 @@ files:
|
|
227
234
|
- lib/fresh_connection/extend/ar_statement_cache.rb
|
228
235
|
- lib/fresh_connection/rack/connection_management.rb
|
229
236
|
- lib/fresh_connection/railtie.rb
|
230
|
-
- lib/fresh_connection/railtie_for_rails4.rb
|
231
237
|
- lib/fresh_connection/replica_connection_handler.rb
|
232
238
|
- lib/fresh_connection/version.rb
|
233
239
|
- log/.gitkeep
|
@@ -246,9 +252,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
246
252
|
version: '2.2'
|
247
253
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
248
254
|
requirements:
|
249
|
-
- - "
|
255
|
+
- - ">"
|
250
256
|
- !ruby/object:Gem::Version
|
251
|
-
version:
|
257
|
+
version: 1.3.1
|
252
258
|
requirements: []
|
253
259
|
rubyforge_project:
|
254
260
|
rubygems_version: 2.7.3
|
data/gemfiles/rails42.gemfile
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'active_support/deprecation'
|
2
|
-
require 'fresh_connection/connection_specification'
|
3
|
-
|
4
|
-
module FreshConnection
|
5
|
-
class ConnectionFactory
|
6
|
-
def initialize(group, modify_spec = nil)
|
7
|
-
deprecation_warn
|
8
|
-
@spec = FreshConnection::ConnectionSpecification.new(group, modify_spec: modify_spec).spec
|
9
|
-
end
|
10
|
-
|
11
|
-
def new_connection
|
12
|
-
deprecation_warn
|
13
|
-
ActiveRecord::Base.__send__(@spec.adapter_method, @spec.config)
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def deprecation_warn
|
19
|
-
ActiveSupport::Deprecation.warn(
|
20
|
-
"`FreshConnection::ConnectionFactory` class is deprecated and will removed from version 2.5.0."
|
21
|
-
)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'active_support/deprecation'
|
2
|
-
|
3
|
-
module FreshConnection
|
4
|
-
class Deprecation
|
5
|
-
class << self
|
6
|
-
def warn(list = {})
|
7
|
-
list.each do |old_method, new_method|
|
8
|
-
ActiveSupport::Deprecation.warn(
|
9
|
-
"'#{old_method}' is deprecated and will removed from version 2.5.0. use '#{new_method}' instead."
|
10
|
-
)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'fresh_connection/rack/connection_management'
|
2
|
-
|
3
|
-
module FreshConnection
|
4
|
-
class Railtie < Rails::Railtie
|
5
|
-
initializer "fresh_connection.configure_rails_initialization" do |app|
|
6
|
-
app.config.app_middleware.insert_before(
|
7
|
-
ActiveRecord::ConnectionAdapters::ConnectionManagement,
|
8
|
-
FreshConnection::Rack::ConnectionManagement
|
9
|
-
)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|