nxt_support 0.3.0 → 0.4.1

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: 4df3922def5f3b704ce0d3f42851714bd63299f5acc4f3972049ce4015af3ad6
4
- data.tar.gz: 7003d6c20622f4db12d7f039ff4a4bbaa8d114d11ad77a9b6e189db05bc01f1a
3
+ metadata.gz: ea9c53b87505a7b31250e050d6b4e4adb3c0504f520e5f552a484a1a450b551c
4
+ data.tar.gz: 97ae0e288c2ad44fc9ab163917f12d159a3ac3810c086ad7e65dcc4c5325e5c1
5
5
  SHA512:
6
- metadata.gz: 3a8dc4b1e22b351d2ceee9918e299c0f17ed284956125168da3d6e932e00cff1512c7b827411aba7f32a2b3ee3c1face8a1c960f523e6d7b5dd10cc0ba1c5d52
7
- data.tar.gz: 29edc7185ac167339ca1ac2a921cad40d620d1a0ee07a1037d92829a147e7d632469c4a9fec733586ca509b5e69a01e7bd83739df823e7a41fc2b5516d0b58be
6
+ metadata.gz: e16ed8f33f905dcd5825d2272900174eae43b96595d73f5abf8c153899d0438c88c22473eb158253f2f87d4d7934467a50e465686ad99927b33e5456c9aeb5d8
7
+ data.tar.gz: 8207471f7c5380671c1ff643cf32d438e30d79b8e5c674eaaa2df0688f63e224f3f4b2ba7229cc6473ec743deef0a88ca15d69374e33017f4071dcdb11a711ee
data/.circleci/config.yml CHANGED
@@ -10,7 +10,9 @@ workflows:
10
10
  - build:
11
11
  matrix:
12
12
  parameters:
13
- ruby-version: ["2.6.8", "2.7.4", "3.0.2"]
13
+ ruby-version: ["3.0.2", "3.1.2"]
14
+ orbs:
15
+ ruby: circleci/ruby@2.0.0
14
16
 
15
17
  jobs:
16
18
  build:
@@ -20,39 +22,13 @@ jobs:
20
22
 
21
23
  docker:
22
24
  # specify the version you desire here
23
- - image: circleci/ruby:<< parameters.ruby-version >>-node
25
+ - image: cimg/ruby:<< parameters.ruby-version >>
24
26
 
25
27
  working_directory: ~/repo
26
28
 
27
29
  steps:
28
30
  - checkout
29
-
30
- - run:
31
- name: Install apt dependencies
32
- command: |
33
- sudo apt update -q \
34
- && sudo apt upgrade -q \
35
- && sudo apt install -qy --no-install-recommends \
36
- sqlite3 libsqlite3-dev
37
-
38
- # Download and cache dependencies
39
- - restore_cache:
40
- keys:
41
- - v1-dependencies-{{ checksum "Gemfile.lock" }}
42
-
43
- - run: gem install bundler
44
-
45
- - run:
46
- name: install dependencies
47
- command: |
48
- bundle install --jobs=4 --retry=3 --path vendor/bundle
49
-
50
- - save_cache:
51
- paths:
52
- - ./vendor/bundle
53
- key: v1-dependencies-{{ checksum "Gemfile.lock" }}
54
-
55
- # run tests!
31
+ - ruby/install-deps
56
32
  - run:
57
33
  name: run tests
58
34
  command: |
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # v0.4.1 2022-11-18
2
+ - Rename header to `Sentry-Error-Id` for consistency
3
+
4
+ # v0.4.0 2022-11-14
5
+ - Add `SentryErrorID` middleware
6
+ - Drop support for Ruby 2.x
7
+
1
8
  # v0.3.0 2022-05-30
2
9
  - Support passing `with` to refinement
3
10
  - Call ambiguity handler with resolved collection rather than original collection, to avoid logging huge values
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nxt_support (0.3.0)
4
+ nxt_support (0.4.1)
5
5
  activerecord
6
6
  activesupport
7
7
  nxt_init
@@ -10,24 +10,23 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activemodel (6.1.4.1)
14
- activesupport (= 6.1.4.1)
15
- activerecord (6.1.4.1)
16
- activemodel (= 6.1.4.1)
17
- activesupport (= 6.1.4.1)
18
- activesupport (6.1.4.1)
13
+ activemodel (7.0.4)
14
+ activesupport (= 7.0.4)
15
+ activerecord (7.0.4)
16
+ activemodel (= 7.0.4)
17
+ activesupport (= 7.0.4)
18
+ activesupport (7.0.4)
19
19
  concurrent-ruby (~> 1.0, >= 1.0.2)
20
20
  i18n (>= 1.6, < 2)
21
21
  minitest (>= 5.1)
22
22
  tzinfo (~> 2.0)
23
- zeitwerk (~> 2.3)
24
23
  coderay (1.1.3)
25
- concurrent-ruby (1.1.9)
24
+ concurrent-ruby (1.1.10)
26
25
  diff-lcs (1.4.4)
