apiotics 0.1.82 → 0.1.83
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/apiotics/client.rb +7 -3
- data/lib/apiotics/configuration.rb +2 -2
- data/lib/apiotics/server.rb +30 -14
- data/lib/apiotics/version.rb +1 -1
- data/lib/generators/apiotics/initializer/templates/apiotics.rb.erb +1 -1
- data/lib/generators/apiotics/script/templates/server_control.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60cdc0f1790b8f4586b322d2662215b21de02abc
|
4
|
+
data.tar.gz: 4b9f828b1fec118b4f14b9173cea23cc7afa63b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fa9d5dd364846ab88578c2924ea817c54611106860cb3617b7ac3f2a4e2f91ee3b804a4ceb3f4dd455719b66c4bfb9b247bc8634a7418999c84e46fa9249f19
|
7
|
+
data.tar.gz: f2a499ec53ee6a37db9510f1913f1ec0a05813ffdf72ee0213a5cb2b27ef2f4e1d2e061de21582615932f6eca85c3d051a42335bd58c1440aeeda5a172ed7641
|
data/lib/apiotics/client.rb
CHANGED
@@ -14,9 +14,13 @@ module Apiotics
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def send(msg)
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
if Apiotics.configuration.redis_comms_connection == false
|
18
|
+
connection = TCPSocket.open(@server, @port)
|
19
|
+
connection.puts( msg )
|
20
|
+
connection.close
|
21
|
+
else
|
22
|
+
$redis.publish Apiotics.configuration.public_key, msg
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
26
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Apiotics
|
2
2
|
class Configuration
|
3
3
|
|
4
|
-
attr_accessor :public_key, :private_key, :local_logging, :targets, :local_port, :server, :server_port, :portal, :push, :tls, :verify_peer, :handshake, :parents, :reduced_metadata, :
|
4
|
+
attr_accessor :public_key, :private_key, :local_logging, :targets, :local_port, :server, :server_port, :portal, :push, :tls, :verify_peer, :handshake, :parents, :reduced_metadata, :redis_comms_connection, :interface_kinds
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@public_key = nil
|
@@ -18,7 +18,7 @@ module Apiotics
|
|
18
18
|
@handshake = true
|
19
19
|
@parents = {}
|
20
20
|
@reduced_metadata = false
|
21
|
-
@
|
21
|
+
@redis_comms_connection = false
|
22
22
|
@interface_kinds = {
|
23
23
|
"string" => "string",
|
24
24
|
"text" => "string",
|
data/lib/apiotics/server.rb
CHANGED
@@ -108,20 +108,36 @@ module Apiotics
|
|
108
108
|
|
109
109
|
def listen_local
|
110
110
|
begin
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
111
|
+
if Apiotics.configuration.redis_comms_connection == false
|
112
|
+
server = TCPServer.open(@localport)
|
113
|
+
if Apiotics.configuration.handshake == true
|
114
|
+
self.send('{"action":"connect"}')
|
115
|
+
end
|
116
|
+
loop do
|
117
|
+
Thread.fork(server.accept) do |client|
|
118
|
+
s = client.gets
|
119
|
+
if @error_msg != nil
|
120
|
+
string = '{"error":"' + error_msg + '"}'
|
121
|
+
client.puts(string)
|
122
|
+
end
|
123
|
+
#puts s
|
124
|
+
self.send(s)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
else
|
128
|
+
if Apiotics.configuration.handshake == true
|
129
|
+
self.send('{"action":"connect"}')
|
130
|
+
end
|
131
|
+
$redis.subscribe(Apiotics.configuration.public_key) do |on|
|
132
|
+
on.message do |channel, msg|
|
133
|
+
if @error_msg != nil
|
134
|
+
string = '{"error":"' + error_msg + '"}'
|
135
|
+
client.puts(string)
|
136
|
+
end
|
137
|
+
#puts msg
|
138
|
+
self.send(msg)
|
139
|
+
end
|
140
|
+
end
|
125
141
|
end
|
126
142
|
rescue => e
|
127
143
|
puts e
|
data/lib/apiotics/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apiotics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.83
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MicroArx Corporation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|