grpcx 0.3.2 → 0.3.3
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 +48 -43
- data/grpcx.gemspec +2 -6
- metadata +4 -66
- 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: 75e3047e483e79cbc6aad9290d8b7f502dbf7b4ab562a5826ffa0d1ec8c4c471
|
4
|
+
data.tar.gz: 39a32bc32c1f946e45a759bf362b57fbd42172dcec1e7fb0076ec4f78a7de0de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dd0fef2128a38e6c4d19143fa9425e68584f48987badab945f4cfb8bd7a9e917e361e96317f3baf0a0b9dc2a1335df35072966a016b5430103f6cdffc6a1161
|
7
|
+
data.tar.gz: 85857f27c9e7be71ac994e2546d34fd748d819a7062dc615b9502faeab07940461f8e2e518a55557178c858499655cc21e5ff99b60b32489c219239a7caa374d
|
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,82 +1,87 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grpcx (0.3.
|
4
|
+
grpcx (0.3.3)
|
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.2)
|
12
|
+
activesupport (= 7.0.4.2)
|
13
|
+
activerecord (7.0.4.2)
|
14
|
+
activemodel (= 7.0.4.2)
|
15
|
+
activesupport (= 7.0.4.2)
|
16
|
+
activesupport (7.0.4.2)
|
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.0)
|
23
23
|
diff-lcs (1.5.0)
|
24
|
-
google-protobuf (3.
|
25
|
-
googleapis-common-protos-types (1.
|
24
|
+
google-protobuf (3.21.12)
|
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.17.0)
|
34
|
+
parallel (1.22.1)
|
35
|
+
parser (3.2.0.0)
|
35
36
|
ast (~> 2.4.1)
|
36
|
-
rainbow (3.
|
37
|
+
rainbow (3.1.1)
|
37
38
|
rake (13.0.6)
|
38
|
-
regexp_parser (2.2
|
39
|
+
regexp_parser (2.6.2)
|
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.3)
|
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.44.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.24.1, < 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.24.1)
|
65
|
+
parser (>= 3.1.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.0)
|
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.
|
78
|
+
rubocop-rspec (2.18.1)
|
79
|
+
rubocop (~> 1.33)
|
80
|
+
rubocop-capybara (~> 2.17)
|
76
81
|
ruby-progressbar (1.11.0)
|
77
|
-
tzinfo (2.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
|
@@ -90,4 +95,4 @@ DEPENDENCIES
|
|
90
95
|
rubocop-bsm
|
91
96
|
|
92
97
|
BUNDLED WITH
|
93
|
-
2.
|
98
|
+
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.3'
|
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,13 @@ 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
18
|
s.add_development_dependency 'bundler'
|
21
|
-
|
22
|
-
s.add_development_dependency 'rspec'
|
23
|
-
s.add_development_dependency 'rubocop-bsm'
|
19
|
+
|
24
20
|
s.metadata['rubygems_mfa_required'] = 'true'
|
25
21
|
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.3
|
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-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -38,20 +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
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: bundler
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,48 +52,6 @@ dependencies:
|
|
66
52
|
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
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
55
|
description: ''
|
112
56
|
email:
|
113
57
|
- info@blacksquaremedia.com
|
@@ -131,9 +75,6 @@ files:
|
|
131
75
|
- lib/grpcx/server/interceptors/active_record.rb
|
132
76
|
- lib/grpcx/server/interceptors/instrumentation.rb
|
133
77
|
- lib/grpcx/server/interceptors/rescue.rb
|
134
|
-
- spec/lib/entity_spec.rb
|
135
|
-
- spec/lib/server_spec.rb
|
136
|
-
- spec/spec_helper.rb
|
137
78
|
homepage: https://github.com/bsm/grpcx
|
138
79
|
licenses:
|
139
80
|
- MIT
|
@@ -154,11 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
95
|
- !ruby/object:Gem::Version
|
155
96
|
version: '0'
|
156
97
|
requirements: []
|
157
|
-
rubygems_version: 3.
|
98
|
+
rubygems_version: 3.4.6
|
158
99
|
signing_key:
|
159
100
|
specification_version: 4
|
160
101
|
summary: gRPC extensions/helpers
|
161
|
-
test_files:
|
162
|
-
- spec/lib/entity_spec.rb
|
163
|
-
- spec/lib/server_spec.rb
|
164
|
-
- spec/spec_helper.rb
|
102
|
+
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
|