protobuf 3.10.1 → 3.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/protobuf.rb +12 -0
- data/lib/protobuf/cli.rb +2 -0
- data/lib/protobuf/version.rb +1 -1
- data/spec/lib/protobuf/cli_spec.rb +35 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3abda94df908b555f894e94c32c31beba81221ba3da45ceb2096f5f0ad45d698
|
4
|
+
data.tar.gz: df520f797618b9c3a2273973c982848ef243a731494ca0d9f44ef3e6945bef03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62c8630d594b1a2599b4349a2cc84e50e1090a4e04e68f2a3b9774cbb18fd6793e3c4eaf8e5779bc6bddb5b9b8affa68d2ef18903111f7f5db8a8095bf9e0f42
|
7
|
+
data.tar.gz: ffae80308a6ed7d65aa5dac437e6bb0d08e292b6ffea3ee7a06c49394425e38a95bf8387eb9735b3d350c70c21db1f9a96438833120b1d1a3d89207de18008d8
|
data/lib/protobuf.rb
CHANGED
@@ -54,6 +54,18 @@ module Protobuf
|
|
54
54
|
attr_writer :client_host
|
55
55
|
end
|
56
56
|
|
57
|
+
def self.after_server_bind(&block)
|
58
|
+
::ActiveSupport::Notifications.subscribe('after_server_bind') do |*args|
|
59
|
+
block.call(*args)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.before_server_bind(&block)
|
64
|
+
::ActiveSupport::Notifications.subscribe('before_server_bind') do |*args|
|
65
|
+
block.call(*args)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
57
69
|
def self.client_host
|
58
70
|
@client_host ||= Socket.gethostname
|
59
71
|
end
|
data/lib/protobuf/cli.rb
CHANGED
@@ -240,6 +240,8 @@ module Protobuf
|
|
240
240
|
def start_server
|
241
241
|
debug_say('Running server')
|
242
242
|
|
243
|
+
::ActiveSupport::Notifications.instrument("before_server_bind")
|
244
|
+
|
243
245
|
runner.run do
|
244
246
|
logger.info do
|
245
247
|
"pid #{::Process.pid} -- #{mode} RPC Server listening at #{options.host}:#{options.port}"
|
data/lib/protobuf/version.rb
CHANGED
@@ -275,6 +275,41 @@ RSpec.describe ::Protobuf::CLI do
|
|
275
275
|
end
|
276
276
|
end
|
277
277
|
|
278
|
+
context 'after server bind' do
|
279
|
+
let(:sock_runner) { double("FakeRunner", :run => nil) }
|
280
|
+
|
281
|
+
before { allow(sock_runner).to receive(:run).and_yield }
|
282
|
+
|
283
|
+
it 'publishes when using the lib/protobuf callback' do
|
284
|
+
message_after_bind = false
|
285
|
+
::Protobuf.after_server_bind do
|
286
|
+
message_after_bind = true
|
287
|
+
end
|
288
|
+
described_class.start(args)
|
289
|
+
expect(message_after_bind).to eq(true)
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
context 'before server bind' do
|
294
|
+
it 'publishes a message before the runner runs' do
|
295
|
+
message_before_bind = false
|
296
|
+
::ActiveSupport::Notifications.subscribe('before_server_bind') do
|
297
|
+
message_before_bind = true
|
298
|
+
end
|
299
|
+
described_class.start(args)
|
300
|
+
expect(message_before_bind).to eq(true)
|
301
|
+
end
|
302
|
+
|
303
|
+
it 'publishes when using the lib/protobuf callback' do
|
304
|
+
message_before_bind = false
|
305
|
+
::Protobuf.before_server_bind do
|
306
|
+
message_before_bind = true
|
307
|
+
end
|
308
|
+
described_class.start(args)
|
309
|
+
expect(message_before_bind).to eq(true)
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
278
313
|
end
|
279
314
|
|
280
315
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.10.
|
4
|
+
version: 3.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BJ Neilsen
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2019-
|
14
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|