infield 0.4.0 → 0.5.0

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: bcc989dc4411ecacc35b71a9f831b51c7a985e550872393e68cbed78530b33cd
4
- data.tar.gz: 9e681a218059596455a77728f371e30a016810eb3aaf608a6c0af8aa3236a9b2
3
+ metadata.gz: 706e3b8eb5b4a5eb812a3212a8c681021d35e0f3c5793a4ea41bbe0cf142cf9f
4
+ data.tar.gz: 142dc03b525827beb632755d9700f9f8d47542d094b1e5ae07d1b7858b8f3a36
5
5
  SHA512:
6
- metadata.gz: c361f23afc866c66338b633a7aefcf0714a0e4ec2ef5f8cccf568105751379207840eca47224ab1bf2339c16fa53e7038536ff97fba6822db9a5ed35622b57b5
7
- data.tar.gz: 8010fcb20eb0c8f1168c1405f6f37f6e1cf8f6aaad08053cbffa493b0e43f8989f0aef0de1082f5377f9cbec823308f8672fc3cf291a37dcb155e79033b740e5
6
+ metadata.gz: 7fa4027787cfbccc543b2bf8b662b59e522908926776a14ee4d5cb11e86acb41d643c87d37dabb353c9166c636418f7b1b469325825b72bb2f3f244979347ba0
7
+ data.tar.gz: ae9611ddc2352b8af6451b1842dec24d0e1487d1744c0b24d5aa29305aa59dd606fe146c33ad6ed29994d224e7de5f75a7317054150511aa2e55cc69df86d640
data/README.md CHANGED
@@ -18,6 +18,9 @@ Then in `config/application.rb`:
18
18
  repo_environment_id: ENV['INFIELD_REPO_ENVIRONMENT_ID'])
19
19
  end
20
20
 
21
+ Only call `Infield.run` in environments that you want deprecation warnings to print for, since it will bypass configurations such as `config.active_support.report_deprecations = false`
22
+ and `config.active_support.deprecation = :silence`
23
+
21
24
  ## Configuration options
22
25
 
23
26
  The infield gem batches requests and sends them asyncronously. You can configure the following options to `Infield.run` (defaults shown here):
data/lib/infield/rails.rb CHANGED
@@ -2,20 +2,27 @@
2
2
 
3
3
  module Infield
4
4
  class Railtie < Rails::Railtie
5
- initializer 'infield.deprecation_warnings', after: 'active_support.deprecation_behavior' do |_app|
6
- infield_lambda = lambda do |message, callstack, *args|
5
+ initializer 'infield.enable_report_deprecations', before: 'active_support.deprecation_behavior' do |app|
6
+ app.config.active_support.report_deprecations = true
7
+ if defined?(ActiveSupport::Deprecation.silenced)
8
+ ActiveSupport::Deprecation.silenced = false
9
+ end
10
+ end
11
+
12
+ initializer 'infield.deprecation_warnings', after: 'active_support.deprecation_behavior' do |app|
13
+ infield_logger = lambda do |message, callstack, *_args|
7
14
  Infield::DeprecationWarning.log(message, callstack: callstack, validated: true)
8
15
  end
9
16
 
10
- # Rails >= 7.0 makes it so that there are named deprecators that can have their own behavior
11
- if Rails.application.respond_to?(:deprecators)
12
- Rails.application.deprecators.each do |deprecator|
13
- current = Array(deprecator.behavior)
14
- deprecator.behavior = [infield_lambda, *current].uniq
17
+ # Rails >= 7.1 makes it so that there are named deprecators that can have their own behavior
18
+ if app.respond_to?(:deprecators)
19
+ app.deprecators.each do |deprecator|
20
+ current_behaviors = Array(deprecator.behavior)
21
+ deprecator.behavior = [infield_logger, *current_behaviors].uniq
15
22
  end
16
23
  else
17
24
  current_behaviors = Array(ActiveSupport::Deprecation.behavior)
18
- ActiveSupport::Deprecation.behavior = [infield_lambda, *current_behaviors].uniq
25
+ ActiveSupport::Deprecation.behavior = [infield_logger, *current_behaviors].uniq
19
26
  end
20
27
  end
21
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Infield
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infield
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infield
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-14 00:00:00.000000000 Z
11
+ date: 2025-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: webmock