conch 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/conch.gemspec +1 -1
  2. data/lib/client.rb +24 -0
  3. data/lib/conch.rb +4 -16
  4. metadata +2 -1
data/conch.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'conch'
3
- s.version = '0.0.5'
3
+ s.version = '0.0.6'
4
4
  s.summary = 'shell in the browser'
5
5
  s.authors = ['limadelic']
6
6
  s.email = 'limadelic@gmail.com'
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
- require 'em-websocket'
1
+ require_relative 'client'
2
2
 
3
- `start www.c0nch.com`
3
+ home = 'http://www.c0nch.com'
4
4
 
5
- def run(socket, cmd)
6
- socket.send `#{cmd}`
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.5
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: