sinatra-websocketio 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +6 -0
- data/README.md +7 -3
- data/Rakefile +6 -0
- data/lib/sinatra-websocketio/version.rb +1 -1
- data/lib/sinatra/websocketio/client.rb +1 -1
- data/sinatra-websocketio.gemspec +1 -0
- data/test/app.rb +3 -34
- data/test/app/config.ru +0 -2
- data/test/app/main.rb +0 -5
- data/test/test_helper.rb +0 -7
- data/test/test_websocketio.rb +0 -8
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aeb86ceb60a32d99a1a13cd3b6e88b2d76995d5
|
4
|
+
data.tar.gz: 156c9919c8e5511b6699371e9055ea05e2a8861b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e6ab780c22189e92198d65e485886b6c46f5443bc5b59b9d386f7eaa3fd0262d738b6499b3c8d9b5092923b6abfb450bcfdee1bfd65cb84385eaf3e149642b8
|
7
|
+
data.tar.gz: f9c019deadfde5e9745cdffdf32b960ecc1eb14c3039da6f040ec35e2f32fbdfc442ec3fdccc8c9985e10f53fec0d3b6ae1f26bbd09c30d86dc1d5d7599316b7
|
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -181,9 +181,13 @@ Test
|
|
181
181
|
|
182
182
|
% gem install bundler
|
183
183
|
% bundle install
|
184
|
-
|
185
|
-
|
186
|
-
|
184
|
+
|
185
|
+
start server
|
186
|
+
|
187
|
+
% rake test_server
|
188
|
+
|
189
|
+
run test
|
190
|
+
|
187
191
|
% rake test
|
188
192
|
|
189
193
|
|
data/Rakefile
CHANGED
data/sinatra-websocketio.gemspec
CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.description = %q{WebSocket component for Sinatra RocketIO}
|
11
11
|
gem.summary = gem.description
|
12
12
|
gem.homepage = "https://github.com/shokai/sinatra-websocketio"
|
13
|
+
gem.license = "MIT"
|
13
14
|
|
14
15
|
gem.files = `git ls-files`.split($/).reject{|i| i=="Gemfile.lock" }
|
15
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/test/app.rb
CHANGED
@@ -16,46 +16,15 @@ class App
|
|
16
16
|
"ws://localhost:#{ws_port}"
|
17
17
|
end
|
18
18
|
|
19
|
-
def self.pid_file
|
20
|
-
ENV['PID_FILE'] || "/tmp/sinatra-websocketio-testapp.pid"
|
21
|
-
end
|
22
|
-
|
23
19
|
def self.app_dir
|
24
20
|
File.expand_path 'app', File.dirname(__FILE__)
|
25
21
|
end
|
26
22
|
|
27
|
-
def self.pid
|
28
|
-
return unless @running
|
29
|
-
File.open(pid_file) do |f|
|
30
|
-
pid = f.gets.strip.to_i
|
31
|
-
return pid if pid > 0
|
32
|
-
end
|
33
|
-
return
|
34
|
-
end
|
35
|
-
|
36
23
|
def self.start
|
37
|
-
return if
|
38
|
-
File.delete pid_file if File.exists? pid_file
|
39
|
-
Thread.new do
|
40
|
-
IO::popen "cd #{app_dir} && PID_FILE=#{pid_file} WS_PORT=#{ws_port} rackup config.ru -p #{port} > /dev/null 2>&1"
|
41
|
-
end
|
24
|
+
return if running
|
42
25
|
@running = true
|
43
|
-
|
44
|
-
|
45
|
-
sleep 1
|
46
|
-
return true
|
47
|
-
end
|
48
|
-
sleep 0.1
|
49
|
-
end
|
50
|
-
@running = false
|
51
|
-
return false
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.stop
|
55
|
-
return unless @running
|
56
|
-
system "kill #{pid}"
|
57
|
-
File.delete pid_file if File.exists? pid_file
|
58
|
-
@running = false
|
26
|
+
cmd = "cd #{app_dir} && WS_PORT=#{ws_port} rackup config.ru -p #{port}"
|
27
|
+
system cmd
|
59
28
|
end
|
60
29
|
|
61
30
|
end
|
data/test/app/config.ru
CHANGED
data/test/app/main.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -4,10 +4,3 @@ $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
|
|
4
4
|
require 'minitest/autorun'
|
5
5
|
require 'sinatra/websocketio/client'
|
6
6
|
require File.expand_path 'app', File.dirname(__FILE__)
|
7
|
-
|
8
|
-
|
9
|
-
['SIGHUP', 'SIGINT', 'SIGKILL', 'SIGTERM'].each do |sig|
|
10
|
-
Kernel.trap sig do
|
11
|
-
App.stop
|
12
|
-
end
|
13
|
-
end
|
data/test/test_websocketio.rb
CHANGED
@@ -2,14 +2,6 @@ require File.expand_path 'test_helper', File.dirname(__FILE__)
|
|
2
2
|
|
3
3
|
class TestWebSocketIO < MiniTest::Test
|
4
4
|
|
5
|
-
def setup
|
6
|
-
App.start
|
7
|
-
end
|
8
|
-
|
9
|
-
def teardown
|
10
|
-
App.stop
|
11
|
-
end
|
12
|
-
|
13
5
|
def test_simple
|
14
6
|
res = nil
|
15
7
|
post_data = {:time => Time.now.to_s, :msg => 'hello!!'}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-websocketio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Hashimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -245,7 +245,8 @@ files:
|
|
245
245
|
- test/test_helper.rb
|
246
246
|
- test/test_websocketio.rb
|
247
247
|
homepage: https://github.com/shokai/sinatra-websocketio
|
248
|
-
licenses:
|
248
|
+
licenses:
|
249
|
+
- MIT
|
249
250
|
metadata: {}
|
250
251
|
post_install_message:
|
251
252
|
rdoc_options: []
|