ar-multidb 0.8.0 → 0.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f198d581e4d1d0641b91ec64b79472987f90c8c69f717adc568caffbcaad148f
4
- data.tar.gz: 33f6126cef8968a360f84fda234548687507f988beade03da58f092b8166cb13
3
+ metadata.gz: 59634325586b5a51f26e35498fdde6414d0df71675743dfa0a4bf34036cc3f6a
4
+ data.tar.gz: 25c0d17f1b743ef1a5e37c88f588067403cd84036cb0de34bcff4f2aff266b46
5
5
  SHA512:
6
- metadata.gz: ba852c8001cb41bd738f2fae94268b5c37c9ebf5e549dcf326243dbfbff4c7c00a76641c2500dcfb96b37469543fc370a362cecec9c04134c031c0e40cc0fc90
7
- data.tar.gz: 041f8e4d3fdb4559b764c4189a81801d60c96ad71f71a431970a62a06cd6e603b96bf20b223ff7032180a149329ffad76ed4da70090658d241909332255f13e2
6
+ metadata.gz: ceedd0edbddea598ee5ca45cfca028bb74b40a91bc17ab69e54d78944491f380574c52772dc9e836a575627a0a765a84d4361cd68b9cd609845f9d4a9633dd00
7
+ data.tar.gz: 95d7bfd12ba7fd33bfa7a4428614510f7c5ccafb4ea05ab9d4afcdf01ff2ef6396e93067f22c8657ac83e74bc41947b5dd6b7ded2db3877f5034598c3831d9c8
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
6
6
 
7
+ ## [0.8.1]
8
+ ### Changes
9
+ - Updated Log subscriber mixin to utilize Rails 7.1's contract for "color"
10
+ - Removed old backward compat path for Rails < 6.1
11
+
7
12
  ## [0.8.0]
8
13
  ### Changed
9
14
  - dropped support for Ruby < 3.0
@@ -11,7 +11,7 @@ module Multidb
11
11
  def debug(msg = nil)
12
12
  name = Multidb.balancer.current_connection_name
13
13
  if name
14
- db = color("[DB: #{name}]", ActiveSupport::LogSubscriber::GREEN, true)
14
+ db = color("[DB: #{name}]", ActiveSupport::LogSubscriber::GREEN, bold: true)
15
15
  super(db + msg.to_s)
16
16
  else
17
17
  super
@@ -6,11 +6,7 @@ module Multidb
6
6
  module Connection
7
7
  def establish_connection(spec = nil)
8
8
  super(spec)
9
- config = if connection_pool.respond_to?(:db_config)
10
- connection_pool.db_config.configuration_hash
11
- else
12
- connection_pool.spec.config
13
- end
9
+ config = connection_pool.db_config.configuration_hash
14
10
 
15
11
  Multidb.init(config)
16
12
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Multidb
4
- VERSION = '0.8.0'
4
+ VERSION = '0.8.1'
5
5
  end
@@ -17,8 +17,12 @@ RSpec.describe Multidb::LogSubscriberExtension do
17
17
  msg
18
18
  end
19
19
 
20
- def color(text, _color, _bold)
21
- text
20
+ def color(text, color, options = {})
21
+ if options[:bold]
22
+ "Bold: Color #{color}: #{text}"
23
+ else
24
+ "Color #{color}: #{text}"
25
+ end
22
26
  end
23
27
  end
24
28
 
@@ -65,13 +69,13 @@ RSpec.describe Multidb::LogSubscriberExtension do
65
69
  subject { instance.debug('message') }
66
70
 
67
71
  it 'prepends the db name to the message' do
68
- is_expected.to include('[DB: default]')
72
+ is_expected.to start_with "Bold: Color \e[32m: [DB: default]"
69
73
  end
70
74
 
71
75
  context 'when a replica is active' do
72
76
  it 'prepends the replica dbname to the message' do
73
77
  Multidb.use(:replica1) {
74
- is_expected.to include('[DB: replica1')
78
+ is_expected.to start_with "Bold: Color \e[32m: [DB: replica1"
75
79
  }
76
80
  end
77
81
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar-multidb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Staubo