knockoff 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f4dbe4e0b05729412bb47e57c2cb3ea0b345be7a
4
- data.tar.gz: 770d78e8d79a682fd87d85e12dfaf915563d6038
2
+ SHA256:
3
+ metadata.gz: 95bb6904e4373aa3b026fc1e950b8f5cc9081a4abd174e58ef4ed521824fb5bb
4
+ data.tar.gz: 6bfeeb88cb514854c2e550f531d65c76c160bcac1225b741deab01f6183e0abf
5
5
  SHA512:
6
- metadata.gz: 95c6cad5af95ca7668a64332e06984e6156bb98b395d523aed37219c4175458754c2043a92a19643c6f7c6815468a73b5405ff2225962a78646f05caf8169ecd
7
- data.tar.gz: 3178e3f88c005cba27dea06856946e24f33bf9102c5131b6721ed8e9e4a766e11c1f50893a3dcfbef39ff6212c2efb2593ff71b144b48b4e8a0b2cf1f1856643
6
+ metadata.gz: e2afdaf7285a09cb98a2946f19313160d84fe57208e86e00278732c391143c524093ab40e241a4db0c59711db789737b64e4958f2667fec6c7727f006e584663
7
+ data.tar.gz: ee421e025448df4043319d90be8ed9aa8f9e2979d633feaa29d8876ea8bfb24aa1411d6103aeb65d50cb25f5c549732165d60330355bfe944f53fdc6bb14f955
@@ -2,7 +2,8 @@ language: ruby
2
2
  notifications:
3
3
  email: false
4
4
  rvm:
5
- - 2.3.1
6
5
  - 2.4.0
7
6
  - 2.5.1
7
+ - 2.6.6
8
+ - 2.7.2
8
9
  - ruby-head
@@ -1,6 +1,10 @@
1
1
  ## Unreleased
2
2
 
3
- *None*
3
+ ## 1.1.1
4
+
5
+ - Drop Ruby 2.3 support
6
+ - Add Ruby 2.6 and 2.7 support
7
+ - Fix a deprecation warning in Rails 6
4
8
 
5
9
  ## 1.1.0
6
10
 
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Knockoff
2
2
 
3
- [![Build Status](https://travis-ci.org/joinhandshake/knockoff.svg?branch=master)](https://travis-ci.org/joinhandshake/knockoff)
3
+ [![Build Status](https://travis-ci.com/joinhandshake/knockoff.svg?branch=master)](https://travis-ci.com/github/joinhandshake/knockoff)
4
4
  [![Gem Version](https://badge.fury.io/rb/knockoff.svg)](https://badge.fury.io/rb/knockoff)
5
5
 
6
6
  A gem for easily using read replicas.
7
7
 
8
- :handshake: Battle tested at [Handshake](https://joinhandshake.com/engineering/)
8
+ :handshake: Battle tested at [Handshake](https://joinhandshake.com/)
9
9
 
10
10
  ## Library Goals
11
11
 
@@ -17,7 +17,7 @@ A gem for easily using read replicas.
17
17
 
18
18
  ## Supported Versions
19
19
 
20
- Knockoff supports Rails 4 and 5
20
+ Knockoff supports Rails 4, 5 and 6
21
21
 
22
22
  ## Installation
23
23
 
@@ -5,11 +5,11 @@ module ActiveRecord
5
5
  # Supports queries like User.on_replica.to_a
6
6
  alias_method :exec_queries_without_knockoff, :exec_queries
7
7
 
8
- def exec_queries
8
+ def exec_queries(&block)
9
9
  if knockoff_target == :replica
10
- Knockoff.on_replica { exec_queries_without_knockoff }
10
+ Knockoff.on_replica { exec_queries_without_knockoff(&block) }
11
11
  else
12
- exec_queries_without_knockoff
12
+ exec_queries_without_knockoff(&block)
13
13
  end
14
14
  end
15
15
 
@@ -96,10 +96,17 @@ module Knockoff
96
96
 
97
97
  # Store the hash in configuration and use it when we establish the connection later.
98
98
  key = "knockoff_replica_#{index}"
99
- full_config = replica_config.merge(uri_config)
99
+ config = replica_config.merge(uri_config)
100
100
 
101
- ActiveRecord::Base.configurations[key] = full_config
102
- @replicas_configurations[key] = full_config
101
+ if ActiveRecord::VERSION::MAJOR >= 6
102
+ full_config = ActiveRecord::Base.configurations.to_h.merge(key => config)
103
+
104
+ ActiveRecord::Base.configurations = full_config
105
+ @replicas_configurations[key] = config
106
+ else
107
+ ActiveRecord::Base.configurations[key] = config
108
+ @replicas_configurations[key] = config
109
+ end
103
110
  rescue URI::InvalidURIError
104
111
  Rails.logger.info "LOG NOTIFIER: Invalid URL specified in follower_env_keys. Not including URI, which may result in no followers used." # URI is purposely not printed to logs
105
112
  # Return a 'nil' which will be removed from
@@ -1,3 +1,3 @@
1
1
  module Knockoff
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knockoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Ringwelski
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-04 00:00:00.000000000 Z
11
+ date: 2021-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -140,8 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubyforge_project:
144
- rubygems_version: 2.6.13
143
+ rubygems_version: 3.1.2
145
144
  signing_key:
146
145
  specification_version: 4
147
146
  summary: A gem for easily using read replicas