sps-pub 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +1 -0
- data/lib/sps-pub.rb +37 -0
- data.tar.gz.sig +0 -0
- metadata +96 -0
- metadata.gz.sig +2 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9953f2878cd0a886d58292decc206ad59b919612
|
4
|
+
data.tar.gz: a157036cc61e7fa60e211e71f083525a6212dc1c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 02448015d1eb3328e649dd1fea6e9739a726e28489c7e48ab6c8b96d3f680e12a1dba7711a7535a1fc5bd4aaaba255687770e5d0f09e4de06fb7110e4e8f46e0
|
7
|
+
data.tar.gz: a24fa86b543e8151d487280e1787a160dcc463635fae2c60e19bf98a38d4b162eea4e7371001f1d87d97ed6bb5fcb8bdfa87ae0c80f7b8f1db00f428b4b2c678
|
checksums.yaml.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
N��~)�g
|
data/lib/sps-pub.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: sps-pub.rb
|
4
|
+
|
5
|
+
require 'simplepubsub'
|
6
|
+
require 'mqtt'
|
7
|
+
|
8
|
+
class SPSPub
|
9
|
+
include SimplePubSub
|
10
|
+
|
11
|
+
def self.notice(s,sps_address='sps', mqtt_address='mqtt')
|
12
|
+
|
13
|
+
topic, msg = s.split(/:\s*/,2)
|
14
|
+
r = ''
|
15
|
+
|
16
|
+
Client.connect(sps_address) do |client|
|
17
|
+
r = client.publish(topic, msg)
|
18
|
+
end
|
19
|
+
|
20
|
+
if topic == 'xmpp' then
|
21
|
+
MQTT::Client.connect(mqtt_address) do |client|
|
22
|
+
client.publish(topic, msg)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
r
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.listen(topic='#', sps_address='sps')
|
29
|
+
|
30
|
+
Client.connect(sps_address) do |client|
|
31
|
+
client.get(topic) do |topic, message|
|
32
|
+
puts "[%s] SPS listener INFO %s: %s" %
|
33
|
+
[Time.now.strftime("%Y-%m-%d %H:%M"), topic, message]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sps-pub
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
+
8ixkARkWAmV1MB4XDTEzMTAxOTE0MTkzMFoXDTE0MTAxOTE0MTkzMFowSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
|
+
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
+
ggEBANRRsbBhl/rL/jUQhdKHeSAizrZI9Fseg7+mz9EMBikrIvxcRzRYfdwi8RYJ
|
19
|
+
+QkRDbRv6Hm1qrU+p98VuNn4ZGlm1GaEuF/ihD2T+QdVd6yTu/XXWvbYf9Fl19/x
|
20
|
+
OBu83ZI50b+3OFg4NuZmsIqdkQhggZJXhYscD1mbPjcJj5eFzIFfIy+Zrd+HntH6
|
21
|
+
mowpGodvwMnHTpzk7k0P6cvO8Sb7Y6MuN2JfH95pk4ckEfEGesoqo1gvMMI2D/PR
|
22
|
+
RIJBgqXiQTQPn8G+hIsFp3X1YBt85Ph5kxny1sX+0I3me6DrWtZVpthDcqb1ShVV
|
23
|
+
FlNUfwBJFFBGZAwoD15g5/H1srUCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUHwUERVivBb5mrG5F/Ok/RoR643owJgYDVR0RBB8w
|
25
|
+
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEATc68hubv
|
27
|
+
M1UpQsOyYgnu0fGn23qv68p44E40VpwAEGQdWZOxN0Na0xVCCKeccOQTWeQpTbi2
|
28
|
+
bJFF+x3dvxM760D3PuLGMs0E3dCcmvqaCzGLfYymZJD2gzyrJnvNR5Gv2bIOkKPP
|
29
|
+
NyRHra5TBnLpX0KYV2xNY4qJmLQcjBeU1dQe2PW58W9c1uPTJ/ZWc8OEq9nOnP9c
|
30
|
+
dosuQJbF9WeNDS9cjTqE20dEFtU2aHgeFrfumAB3wF+rzaAufEp8wPe81cJXmyK7
|
31
|
+
2cSEZ0QYbEwC3czzwEism6iYWhlBI/srC6g8JIr7pq91FybciqI5dk5RB7SE5Xgf
|
32
|
+
p7uZNkO8qc9/fg==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2013-10-19 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: simplepubsub
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: mqtt
|
52
|
+
requirement: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
type: :runtime
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
description:
|
65
|
+
email: james@r0bertson.co.uk
|
66
|
+
executables: []
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- lib/sps-pub.rb
|
71
|
+
homepage: https://github.com/jrobertson/sps-pub
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.0.0.rc.2
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: A SimplePubSub client for publishing or subscribing to messages in 1 line
|
95
|
+
of code.
|
96
|
+
test_files: []
|
metadata.gz.sig
ADDED