27
- i18n (1.8.10)
26
+ i18n (1.12.0)
28
27
  concurrent-ruby (~> 1.0)
29
28
  method_source (1.0.0)
30
- minitest (5.14.4)
29
+ minitest (5.16.3)
31
30
  nxt_init (0.1.5)
32
31
  activesupport
33
32
  nxt_registry (0.3.10)
@@ -52,9 +51,8 @@ GEM
52
51
  rspec_junit_formatter (0.4.1)
53
52
  rspec-core (>= 2, < 4, != 2.12.0)
54
53
  sqlite3 (1.4.2)
55
- tzinfo (2.0.4)
54
+ tzinfo (2.0.5)
56
55
  concurrent-ruby (~> 1.0)
57
- zeitwerk (2.4.2)
58
56
 
59
57
  PLATFORMS
60
58
  ruby
data/README.md CHANGED
@@ -24,6 +24,20 @@ Or install it yourself as:
24
24
 
25
25
  Here's an overview all the supporting features.
26
26
 
27
+ ### NxtSupport::Middleware::SentryErrorID
28
+ A Rack middleware that adds a `Sentry-Error-ID` header to 5xx responses.
29
+ The header is only added if an error was reported during the request.
30
+ The error ID is gotten from [`sentry.error_event_id` in the Rack env](https://github.com/getsentry/sentry-ruby/pull/1849)).
31
+ You can then visit `https://sentry.io/organizations/<org-slug>>?query=<error-event-id>`
32
+ to go directly to the error (it may not show up immediately).
33
+
34
+ Note that this middleware must be inserted before Sentry's own middleware.
35
+ You can run `rails middleware` to verify the order of your registered middleware.
36
+
37
+ ```rb
38
+ config.middleware.insert_before 0, NxtSupport::Middleware::SentryErrorID
39
+ ```
40
+
27
41
  ### NxtSupport/Models
28
42
 
29
43
  Enjoy support for your models.
@@ -403,7 +417,22 @@ HomeBuilder.build(width: 20, length: 40, height: 15, roof_type: :pitched)
403
417
 
404
418
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
405
419
 
406
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
420
+ To install this gem onto your local machine, run `bundle exec rake install`.
421
+
422
+
423
+ First, if you don't want to always log in with your RubyGems password, you can create an API key from the web, and then:
424
+
425
+ ```shell
426
+ bundle config set gem.push_key rubygems
427
+ ```
428
+
429
+ Add to `~/.gem/credentials` (create if it doesn't exist):
430
+
431
+ ```shell
432
+ :rubygems: <your Rubygems API key>
433
+ ```
434
+
435
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
407
436
 
408
437
  ## Contributing
409
438
 
@@ -0,0 +1,17 @@
1
+ module NxtSupport
2
+ module Middleware
3
+ class SentryErrorID
4
+ def initialize(app)
5
+ @app = app
6
+ end
7
+
8
+ def call(env)
9
+ status, headers, body = @app.call(env)
10
+ if status >= 500 && env['sentry.error_event_id']
11
+ headers["Sentry-Error-Id"] = env['sentry.error_event_id']
12
+ end
13
+ [status, headers, body]
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1 @@
1
+ require_relative 'middleware/sentry_error_id'
@@ -1,3 +1,3 @@
1
1
  module NxtSupport
2
- VERSION = "0.3.0".freeze
2
+ VERSION = "0.4.1".freeze
3
3
  end
data/lib/nxt_support.rb CHANGED
@@ -8,6 +8,7 @@ require "nxt_support/serializers"
8
8
  require "nxt_support/util"
9
9
  require "nxt_support/services"
10
10
  require "nxt_support/refinements"
11
+ require "nxt_support/middleware"
11
12
 
12
13
  module NxtSupport
13
14
  end
data/nxt_support.gemspec CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.bindir = "exe"
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
+ spec.required_ruby_version = '>= 3.0.0'
29
30
 
30
31
  spec.add_dependency "activerecord"
31
32
  spec.add_dependency "activesupport"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nxt_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nils Sommer
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2022-06-02 00:00:00.000000000 Z
14
+ date: 2022-11-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activerecord
@@ -165,6 +165,8 @@ files:
165
165
  - bin/rspec
166
166
  - bin/setup
167
167
  - lib/nxt_support.rb
168
+ - lib/nxt_support/middleware.rb
169
+ - lib/nxt_support/middleware/sentry_error_id.rb
168
170
  - lib/nxt_support/models.rb
169
171
  - lib/nxt_support/models/assignable_values.rb
170
172
  - lib/nxt_support/models/duration_attribute_accessor.rb
@@ -206,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
208
  requirements:
207
209
  - - ">="
208
210
  - !ruby/object:Gem::Version
209
- version: '0'
211
+ version: 3.0.0
210
212
  required_rubygems_version: !ruby/object:Gem::Requirement
211
213
  requirements:
212
214
  - - ">="