conch 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/conch.gemspec +1 -1
- data/lib/client.rb +24 -0
- data/lib/conch.rb +4 -16
- metadata +2 -1
data/conch.gemspec
CHANGED
data/lib/client.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'em-websocket'
|
2
|
+
|
3
|
+
module Client
|
4
|
+
|
5
|
+
def self.run socket, cmd
|
6
|
+
socket.send `#{cmd}`
|
7
|
+
rescue
|
8
|
+
socket.send ''
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.listen_on socket
|
12
|
+
socket.onmessage { |cmd| run socket, cmd }
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.start
|
16
|
+
EM.run do
|
17
|
+
EM::WebSocket.run(
|
18
|
+
host: 'localhost',
|
19
|
+
port: 8888
|
20
|
+
) { |socket| listen_on socket }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/lib/conch.rb
CHANGED
@@ -1,20 +1,8 @@
|
|
1
|
-
|
1
|
+
require_relative 'client'
|
2
2
|
|
3
|
-
|
3
|
+
home = 'http://www.c0nch.com'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
rescue
|
8
|
-
socket.send ''
|
9
|
-
end
|
5
|
+
`start chrome --app=#{home}`
|
6
|
+
Client.start
|
10
7
|
|
11
|
-
def listen_on(socket)
|
12
|
-
socket.onmessage {|cmd| run socket, cmd}
|
13
|
-
end
|
14
8
|
|
15
|
-
EM.run do
|
16
|
-
EM::WebSocket.run(
|
17
|
-
host: 'localhost',
|
18
|
-
port: 8888
|
19
|
-
) { |socket| listen_on socket }
|
20
|
-
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- Rakefile
|
73
73
|
- bin/conch
|
74
74
|
- conch.gemspec
|
75
|
+
- lib/client.rb
|
75
76
|
- lib/conch.rb
|
76
77
|
homepage: http://www.c0nch.com
|
77
78
|
licenses:
|