infield 0.2.0 → 0.3.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: 26abdd8a8407a04b1627a2e4df94c3e2ecca434334dfadd6b776b876f8fe1fac
4
- data.tar.gz: 868a9bb4fcedec09f7296a6f1ab2e34c409d151c9d33ff4542ef498064c5b1d7
3
+ metadata.gz: 325524018c44e26d8fe8513f38604197def031b5582285f63c7c928b8c8d4b84
4
+ data.tar.gz: 3b04d9d84e329c69c0c5b3bb822253943f9d0ba12a5ce3d78721b25e12657d87
5
5
  SHA512:
6
- metadata.gz: cf41bdccf63f87eaf3feb2e947a9e00ea51c33f37d0ef0e76260395035ecf9d488e21f3fa7966cced8eda3aec453cab664299df6a55a69ac6130571be744ab3f
7
- data.tar.gz: 91a721071942764b19342fd80e53281b24f03a3fa77cd01580d98aa75eff7da18b5a4b6d0844ad885b5e506133c6f3493ead8a49a1dd47700b7cdb7db4d1b47a
6
+ metadata.gz: f9179b0602fe9f755169b59af4a0e1ff10a62de52ac0c1cafaa96ac4653badd9a771b3cd3be5c73c35c12ddaf121a066c702c68b390d2ca123b687b8195bfee7
7
+ data.tar.gz: 0624c57b8417151e01dfdb1de57a10ab2b69656e565443f31ad848c584fcd4bb2a894dea8b3a661c38000ecf38ef9878c0922d95f13e2c663b2d840b336106c7
data/README.md CHANGED
@@ -4,7 +4,7 @@ This gem handles reporting deprecation warnings to Infield from a Rails app.
4
4
 
5
5
  ## Setup
6
6
 
7
- You'll need an API key and repo environment ID to use this gem. Get your API key from https://app.infield.ai/settings/api_key and your environment ID from the environments configuration page.
7
+ You'll need an API key and repo environment ID to use this gem. You can find these at https://app.infield.ai/deprecations after signing up.
8
8
 
9
9
  Add the gem to your gemfile:
10
10
 
@@ -15,7 +15,7 @@ Then in `config/application.rb`:
15
15
  if ENV['INFIELD_API_KEY']
16
16
  require 'infield'
17
17
  Infield.run(api_key: ENV['INFIELD_API_KEY'],
18
- repo_environment_id: ENV['INFIELD_REPO_ENVIRONMENT_ID')
18
+ repo_environment_id: ENV['INFIELD_REPO_ENVIRONMENT_ID'])
19
19
  end
20
20
 
21
21
  And in any environment you want to profile from:
@@ -10,5 +10,24 @@ module Infield
10
10
  end
11
11
  end
12
12
 
13
- Kernel.prepend(Core)
13
+ module InfieldWarningCapture
14
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0")
15
+ # Ruby 3.0+ supports warn(msg, category: nil, **kwargs)
16
+ def warn(msg, category: nil, **kwargs)
17
+ super
18
+
19
+ Infield::DeprecationWarning.log(msg, callstack: caller_locations, validated: true) if category == :deprecated
20
+ end
21
+ else
22
+ # Ruby < 3.0 only provides a single argument to warn
23
+ def warn(msg)
24
+ super
25
+
26
+ Infield::DeprecationWarning.log(msg, callstack: caller_locations, validated: false)
27
+ end
28
+ end
29
+ end
30
+
31
+ Kernel.extend(Core)
32
+ Warning.extend(InfieldWarningCapture)
14
33
  end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'debug'
3
2
 
4
3
  module Infield
5
4
  module Heartbeat
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Infield
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
data/lib/infield.rb CHANGED
@@ -6,7 +6,7 @@ require 'net/http'
6
6
 
7
7
  require_relative 'infield/version'
8
8
 
9
- # require_relative 'infield/core_ext'
9
+ require_relative 'infield/core_ext'
10
10
  require_relative 'infield/rails' if defined?(Rails)
11
11
 
12
12
  module Infield
@@ -25,7 +25,7 @@ module Infield
25
25
  raise 'API key is required' unless @api_key
26
26
  raise 'repo_environment_id is required' unless @repo_environment_id
27
27
 
28
- @environment = environment || defined?(Rails) ? Rails.env : nil
28
+ @environment = environment || (defined?(Rails) ? Rails.env : nil)
29
29
 
30
30
  # Start the deprecation warning processor
31
31
  DeprecationWarning::Runner.run(sleep_interval: sleep_interval, batch_size: batch_size, queue_limit: queue_limit)
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.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infield
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-13 00:00:00.000000000 Z
11
+ date: 2025-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: webmock