grpcx 0.3.2 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +2 -2
- data/Gemfile +5 -0
- data/Gemfile.lock +49 -45
- data/grpcx.gemspec +1 -7
- metadata +4 -80
- data/spec/lib/entity_spec.rb +0 -24
- data/spec/lib/server_spec.rb +0 -33
- data/spec/spec_helper.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d6ff37759d6b643916d5b3a4d3fd6cbd8d0ab1a2061fcc312d98eea7cc4ed4a
|
4
|
+
data.tar.gz: 54d8683068a9b469dfd5c758396e57a5c7c7649c42997fdd10eebdd4ff210358
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1acd6568eceee01d438a9f52620d4295e364ebf3a99beef9110a776e0aa213292f602b7eb7e1966810bcef8437a12c0614b3d7a8551bb4c90a4ab0ad92c0c4e5
|
7
|
+
data.tar.gz: 2be25e8c5e9534241bd17f6b2468fe7503b2efaca5e94832a59c85879824ed45a54a86f327542485fd47a1d6690e43a9bd320293cf9cb1e3af49f2ce38611c6e
|
data/.github/workflows/test.yml
CHANGED
@@ -11,9 +11,9 @@ jobs:
|
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
|
-
ruby-version: ["2.7", "3.0", "3.1"]
|
14
|
+
ruby-version: ["2.7", "3.0", "3.1", "3.2"]
|
15
15
|
steps:
|
16
|
-
- uses: actions/checkout@
|
16
|
+
- uses: actions/checkout@v3
|
17
17
|
- uses: ruby/setup-ruby@v1
|
18
18
|
with:
|
19
19
|
ruby-version: ${{ matrix.ruby-version }}
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,93 +1,97 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grpcx (0.3.
|
4
|
+
grpcx (0.3.4)
|
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 (7.0.
|
12
|
-
activesupport (= 7.0.
|
13
|
-
activerecord (7.0.
|
14
|
-
activemodel (= 7.0.
|
15
|
-
activesupport (= 7.0.
|
16
|
-
activesupport (7.0.
|
11
|
+
activemodel (7.0.4.3)
|
12
|
+
activesupport (= 7.0.4.3)
|
13
|
+
activerecord (7.0.4.3)
|
14
|
+
activemodel (= 7.0.4.3)
|
15
|
+
activesupport (= 7.0.4.3)
|
16
|
+
activesupport (7.0.4.3)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
18
|
i18n (>= 1.6, < 2)
|
19
19
|
minitest (>= 5.1)
|
20
20
|
tzinfo (~> 2.0)
|
21
21
|
ast (2.4.2)
|
22
|
-
concurrent-ruby (1.
|
22
|
+
concurrent-ruby (1.2.2)
|
23
23
|
diff-lcs (1.5.0)
|
24
|
-
google-protobuf (3.
|
25
|
-
googleapis-common-protos-types (1.
|
24
|
+
google-protobuf (3.22.2)
|
25
|
+
googleapis-common-protos-types (1.5.0)
|
26
26
|
google-protobuf (~> 3.14)
|
27
|
-
grpc (1.
|
28
|
-
google-protobuf (~> 3.
|
27
|
+
grpc (1.52.0)
|
28
|
+
google-protobuf (~> 3.21)
|
29
29
|
googleapis-common-protos-types (~> 1.0)
|
30
|
-
i18n (1.
|
30
|
+
i18n (1.12.0)
|
31
31
|
concurrent-ruby (~> 1.0)
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
json (2.6.3)
|
33
|
+
minitest (5.18.0)
|
34
|
+
parallel (1.22.1)
|
35
|
+
parser (3.2.1.1)
|
35
36
|
ast (~> 2.4.1)
|
36
|
-
rainbow (3.
|
37
|
+
rainbow (3.1.1)
|
37
38
|
rake (13.0.6)
|
38
|
-
regexp_parser (2.
|
39
|
+
regexp_parser (2.7.0)
|
39
40
|
rexml (3.2.5)
|
40
|
-
rspec (3.
|
41
|
-
rspec-core (~> 3.
|
42
|
-
rspec-expectations (~> 3.
|
43
|
-
rspec-mocks (~> 3.
|
44
|
-
rspec-core (3.
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-expectations (3.
|
41
|
+
rspec (3.12.0)
|
42
|
+
rspec-core (~> 3.12.0)
|
43
|
+
rspec-expectations (~> 3.12.0)
|
44
|
+
rspec-mocks (~> 3.12.0)
|
45
|
+
rspec-core (3.12.1)
|
46
|
+
rspec-support (~> 3.12.0)
|
47
|
+
rspec-expectations (3.12.2)
|
47
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-mocks (3.
|
49
|
+
rspec-support (~> 3.12.0)
|
50
|
+
rspec-mocks (3.12.4)
|
50
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.
|
52
|
-
rspec-support (3.
|
53
|
-
rubocop (1.
|
52
|
+
rspec-support (~> 3.12.0)
|
53
|
+
rspec-support (3.12.0)
|
54
|
+
rubocop (1.48.1)
|
55
|
+
json (~> 2.3)
|
54
56
|
parallel (~> 1.10)
|
55
|
-
parser (>= 3.
|
57
|
+
parser (>= 3.2.0.0)
|
56
58
|
rainbow (>= 2.2.2, < 4.0)
|
57
59
|
regexp_parser (>= 1.8, < 3.0)
|
58
|
-
rexml
|
59
|
-
rubocop-ast (>= 1.
|
60
|
+
rexml (>= 3.2.5, < 4.0)
|
61
|
+
rubocop-ast (>= 1.26.0, < 2.0)
|
60
62
|
ruby-progressbar (~> 1.7)
|
61
|
-
unicode-display_width (>=
|
62
|
-
rubocop-ast (1.
|
63
|
-
parser (>= 3.
|
64
|
-
rubocop-bsm (0.6.
|
63
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
64
|
+
rubocop-ast (1.27.0)
|
65
|
+
parser (>= 3.2.1.0)
|
66
|
+
rubocop-bsm (0.6.1)
|
65
67
|
rubocop (~> 1.0)
|
66
68
|
rubocop-performance
|
67
69
|
rubocop-rake
|
68
70
|
rubocop-rspec
|
69
|
-
rubocop-
|
71
|
+
rubocop-capybara (2.17.1)
|
72
|
+
rubocop (~> 1.41)
|
73
|
+
rubocop-performance (1.16.0)
|
70
74
|
rubocop (>= 1.7.0, < 2.0)
|
71
75
|
rubocop-ast (>= 0.4.0)
|
72
76
|
rubocop-rake (0.6.0)
|
73
77
|
rubocop (~> 1.0)
|
74
|
-
rubocop-rspec (2.
|
75
|
-
rubocop (~> 1.
|
76
|
-
|
77
|
-
|
78
|
+
rubocop-rspec (2.19.0)
|
79
|
+
rubocop (~> 1.33)
|
80
|
+
rubocop-capybara (~> 2.17)
|
81
|
+
ruby-progressbar (1.13.0)
|
82
|
+
tzinfo (2.0.6)
|
78
83
|
concurrent-ruby (~> 1.0)
|
79
|
-
unicode-display_width (2.
|
84
|
+
unicode-display_width (2.4.2)
|
80
85
|
|
81
86
|
PLATFORMS
|
82
87
|
ruby
|
83
88
|
|
84
89
|
DEPENDENCIES
|
85
90
|
activerecord
|
86
|
-
bundler
|
87
91
|
grpcx!
|
88
92
|
rake
|
89
93
|
rspec
|
90
94
|
rubocop-bsm
|
91
95
|
|
92
96
|
BUNDLED WITH
|
93
|
-
2.
|
97
|
+
2.3.16
|
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.
|
3
|
+
s.version = '0.3.4'
|
4
4
|
s.authors = ['Black Square Media Ltd']
|
5
5
|
s.email = ['info@blacksquaremedia.com']
|
6
6
|
s.summary = %(gRPC extensions/helpers)
|
@@ -9,17 +9,11 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.license = 'MIT'
|
10
10
|
|
11
11
|
s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^spec/}) }
|
12
|
-
s.test_files = `git ls-files -z -- spec/*`.split("\x0")
|
13
12
|
s.require_paths = ['lib']
|
14
13
|
s.required_ruby_version = '>= 2.7'
|
15
14
|
|
16
15
|
s.add_dependency 'activesupport', '>= 5.0'
|
17
16
|
s.add_dependency 'grpc', '>= 1.8.0'
|
18
17
|
|
19
|
-
s.add_development_dependency 'activerecord'
|
20
|
-
s.add_development_dependency 'bundler'
|
21
|
-
s.add_development_dependency 'rake'
|
22
|
-
s.add_development_dependency 'rspec'
|
23
|
-
s.add_development_dependency 'rubocop-bsm'
|
24
18
|
s.metadata['rubygems_mfa_required'] = 'true'
|
25
19
|
end
|
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.
|
4
|
+
version: 0.3.4
|
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:
|
11
|
+
date: 2023-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -38,76 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.8.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: activerecord
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: bundler
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rspec
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-bsm
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
41
|
description: ''
|
112
42
|
email:
|
113
43
|
- info@blacksquaremedia.com
|
@@ -131,9 +61,6 @@ files:
|
|
131
61
|
- lib/grpcx/server/interceptors/active_record.rb
|
132
62
|
- lib/grpcx/server/interceptors/instrumentation.rb
|
133
63
|
- lib/grpcx/server/interceptors/rescue.rb
|
134
|
-
- spec/lib/entity_spec.rb
|
135
|
-
- spec/lib/server_spec.rb
|
136
|
-
- spec/spec_helper.rb
|
137
64
|
homepage: https://github.com/bsm/grpcx
|
138
65
|
licenses:
|
139
66
|
- MIT
|
@@ -154,11 +81,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
81
|
- !ruby/object:Gem::Version
|
155
82
|
version: '0'
|
156
83
|
requirements: []
|
157
|
-
rubygems_version: 3.
|
84
|
+
rubygems_version: 3.4.6
|
158
85
|
signing_key:
|
159
86
|
specification_version: 4
|
160
87
|
summary: gRPC extensions/helpers
|
161
|
-
test_files:
|
162
|
-
- spec/lib/entity_spec.rb
|
163
|
-
- spec/lib/server_spec.rb
|
164
|
-
- spec/spec_helper.rb
|
88
|
+
test_files: []
|
data/spec/lib/entity_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Grpcx::Entity do
|
4
|
-
it 'builds messages' do
|
5
|
-
msg = described_class.build Grpcx::Spec::Message,
|
6
|
-
name: 'Name',
|
7
|
-
version: 1,
|
8
|
-
types: {
|
9
|
-
num: 8,
|
10
|
-
truth: [1, 0, true, 'true'],
|
11
|
-
decimal: '1.2',
|
12
|
-
}
|
13
|
-
|
14
|
-
expect(msg.to_h).to eq(
|
15
|
-
name: 'Name',
|
16
|
-
version: :V1,
|
17
|
-
types: {
|
18
|
-
num: 8,
|
19
|
-
truth: [true, false, true, true],
|
20
|
-
decimal: 1.2,
|
21
|
-
},
|
22
|
-
)
|
23
|
-
end
|
24
|
-
end
|
data/spec/lib/server_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Grpcx::Server do
|
4
|
-
subject do
|
5
|
-
s = Grpcx::Spec::Server.new
|
6
|
-
s.handle Grpcx::Spec::Service::V1
|
7
|
-
s
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'has a health-check' do
|
11
|
-
expect(subject.health).to be_a(Grpc::Health::Checker)
|
12
|
-
expect(subject.health.instance_variable_get(:@statuses)).to eq(
|
13
|
-
'grpcx.spec.service.V1' => 1,
|
14
|
-
'grpc.health.v1.Health' => 1,
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'has interceptors' do
|
19
|
-
expect(subject.interceptors).to be_a(GRPC::InterceptorRegistry)
|
20
|
-
|
21
|
-
registered = subject.interceptors.instance_variable_get(:@interceptors)
|
22
|
-
expect(registered.size).to eq(3)
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'has rescue handlers' do
|
26
|
-
expect(subject.rescue_handlers.size).to eq(3)
|
27
|
-
expect(subject.rescue_handlers.map(&:first)).to match_array %w[
|
28
|
-
ActiveRecord::RecordInvalid
|
29
|
-
ActiveRecord::RecordNotFound
|
30
|
-
ArgumentError
|
31
|
-
]
|
32
|
-
end
|
33
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'grpcx'
|
3
|
-
require 'active_record'
|
4
|
-
require 'google/protobuf'
|
5
|
-
|
6
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
-
add_message 'grpcx.spec.Message' do
|
8
|
-
optional :name, :string, 1
|
9
|
-
optional :version, :enum, 2, 'grpcx.spec.Version'
|
10
|
-
optional :types, :message, 3, 'grpcx.spec.Types'
|
11
|
-
end
|
12
|
-
add_message 'grpcx.spec.Types' do
|
13
|
-
optional :num, :int64, 1
|
14
|
-
repeated :truth, :bool, 2
|
15
|
-
optional :decimal, :double, 3
|
16
|
-
end
|
17
|
-
add_enum 'grpcx.spec.Version' do
|
18
|
-
value :V0, 0
|
19
|
-
value :V1, 1
|
20
|
-
value :V2, 2
|
21
|
-
end
|
22
|
-
add_message 'grpcx.spec.GetMessageRequest' do
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
module Grpcx::Spec
|
27
|
-
Message = Google::Protobuf::DescriptorPool.generated_pool.lookup('grpcx.spec.Message').msgclass
|
28
|
-
Version = Google::Protobuf::DescriptorPool.generated_pool.lookup('grpcx.spec.Version').enummodule
|
29
|
-
Types = Google::Protobuf::DescriptorPool.generated_pool.lookup('grpcx.spec.Types').msgclass
|
30
|
-
GetMessageRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup('grpcx.spec.GetMessageRequest').msgclass
|
31
|
-
|
32
|
-
module Service
|
33
|
-
class V1
|
34
|
-
include GRPC::GenericService
|
35
|
-
|
36
|
-
self.marshal_class_method = :encode
|
37
|
-
self.unmarshal_class_method = :decode
|
38
|
-
self.service_name = 'grpcx.spec.service.V1'
|
39
|
-
|
40
|
-
rpc :GetMessage, GetMessageRequest, Message
|
41
|
-
end
|
42
|
-
|
43
|
-
Stub = V1.rpc_stub_class
|
44
|
-
end
|
45
|
-
|
46
|
-
class Server < GRPC::RpcServer
|
47
|
-
include Grpcx::Server
|
48
|
-
|
49
|
-
rescue_from 'ArgumentError' do |e|
|
50
|
-
raise GRPC::InvalidArgument.new(errors: e.to_s)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|