infield 0.7.0 → 0.8.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: 72a71c565210ec537d117093bd33a58918cc485cdcf7c3111b45033a066b8652
4
- data.tar.gz: a5db478b896da5d88a8232f2538254e2ad9645083be7124ddedf22f7eec661c3
3
+ metadata.gz: 1241f08f96db62746028c06238171f5f35746ddf1a3cf1cfb6d05bce76b5f35e
4
+ data.tar.gz: 944956884697ae42c1287e49a57533be4fbcb8b0bdbc8de2c36bb0d76fb5d297
5
5
  SHA512:
6
- metadata.gz: d6a761e2ffa3c37ceefd64a85994344c0ff6f7edb9f49639df042f5c015b1db47c834d2459950e3747f90631728ad0742dabc54fa009ceed20744dffbb04d18d
7
- data.tar.gz: 3ddfcf9a6fb943c6be184daed62b0a545287d94d36d6c8683e5da6af036023de11c55a50fca4b3cc4c462f0795abc5b4a078ef5c166ef76c450760060948ccea
6
+ metadata.gz: '00847fe3105a43e0b81938b311dd4940118fa7317489ff49b5be694760c22286f9e86b81252c98859a95f781d23bfb57ab3b9ef5ef971a786c24ca8a716c8da1'
7
+ data.tar.gz: c5d79c364ed252a53d07f1a6396916b5510459786b66b17a55601885c99138d904bef355606b11060fd3b7136a76b22280043177796bad8afa9a576da71f5f8c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.8.0] - 2025-07-17
4
+
5
+ - Send git info alongside deprecation warnings.
6
+
3
7
  ## [0.7.0] - 2025-04-16
4
8
 
5
9
  - Send Rails.root alongside deprecation warnings so they can be hidden from callstacks
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
- # Infield
1
+ # What is this gem for?
2
2
 
3
- This gem handles reporting deprecation warnings to Infield from a Rails app.
3
+ Maintainers use deprecation warnings to inform developers about breaking changes coming in new versions. To make these warnings actionable you need to monitor for them. This gem takes care of aggregating these warnings from any environment and sending them to the Infield API. Within Infield you can see all deprecations being thrown and verify once they've been fixed.
4
+
5
+ This differs from local-only tools like deprecation_toolkit in that warnings are sent up to a cloud-hosted API rather than stored in files locally. This makes it possible to profile for deprecations not just in dev/test but staging and production too.
6
+
7
+ `infield` supports warnings coming from gems and Ruby itself.
4
8
 
5
9
  ## Setup
6
10
 
@@ -49,6 +49,8 @@ module Infield
49
49
 
50
50
  uri = infield_api_uri
51
51
 
52
+ git_branch, git_sha = git_info
53
+
52
54
  webmock_needs_re_enabling = false
53
55
  if defined?(WebMock) && WebMock.respond_to?(:net_connect_allowed?) &&
54
56
  !WebMock.net_connect_allowed?(Infield.infield_api_url)
@@ -67,6 +69,8 @@ module Infield
67
69
  repo_environment_id: Infield.repo_environment_id,
68
70
  environment: Infield.environment,
69
71
  root_dir: rails_root,
72
+ git_sha: git_sha,
73
+ git_branch: git_branch,
70
74
  messages: messages
71
75
  }
72
76
  }.to_json,
@@ -94,6 +98,35 @@ module Infield
94
98
  environment: Infield.environment }
95
99
  end
96
100
 
101
+ def git_info
102
+ branch = nil
103
+ sha = nil
104
+
105
+ if ENV['CIRCLE_SHA1']
106
+ sha = ENV['CIRCLE_SHA1']
107
+ branch = ENV['CIRCLE_BRANCH']
108
+ elsif ENV['GITHUB_SHA']
109
+ sha = ENV['GITHUB_SHA']
110
+ if ENV['GITHUB_REF_NAME']
111
+ branch = ENV['GITHUB_REF_NAME']
112
+ elsif ENV['GITHUB_REF']&.start_with?('refs/heads/')
113
+ branch = ENV['GITHUB_REF'].split('/', 3).last
114
+ elsif ENV['GITHUB_HEAD_REF']
115
+ branch = ENV['GITHUB_HEAD_REF']
116
+ end
117
+ elsif ENV['HEROKU_SLUG_COMMIT']
118
+ sha = ENV['HEROKU_SLUG_COMMIT']
119
+ elsif defined?(Rails) && Rails.respond_to?(:root)
120
+ root = Rails.root.to_s
121
+ if system('git', '-C', root, 'rev-parse', '--is-inside-work-tree', out: File::NULL, err: File::NULL)
122
+ sha = `git -C #{root} rev-parse HEAD`.strip
123
+ branch = `git -C #{root} rev-parse --abbrev-ref HEAD`.strip
124
+ end
125
+ end
126
+
127
+ [branch, sha]
128
+ end
129
+
97
130
  def infield_api_uri
98
131
  URI.parse(Infield.infield_api_url)
99
132
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Infield
4
- VERSION = '0.7.0'
4
+ VERSION = '0.8.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.7.0
4
+ version: 0.8.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-04-16 00:00:00.000000000 Z
11
+ date: 2025-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: webmock