tobox 0.4.2 → 0.4.3

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: 3ba35990403e5d0244fdc62c373e3ddf2bb422a1b03f5b03f42a7a4a2bc31a9a
4
- data.tar.gz: b30c8cd7115639eeefc62b47ebb045a813a33a0bd8b353056b681438511a8d8c
3
+ metadata.gz: 2d3cc3ceebc694bccdf8ac4eb2ac340711d021ddc829b2068258cdf6554dfe1d
4
+ data.tar.gz: f6ae93dcecb775bbfe13a76f979db5bc683a4d73fa9bde8a12795b69c70f157a
5
5
  SHA512:
6
- metadata.gz: c419c3e8aab4b681425ee284e29ea1196212199aae47fad191ed7c7d0a97d07eda3a29b3bb52197896360c801e868a19ec8ce2b69db187a03f3c6097f5a78c70
7
- data.tar.gz: b0d156f909e75e95e81d675140729e13e381343d838d730cc319fcf527b0d791d2d607bb92f587fe9cc948f51e987521920f5a8ad76a50174499affadb50488c
6
+ metadata.gz: 30221317cc684efda2b45d8b00e42f23906e4aa4f0eac31dd114005df200a69d6a23bea4761852c73d68c1dd2e275ab894cb8360852d2e6165c4c95318b5a733
7
+ data.tar.gz: 3f4b11296b7d023fe0befc1da20e4bc2d5b4b001fd97373eb9824c43afc94ffa9c5dcc60185f8fc567ef0ebc7e2633a3fad9e5b26c12d2db7479d84be605310f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.3] - 2023-06-01
4
+
5
+ ### Bugfixes
6
+
7
+ The `sentry` plugin didn't load correctly: given that app code loads before the `tobox` config, it means that, if app code runs `Sentry.init`, then the `tobox` config won't be able to fiddle anymore with it. This fixes it by making the Sentry.init call a part of the `sentry` plugin.
8
+
9
+ This means that `tobox` config now includes a new callback:
10
+
11
+ ```ruby
12
+ plugin(:sentry)
13
+ on_sentry_init do |sentry_cfg|
14
+ sentry_cfg.dsn = ...
15
+ ```
16
+
17
+ ### Improvements
18
+
3
19
  ## [0.4.2] - 2023-05-25
4
20
 
5
21
  ### Improvements
data/README.md CHANGED
@@ -478,6 +478,10 @@ Plugin for the [sentry](https://github.com/getsentry/sentry-ruby) ruby SDK for e
478
478
  ```ruby
479
479
  # tobox.rb
480
480
  plugin(:sentry)
481
+
482
+ on_sentry_init do |sentry_cfg|
483
+ sentry.dsn = ENV["SENTRY_DSN"]
484
+ end
481
485
  ```
482
486
 
483
487
  <a id="markdown-datadog" name="datadog"></a>
@@ -3,6 +3,13 @@
3
3
  module Tobox
4
4
  module Plugins
5
5
  module Sentry
6
+ module ConfigurationMethods
7
+ def on_sentry_init(&callback)
8
+ (@lifecycle_events[:sentry_init] ||= []) << callback
9
+ self
10
+ end
11
+ end
12
+
6
13
  class Configuration
7
14
  # Set this option to true if you want Sentry to only capture the last job
8
15
  # retry if it fails.
@@ -124,6 +131,8 @@ module Tobox
124
131
  def load_dependencies(*)
125
132
  require "uri"
126
133
  require "sentry-ruby"
134
+ require "sentry/integrable"
135
+ extend ::Sentry::Integrable
127
136
  end
128
137
 
129
138
  def configure(config)
@@ -140,6 +149,16 @@ module Tobox
140
149
  ::Sentry::Configuration.add_post_initialization_callback do
141
150
  @tobox = Plugins::Sentry::Configuration.new
142
151
  end
152
+
153
+ register_integration name: "tobox", version: Tobox::VERSION
154
+
155
+ config.on_start do
156
+ ::Sentry.init do |sentry_cfg|
157
+ Array(config.lifecycle_events[:sentry_init]).each do |cb|
158
+ cb[sentry_cfg]
159
+ end
160
+ end
161
+ end
143
162
  end
144
163
  end
145
164
  end
data/lib/tobox/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tobox
4
- VERSION = "0.4.2"
4
+ VERSION = "0.4.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tobox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - HoneyryderChuck
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-25 00:00:00.000000000 Z
11
+ date: 2023-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel