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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/multidb/log_subscriber.rb +1 -1
- data/lib/multidb/model_extensions.rb +1 -5
- data/lib/multidb/version.rb +1 -1
- data/spec/lib/multidb/log_subscriber_extension_spec.rb +8 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59634325586b5a51f26e35498fdde6414d0df71675743dfa0a4bf34036cc3f6a
|
4
|
+
data.tar.gz: 25c0d17f1b743ef1a5e37c88f588067403cd84036cb0de34bcff4f2aff266b46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
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
|
data/lib/multidb/version.rb
CHANGED
@@ -17,8 +17,12 @@ RSpec.describe Multidb::LogSubscriberExtension do
|
|
17
17
|
msg
|
18
18
|
end
|
19
19
|
|
20
|
-
def color(text,
|
21
|
-
|
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
|
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
|
78
|
+
is_expected.to start_with "Bold: Color \e[32m: [DB: replica1"
|
75
79
|
}
|
76
80
|
end
|
77
81
|
end
|