ExistRuby 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/ExistRuby.rb +35 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 06769a721a1fe25a3ae2dc13ff9362a16e627d6a
|
4
|
+
data.tar.gz: c36b22c07ff36942ee9ecf602414279e15218c53
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2d32c908bf92ebd5187dad04c3b53e08bf1690ee1676d322e25579d2cd51d85a431f8ba0b485735d8f060132f2028998a2557990d709e661e3470aa9350d522f
|
7
|
+
data.tar.gz: 0b8492e09f118392397975ad204b043111de89c08c8c32576ae2d3f1d258330e37560a8b2bb2b78a3d80253494d19bb5df25485ead91edefcd74c0b281e0838f
|
data/lib/ExistRuby.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
class ExistRuby
|
4
|
+
|
5
|
+
# Publish a service to the LAN.
|
6
|
+
#
|
7
|
+
# Example:
|
8
|
+
# >> existRuby=ExistRuby.new
|
9
|
+
# >> existRuby.publishService("fp_serverPython", 10086, exist::ServicePublishMessage::ServiceProtocolType::GRPC)
|
10
|
+
#
|
11
|
+
# Arguments:
|
12
|
+
# lanServiceName: (String)
|
13
|
+
# lanServicePort: (int)
|
14
|
+
# lanServiceProtocolType: (enum)
|
15
|
+
def publishService(lanServiceName, lanServicePort, lanServiceProtocolType)
|
16
|
+
@lanServiceName=lanServiceName
|
17
|
+
@lanServicePort=lanServicePort
|
18
|
+
@lanServiceProtocolType=lanServiceProtocolType
|
19
|
+
|
20
|
+
exist::ExistMessage existMessage; //消息。
|
21
|
+
|
22
|
+
existMessage.set_messagetype (exist::ExistMessage::SERVICEPUBLISH); //设置消息类型。
|
23
|
+
|
24
|
+
exist::ServicePublishMessage * servicePublishMessage=existMessage.mutable_servicepublishmessage (); //获取服务发布消息对象。
|
25
|
+
|
26
|
+
servicePublishMessage->set_name (LanServiceName); //设置服务名字。
|
27
|
+
servicePublishMessage->set_port (LanServicePort); //设置端口号。
|
28
|
+
servicePublishMessage->set_protocoltype (LanServiceProtocolType); //设置协议类型。
|
29
|
+
|
30
|
+
string packageString=existMessage.SerializeAsString (); //序列化为字符串。
|
31
|
+
|
32
|
+
//发送:
|
33
|
+
networkThread.castData(packageString);
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ExistRuby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hxcan Cai
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-07-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Exist ruby. Auto service discovery in the LAN.
|
14
|
+
email: caihuosheng@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/ExistRuby.rb
|
20
|
+
homepage: http://rubygems.org/gems/ExistRuby
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.4.5.1
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Exist ruby. Auto service discovery in the LAN.
|
44
|
+
test_files: []
|