barsoom_utils 0.2.0.52 → 0.2.0.54

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: 8e5650ed2fa6376369224481daf22422e6b3d31e43c8ef329b9c124963e20d7e
4
- data.tar.gz: 223889cb8fb7fed5bba9e2e789393caf7c3366d2482d91099fab9947309909d6
3
+ metadata.gz: a097b2b63b7e62fc4f21ecbe6fca1565277672b563286f445a751a1a2f451d8f
4
+ data.tar.gz: d55439c14627bfc3ba240ab2ee9f9902a040438bd57fb5e06acc8c8c3cbbdf86
5
5
  SHA512:
6
- metadata.gz: 3ec9e6f8b0f1a349efa4898f325bd4d0f03ca1938e4cc5ae6127f0a07b3151333c791606dbea4e1a799b90428532f0e5aa036bf922bc5ff9fee950f576b00aa8
7
- data.tar.gz: 888daf15072cb2e9573b2cd08cf159ddd0de7abfa6388a5b0a21e311e51f2a1a47f1f96f7700081b428f6d7bc9cc17b8ab75c8910fcf0c363f4f8bd98b01b40f
6
+ metadata.gz: 3d4a4f86061090752e96ae345e010ed06fec43017fbfe20601a8e532c47b69215e2ae4f2bfc839a5df88a2d57b6b86a7f6b013f712344bbc8710bc0a7110a7d4
7
+ data.tar.gz: dc722e5f23f2a93a9817323bcbcd5482947d0e3964dbadeb73b8509f7417f23ce77c0ff5afaad1832924b0804e2c26226954064f790ae8ecaab7fb3eb24ba68d
data/README.md CHANGED
@@ -27,7 +27,6 @@ List of utils:
27
27
  require "barsoom_utils/exception_notifier" # Notify devs about an exception without necessarily letting it appear to the user as a 500 error.
28
28
  require "barsoom_utils/spec/debug_helpers" # Add show_page helper for capybara feature specs
29
29
  require "barsoom_utils/feature_toggle" # Convenient way of hiding/showing a feature.
30
- require "barsoom_utils/ping_health_check" # Report running of background jobs to healthchecks.io. NOTE: You need to set the env ENABLE_HEALTH_CHECKS=true to enable reporting (only set it in production).
31
30
  ```
32
31
 
33
32
  We also have some shared configuration. To use our Rubocop configuration, add this to the beginning of your `.rubocop.yml`.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0.52
1
+ 0.2.0.54
data/shared_rubocop.yml CHANGED
@@ -260,6 +260,12 @@ Layout/IndentationWidth:
260
260
  Layout/IndentationConsistency:
261
261
  Enabled: true
262
262
 
263
+ # https://docs.rubocop.org/rubocop/cops_layout.html#layoutmultilineassignmentlayout
264
+ Layout/MultilineAssignmentLayout:
265
+ Enabled: true
266
+ SupportedTypes:
267
+ - if
268
+
263
269
  # https://docs.rubocop.org/rubocop/cops_layout.html#layoutclassstructure
264
270
  # https://github.com/barsoom/devbook/tree/master/styleguide#use-a-consistent-class-layout
265
271
  # AutoCorrect: false because it has a tendency to make private delegates public, and it messes up whitespace
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barsoom_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.52
4
+ version: 0.2.0.54
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Skogberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-01 00:00:00.000000000 Z
11
+ date: 2025-07-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -31,7 +31,6 @@ files:
31
31
  - lib/barsoom_utils.rb
32
32
  - lib/barsoom_utils/exception_notifier.rb
33
33
  - lib/barsoom_utils/feature_toggle.rb
34
- - lib/barsoom_utils/ping_health_check.rb
35
34
  - lib/barsoom_utils/spec/debug_helpers.rb
36
35
  - lib/barsoom_utils/version.rb
37
36
  - script/test
@@ -39,7 +38,6 @@ files:
39
38
  - shared_rubocop_rails.yml
40
39
  - spec/exception_notifier_spec.rb
41
40
  - spec/feature_toggle_spec.rb
42
- - spec/ping_health_check_spec.rb
43
41
  - spec/spec/debug_helpers_spec.rb
44
42
  - spec/spec_helper.rb
45
43
  homepage: https://dev.auctionet.com/
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
- require "httparty"
3
- require "attr_extras"
4
- require "barsoom_utils/exception_notifier"
5
-
6
- module BarsoomUtils
7
- class PingHealthCheck
8
- method_object :id
9
-
10
- def call
11
- return unless ENV["ENABLE_HEALTH_CHECKS"]
12
-
13
- response = ping_healthcheck
14
-
15
- if response.code != 200
16
- # "The presence of the cf-request-id header in the response confirms
17
- # the request was proxied through Cloudflare"
18
- # https://support.cloudflare.com/hc/en-us/articles/203118044-Gathering-information-for-troubleshooting-sites
19
- raise "Bad response, cf-request-id header: #{response.headers["cf-request-id"]}, response body: #{response.inspect}"
20
- else
21
- response
22
- end
23
- rescue => ex
24
- BarsoomUtils::ExceptionNotifier.message("Couldn't report to healthchecks.io, maybe the service is down?", "Check: #{id}, Error: #{ex.inspect}")
25
- end
26
-
27
- private
28
-
29
- def ping_healthcheck
30
- HTTParty.get("https://hc-ping.com/#{id}")
31
- end
32
- end
33
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
- require "barsoom_utils/ping_health_check"
3
-
4
- RSpec.describe BarsoomUtils::PingHealthCheck, ".call" do
5
- around do |example|
6
- ENV["ENABLE_HEALTH_CHECKS"] = "true"
7
- example.run
8
- ENV["ENABLE_HEALTH_CHECKS"] = nil
9
- end
10
-
11
- it "does nothing on a 200 OK response" do
12
- expect(HTTParty).to receive(:get).with("https://hc-ping.com/foo").and_return(double(:response, code: 200, headers: {}))
13
-
14
- BarsoomUtils::PingHealthCheck.call("foo")
15
- end
16
-
17
- it "includes CloudFlare request ID header information in failure message" do
18
- expect(HTTParty).to receive(:get).with("https://hc-ping.com/foo").and_return(double(:response, code: 503, headers: { "cf-request-id" => "023aa754ae0000517ab8829200000001" }))
19
- expect(BarsoomUtils::ExceptionNotifier).to receive(:message).with(anything, /cf-request-id header: 023aa754ae0000517ab8829200000001/)
20
-
21
- BarsoomUtils::PingHealthCheck.call("foo")
22
- end
23
-
24
- it "silently reports an error to devs if it fails with a bad response code" do
25
- expect(HTTParty).to receive(:get).with("https://hc-ping.com/foo").and_return(double(:response, code: 404, headers: {}))
26
- expect(BarsoomUtils::ExceptionNotifier).to receive(:message).with(anything, /foo/)
27
-
28
- BarsoomUtils::PingHealthCheck.call("foo")
29
- end
30
-
31
- it "silently reports an error to devs if it fails with an exception" do
32
- expect(HTTParty).to receive(:get).with("https://hc-ping.com/foo").and_raise("fail")
33
- expect(BarsoomUtils::ExceptionNotifier).to receive(:message).with(anything, /foo/)
34
-
35
- BarsoomUtils::PingHealthCheck.call("foo")
36
- end
37
- end