getaround_utils 0.3.4 → 0.3.5

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: 1a0b5e64b0be84ffcfe22850f5b73c5e6d08d7eb6d843e7792d35268626377c7
4
- data.tar.gz: 9dcefce00a8ad7bbb89ed28e6e4264c3ba80139ef9c2d2e0ade8f9fe0fe739c7
3
+ metadata.gz: 197707c0b85b1de9d759389ce44867114b3a1e1bf231e72c23b40356040df563
4
+ data.tar.gz: 36109e28f921a5e8c97fd3f1512b0e2838f6416c2a7b1cd845d3e8784db14cd1
5
5
  SHA512:
6
- metadata.gz: dff6641aa462aaf39e532b023723e25f1d8af1bc9fcaa1b24a5ea7b896910788c5f7c66121940281474d760dbf7e9d08f7a7fd2234e777cf08964c433283b83a
7
- data.tar.gz: 63b26fa1260b94a4884d49bd42ce0aeb13fd3c1c0b3b03fa31863d214e2ff323530de7315dd7843ba5dbb54b3bf8d2957efa90d51644c4a3c147aca1178e3860
6
+ metadata.gz: 451a09d17a3aa284e26c1b2700891a4a8df4e5d3a5f7819e7e425c7f6e4c0988471b1cb05df8fd4f1399e45f441e83674a3e3421d9e2b0239e9dace98981ca32
7
+ data.tar.gz: 8e0f3e45775ea0fd26f5d22603870f5f86f71963f0cbacbb88cf5fd46722a6202392825188cff9731a4202c8b85b52c849f23d7a61ce46aacaa0a9a0c349af1d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## [0.3.5] 2026-07-07
2
+
3
+ ### Fixed
4
+
5
+ - `GetaroundUtils::Utils::HandleError`: notify Bugsnag only when `BUGSNAG_API_KEY` is configured, otherwise log.
6
+
7
+ ### Added
8
+
9
+ - `GetaroundUtils::Utils::HealthCheckFile` ([#481](https://github.com/drivy/backend-configs/pull/481))
10
+ ```ruby
11
+ SIDEKIQ_HEALTH_FILE = GetaroundUtils::Utils::HealthCheckFile.new('sidekiq')
12
+ Sidekiq.configure_server do |config|
13
+ config.on(:startup) { SIDEKIQ_HEALTH_FILE.create }
14
+ config.on(:shutdown) { SIDEKIQ_HEALTH_FILE.delete }
15
+ end
16
+ ```
17
+
1
18
  ## [0.3.4] 2026-02-27
2
19
 
3
20
  ### Breaking Changes
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- getaround_utils (0.3.4)
4
+ getaround_utils (0.3.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -199,3 +199,19 @@ end
199
199
  ```
200
200
 
201
201
  For more details, [read the spec](spec/getaround_utils/utils/handle_error_spec.rb)
202
+
203
+ ### GetaroundUtils::Utils::HealthCheckFile
204
+
205
+ Helper to easily create health check file used for Kubernetes Probes (Sidekiq, Captur, etc...)
206
+
207
+ *Example in `config/initializers/sidekiq.rb`*
208
+ ```ruby
209
+ SIDEKIQ_HEALTH_FILE = GetaroundUtils::Utils::HealthCheckFile.new('sidekiq')
210
+
211
+ Sidekiq.configure_server do |config|
212
+ config.on(:startup) { SIDEKIQ_HEALTH_FILE.create }
213
+ config.on(:shutdown) { SIDEKIQ_HEALTH_FILE.delete }
214
+ end
215
+ ```
216
+
217
+ For more details, [read the spec](spec/getaround_utils/utils/health_check_file_spec.rb)
@@ -11,7 +11,7 @@ module GetaroundUtils::Utils::HandleError
11
11
 
12
12
  # @see https://docs.bugsnag.com/platforms/ruby/rails/reporting-handled-errors/#sending-custom-diagnostics
13
13
  def self.notify_of(error, **metadata, &)
14
- if defined?(::Bugsnag)
14
+ if defined?(::Bugsnag) && ::Bugsnag.configuration.api_key
15
15
  ::Bugsnag.notify(error) do |event|
16
16
  metadata.each do |name, value|
17
17
  if value.is_a?(Hash)
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'pathname'
5
+
6
+ module GetaroundUtils; end
7
+
8
+ module GetaroundUtils::Utils; end
9
+
10
+ class GetaroundUtils::Utils::HealthCheckFile
11
+ FILE_NAME = 'health_check_file'
12
+
13
+ attr_reader :path
14
+
15
+ def initialize(name)
16
+ raise ArgumentError, "Expected name as String, got: #{name.inspect}" if !name.is_a?(String) || name.empty?
17
+
18
+ @base_path = root_path.join('tmp', name)
19
+ @path = @base_path.join(FILE_NAME)
20
+ end
21
+
22
+ def create
23
+ FileUtils.mkdir_p(@base_path)
24
+ FileUtils.touch(@path)
25
+ end
26
+
27
+ def delete
28
+ FileUtils.rm_f(@path)
29
+ end
30
+
31
+ def exists?
32
+ File.exist?(@path)
33
+ end
34
+
35
+ private
36
+
37
+ def root_path
38
+ defined?(::Rails) ? Rails.root : Pathname.new('/')
39
+ end
40
+ end
@@ -3,3 +3,4 @@
3
3
  require 'getaround_utils/utils/config_url'
4
4
  require 'getaround_utils/utils/deep_key_value'
5
5
  require 'getaround_utils/utils/handle_error'
6
+ require 'getaround_utils/utils/health_check_file'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GetaroundUtils
4
- VERSION = '0.3.4'
4
+ VERSION = '0.3.5'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getaround_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drivy
@@ -222,6 +222,7 @@ files:
222
222
  - lib/getaround_utils/utils/config_url.rb
223
223
  - lib/getaround_utils/utils/deep_key_value.rb
224
224
  - lib/getaround_utils/utils/handle_error.rb
225
+ - lib/getaround_utils/utils/health_check_file.rb
225
226
  - lib/getaround_utils/version.rb
226
227
  homepage: https://github.com/drivy
227
228
  licenses: