rom-sql 3.6.3 → 3.6.4

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
2
  SHA256:
3
- metadata.gz: 10de6edf52d1ae5d345bc22f2c884ab9f35d39f52ed1b31afc227c39c97e2922
4
- data.tar.gz: 865b5d0f4aabdd7fc5911ec269e43977257212517d9373574861c47fa79e1af8
3
+ metadata.gz: a3a5d8acca77c2d148be8cdfc268eee1851619947eed8923d6b174a05c199a32
4
+ data.tar.gz: 3c3780102c9055ceada519a2638761b90b43ad3f1b8d6f71063c2aee6817f2f4
5
5
  SHA512:
6
- metadata.gz: 1630dea45a0f30921a6298ea279d817e48d0bff6953639164304d4c308eb48a442b3ffe68dde0259e28ec0412a8b4ecea0c36bfc1c739d7ccbdaaa7dc49b2ac5
7
- data.tar.gz: df51ba2b2674e601f7f44fb492e65bf753ed1cc258599eedd2a2f0fc8100f7dd694899cc461492e93f3c5d98cad2dfe4901e7754965f177e147c636b3d7d14d1
6
+ metadata.gz: 452127dc2b154c8e513efc34e698c8fe4de0be2de9e21746b584fa14cb3642d3a2ce3ba0d085db54fa6153a1b796a5fd422fce6e24095cd8588028ed7924670d
7
+ data.tar.gz: d8fec6ff6f5ad4ce1d37eca0a51a4ed0f412d8ef611ca29fbc41c285ff46ec419fd0e94cf17ebc63a4c7314791514de71400200826540d2aa5a366b21b7427ba
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
+ ## 3.6.4 2024-07-01
4
+
5
+
6
+ ### Fixed
7
+
8
+ - Excessive logging when same gateway is shared between multiple containers (@flash-gordon)
9
+ - Warning about using color option from active-support log subscriber (@flash-gordon + @bendangelo)
10
+
11
+
12
+ [Compare v3.6.3...v3.6.4](https://github.com/rom-rb/rom-sql/compare/v3.6.3...v3.6.4)
13
+
3
14
  ## 3.6.3 2024-05-06
4
15
 
5
16
 
@@ -35,6 +35,8 @@ module ROM
35
35
  db_notifications = relations.values.map { |r| [r.dataset.db, r.notifications] }.uniq.to_h
36
36
 
37
37
  db_notifications.each do |db, notifications|
38
+ next if db.respond_to?(:rom_instrumentation?)
39
+
38
40
  instrumenter = Instrumenter.new(db.database_type, notifications)
39
41
  db.extend(instrumenter)
40
42
  end
@@ -56,6 +58,8 @@ module ROM
56
58
 
57
59
  # @api private
58
60
  def initialize(name, notifications)
61
+ super()
62
+
59
63
  @name = name
60
64
  @notifications = notifications
61
65
  define_log_connection_yield
@@ -68,6 +72,8 @@ module ROM
68
72
  name = self.name
69
73
  notifications = self.notifications
70
74
 
75
+ define_method(:rom_instrumentation?) { true }
76
+
71
77
  define_method(:log_connection_yield) do |*args, &block|
72
78
  notifications.instrument(:sql, name: name, query: args[0]) do
73
79
  super(*args, &block)
@@ -5,6 +5,21 @@ require 'active_support/log_subscriber'
5
5
  module ROM
6
6
  module SQL
7
7
  class RailsLogSubscriber < ActiveSupport::LogSubscriber
8
+ as_version =
9
+ begin
10
+ require "active_support/gem_version"
11
+ ActiveSupport.gem_version
12
+ rescue LoadError
13
+ nil
14
+ end
15
+
16
+ COLOR_OPTION =
17
+ if as_version && as_version >= Gem::Version.new("7.2")
18
+ {color: true}
19
+ else
20
+ true
21
+ end
22
+
8
23
  def sql(event)
9
24
  return unless logger.debug?
10
25
 
@@ -15,10 +30,10 @@ module ROM
15
30
  binds = payload[:binds].to_a.inspect if payload[:binds]
16
31
 
17
32
  if odd?
18
- name = color(name, :cyan, true)
19
- sql = color(sql, nil, true)
33
+ name = color(name, :cyan, COLOR_OPTION)
34
+ sql = color(sql, nil, COLOR_OPTION)
20
35
  else
21
- name = color(name, :magenta, true)
36
+ name = color(name, :magenta, COLOR_OPTION)
22
37
  end
23
38
 
24
39
  debug " #{name} #{sql} #{binds}"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ROM
4
4
  module SQL
5
- VERSION = '3.6.3'
5
+ VERSION = "3.6.4"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.3
4
+ version: 3.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-06 00:00:00.000000000 Z
11
+ date: 2024-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel