grpcx 0.3.0 → 0.3.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: 66a39ca3d81a4f36e3ec546252755dc6c8f5a93e77dee26824b935260ced5973
4
- data.tar.gz: f26e9038ee971c5bd1fcde6be56fc0b19c37e3a195a8474800f5395c18ee0878
3
+ metadata.gz: c1a29ef56f02c4f3c6b9e5619371f91323bf4936c68f005b5d5ff4a4e1d5ade2
4
+ data.tar.gz: e397ccb4be91b3d9b7fadba057d2882cdbe7b0bebe6e9d5039daf1b76331cea6
5
5
  SHA512:
6
- metadata.gz: c90478efde02ea7793cb23a884d3e99ffe4692ed938299da1d391664e18116c3f5c4d938100d9ca0fdd1e56925bd10aba47b3d986b2f0cdb1f93bcef67457c1f
7
- data.tar.gz: 5c29233c1760993563acc0875792d669505ebd5e18ea4443e441ba807dacd59b5418fa7573834694607abbdddf55b8da1192f40158894e39359dfceea0c593af
6
+ metadata.gz: 1f5791ed4d2a2ea9c12a140422635a50635adaaa3677cc52deaff74c38e48115569ba6f3ba34bb6efdaa1bbd7bb3aad6fdfa095ef82734b0404de969f1376aef
7
+ data.tar.gz: 22dbbb57b6a72bb376afd1709645dce56a765eb2ac75ebe796277561ed9622644637e3c74950a464f6a6ede49bd10dd92d72f5da958488cdfeaa6e362c62822c
@@ -0,0 +1,21 @@
1
+ name: Test
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ pull_request:
7
+ branches:
8
+ - main
9
+ jobs:
10
+ ruby:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ ruby-version: ["2.5", "2.6", "2.7", "3.0"]
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby-version }}
20
+ bundler-cache: true
21
+ - run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -1,5 +1,14 @@
1
- inherit_from:
2
- - https://gitlab.com/bsm/misc/raw/master/rubocop/default.yml
1
+ inherit_gem:
2
+ rubocop-bsm:
3
+ - default.yml
4
+ inherit_mode:
5
+ merge:
6
+ - Exclude
3
7
 
4
8
  AllCops:
5
- TargetRubyVersion: 2.5
9
+ TargetRubyVersion: "2.5"
10
+
11
+ RSpec/FilePath:
12
+ Enabled: false
13
+ Lint/EmptyBlock:
14
+ Enabled: false
data/Gemfile.lock CHANGED
@@ -1,70 +1,91 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grpcx (0.3.0)
4
+ grpcx (0.3.1)
5
5
  activesupport (>= 5.0)
6
6
  grpc (>= 1.8.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (6.0.2.1)
12
- activesupport (= 6.0.2.1)
13
- activerecord (6.0.2.1)
14
- activemodel (= 6.0.2.1)
15
- activesupport (= 6.0.2.1)
16
- activesupport (6.0.2.1)
11
+ activemodel (6.1.3.1)
12
+ activesupport (= 6.1.3.1)
13
+ activerecord (6.1.3.1)
14
+ activemodel (= 6.1.3.1)
15
+ activesupport (= 6.1.3.1)
16
+ activesupport (6.1.3.1)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
- i18n (>= 0.7, < 2)
19
- minitest (~> 5.1)
20
- tzinfo (~> 1.1)
21
- zeitwerk (~> 2.2)
22
- ast (2.4.0)
23
- concurrent-ruby (1.1.6)
24
- diff-lcs (1.3)
25
- google-protobuf (3.11.4)
26
- googleapis-common-protos-types (1.0.4)
27
- google-protobuf (~> 3.0)
28
- grpc (1.27.0)
29
- google-protobuf (~> 3.11)
18
+ i18n (>= 1.6, < 2)
19
+ minitest (>= 5.1)
20
+ tzinfo (~> 2.0)
21
+ zeitwerk (~> 2.3)
22
+ ast (2.4.2)
23
+ concurrent-ruby (1.1.8)
24
+ diff-lcs (1.4.4)
25
+ google-protobuf (3.15.8)
26
+ googleapis-common-protos-types (1.0.6)
27
+ google-protobuf (~> 3.14)
28
+ grpc (1.37.1)
29
+ google-protobuf (~> 3.15)
30
30
  googleapis-common-protos-types (~> 1.0)
31
- i18n (1.8.2)
31
+ i18n (1.8.10)
32
32
  concurrent-ruby (~> 1.0)
33
- jaro_winkler (1.5.4)
34
- minitest (5.14.0)
35
- parallel (1.19.1)
36
- parser (2.7.0.4)
37
- ast (~> 2.4.0)
33
+ minitest (5.14.4)
34
+ parallel (1.20.1)
35
+ parser (3.0.1.1)
36
+ ast (~> 2.4.1)
37
+ rack (2.2.3)
38
38
  rainbow (3.0.0)
39
- rake (13.0.1)
40
- rexml (3.2.4)
41
- rspec (3.9.0)
42
- rspec-core (~> 3.9.0)
43
- rspec-expectations (~> 3.9.0)
44
- rspec-mocks (~> 3.9.0)
45
- rspec-core (3.9.1)
46
- rspec-support (~> 3.9.1)
47
- rspec-expectations (3.9.0)
39
+ rake (13.0.3)
40
+ regexp_parser (2.1.1)
41
+ rexml (3.2.5)
42
+ rspec (3.10.0)
43
+ rspec-core (~> 3.10.0)
44
+ rspec-expectations (~> 3.10.0)
45
+ rspec-mocks (~> 3.10.0)
46
+ rspec-core (3.10.1)
47
+ rspec-support (~> 3.10.0)
48
+ rspec-expectations (3.10.1)
48
49
  diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.9.0)
50
- rspec-mocks (3.9.1)
50
+ rspec-support (~> 3.10.0)
51
+ rspec-mocks (3.10.2)
51
52
  diff-lcs (>= 1.2.0, < 2.0)
52
- rspec-support (~> 3.9.0)
53
- rspec-support (3.9.2)
54
- rubocop (0.80.1)
55
- jaro_winkler (~> 1.5.1)
53
+ rspec-support (~> 3.10.0)
54
+ rspec-support (3.10.2)
55
+ rubocop (1.13.0)
56
56
  parallel (~> 1.10)
57
- parser (>= 2.7.0.1)
57
+ parser (>= 3.0.0.0)
58
58
  rainbow (>= 2.2.2, < 4.0)
59
+ regexp_parser (>= 1.8, < 3.0)
59
60
  rexml
61
+ rubocop-ast (>= 1.2.0, < 2.0)
60
62
  ruby-progressbar (~> 1.7)
61
- unicode-display_width (>= 1.4.0, < 1.7)
62
- ruby-progressbar (1.10.1)
63
- thread_safe (0.3.6)
64
- tzinfo (1.2.6)
65
- thread_safe (~> 0.1)
66
- unicode-display_width (1.6.1)
67
- zeitwerk (2.3.0)
63
+ unicode-display_width (>= 1.4.0, < 3.0)
64
+ rubocop-ast (1.5.0)
65
+ parser (>= 3.0.1.1)
66
+ rubocop-bsm (0.5.9)
67
+ rubocop (~> 1.0)
68
+ rubocop-performance
69
+ rubocop-rails
70
+ rubocop-rake
71
+ rubocop-rspec
72
+ rubocop-performance (1.11.1)
73
+ rubocop (>= 1.7.0, < 2.0)
74
+ rubocop-ast (>= 0.4.0)
75
+ rubocop-rails (2.9.1)
76
+ activesupport (>= 4.2.0)
77
+ rack (>= 1.1)
78
+ rubocop (>= 0.90.0, < 2.0)
79
+ rubocop-rake (0.5.1)
80
+ rubocop
81
+ rubocop-rspec (2.3.0)
82
+ rubocop (~> 1.0)
83
+ rubocop-ast (>= 1.1.0)
84
+ ruby-progressbar (1.11.0)
85
+ tzinfo (2.0.4)
86
+ concurrent-ruby (~> 1.0)
87
+ unicode-display_width (2.0.0)
88
+ zeitwerk (2.4.2)
68
89
 
69
90
  PLATFORMS
70
91
  ruby
@@ -75,7 +96,7 @@ DEPENDENCIES
75
96
  grpcx!
76
97
  rake
77
98
  rspec
78
- rubocop
99
+ rubocop-bsm
79
100
 
80
101
  BUNDLED WITH
81
102
  2.1.4
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # grpcx
2
2
 
3
- Ruby gRPC extensions/helpers
3
+ [![Test](https://github.com/bsm/grpcx/actions/workflows/test.yml/badge.svg)](https://github.com/bsm/grpcx/actions/workflows/test.yml)
4
4
 
5
+ Ruby gRPC extensions/helpers
5
6
 
6
7
  # Grpcx::Server
7
8
 
@@ -12,7 +13,6 @@ Mixin for `GRPC::RpcServer`:
12
13
  - instruments each request with `ActiveSupport::Notifications` (available as `process_action.grpc`, includes `service: 'package.name.ServiceName', action: 'underscored_action_name'` data)
13
14
  - includes `ActiveSupport::Rescuable` and transforms most common `ActiveRecord::ActiveRecordError`-s into `GRPC::BadStatus` ones
14
15
 
15
-
16
16
  Example:
17
17
 
18
18
  ```ruby
@@ -47,7 +47,6 @@ end
47
47
  ...
48
48
  ```
49
49
 
50
-
51
50
  ## Using with [Datadog::Notifications](https://github.com/bsm/datadog-notifications)
52
51
 
53
52
  Since version >= [0.5.4](https://github.com/bsm/datadog-notifications/releases/tag/v0.5.4)
@@ -58,7 +57,6 @@ Datadog::Notifications.configure do |c|
58
57
  end if RUNNING_IN_PROD?
59
58
  ```
60
59
 
61
-
62
60
  ## Using with [Sentry](https://sentry.io/)/[Raven](https://github.com/getsentry/raven-ruby)
63
61
 
64
62
  ```ruby
data/grpcx.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'grpcx'
3
- s.version = '0.3.0'
3
+ s.version = '0.3.1'
4
4
  s.authors = ['Black Square Media Ltd']
5
5
  s.email = ['info@blacksquaremedia.com']
6
6
  s.summary = %(gRPC extensions/helpers)
@@ -20,5 +20,5 @@ Gem::Specification.new do |s|
20
20
  s.add_development_dependency 'bundler'
21
21
  s.add_development_dependency 'rake'
22
22
  s.add_development_dependency 'rspec'
23
- s.add_development_dependency 'rubocop'
23
+ s.add_development_dependency 'rubocop-bsm'
24
24
  end
data/lib/grpcx/server.rb CHANGED
@@ -22,7 +22,7 @@ module Grpcx
22
22
  end
23
23
  end
24
24
 
25
- def initialize(opts = {})
25
+ def initialize(**opts)
26
26
  opts[:pool_size] ||= ENV['GRPC_SERVER_THREADS'].to_i if ENV['GRPC_SERVER_THREADS']
27
27
  opts[:max_waiting_requests] ||= ENV['GRPC_SERVER_QUEUE'].to_i if ENV['GRPC_SERVER_QUEUE']
28
28
 
@@ -32,7 +32,7 @@ module Grpcx
32
32
  opts[:interceptors].prepend Grpcx::Server::Interceptors::Instrumentation.new
33
33
  opts[:interceptors].prepend Grpcx::Server::Interceptors::ActiveRecord.new if defined?(::ActiveRecord)
34
34
 
35
- super(opts).tap do
35
+ super.tap do
36
36
  handle(health)
37
37
  end
38
38
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe Grpcx::Entity do
4
- it 'should build messages' do
4
+ it 'builds messages' do
5
5
  msg = described_class.build Grpcx::Spec::Message,
6
6
  name: 'Name',
7
7
  version: 1,
@@ -7,7 +7,7 @@ RSpec.describe Grpcx::Server do
7
7
  s
8
8
  end
9
9
 
10
- it 'should have a health-check' do
10
+ it 'has a health-check' do
11
11
  expect(subject.health).to be_a(Grpc::Health::Checker)
12
12
  expect(subject.health.instance_variable_get(:@statuses)).to eq(
13
13
  'grpcx.spec.service.V1' => 1,
@@ -15,14 +15,14 @@ RSpec.describe Grpcx::Server do
15
15
  )
16
16
  end
17
17
 
18
- it 'should have interceptors' do
18
+ it 'has interceptors' do
19
19
  expect(subject.interceptors).to be_a(GRPC::InterceptorRegistry)
20
20
 
21
21
  registered = subject.interceptors.instance_variable_get(:@interceptors)
22
22
  expect(registered.size).to eq(3)
23
23
  end
24
24
 
25
- it 'should have rescue handlers' do
25
+ it 'has rescue handlers' do
26
26
  expect(subject.rescue_handlers.size).to eq(3)
27
27
  expect(subject.rescue_handlers.map(&:first)).to match_array %w[
28
28
  ActiveRecord::RecordInvalid
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grpcx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Black Square Media Ltd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-10 00:00:00.000000000 Z
11
+ date: 2021-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rubocop
98
+ name: rubocop-bsm
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -116,6 +116,7 @@ extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
118
  - ".editorconfig"
119
+ - ".github/workflows/test.yml"
119
120
  - ".gitignore"
120
121
  - ".rubocop.yml"
121
122
  - Gemfile
@@ -152,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
153
  - !ruby/object:Gem::Version
153
154
  version: '0'
154
155
  requirements: []
155
- rubygems_version: 3.0.6
156
+ rubygems_version: 3.1.4
156
157
  signing_key:
157
158
  specification_version: 4
158
159
  summary: gRPC extensions/helpers