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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c6c4b999cc5f41c0d7b92d13210c4ffe23c4d00
4
- data.tar.gz: 4e242742fecca0a5fb5559ff3474221c6c134582
3
+ metadata.gz: 2aeb86ceb60a32d99a1a13cd3b6e88b2d76995d5
4
+ data.tar.gz: 156c9919c8e5511b6699371e9055ea05e2a8861b
5
5
  SHA512:
6
- metadata.gz: f2ef63db595352e7ea52a40e7798e4317e298502a30921ff033333b9b6977da2a4e54fd10a026dd2034d88d391f05d5984aaf3246f923d09242ae622cad1d8e5
7
- data.tar.gz: a579d3cccba11b9cd7a5ebb9b29a31809e774cdbbeb7097b2147b0c29a970da52c32d22ec07ba1e290436bab81bce9b470f92152503e3317c1dd7f77a300ad19
6
+ metadata.gz: 9e6ab780c22189e92198d65e485886b6c46f5443bc5b59b9d386f7eaa3fd0262d738b6499b3c8d9b5092923b6abfb450bcfdee1bfd65cb84385eaf3e149642b8
7
+ data.tar.gz: f9c019deadfde5e9745cdffdf32b960ecc1eb14c3039da6f040ec35e2f32fbdfc442ec3fdccc8c9985e10f53fec0d3b6ae1f26bbd09c30d86dc1d5d7599316b7
@@ -1,3 +1,9 @@
1
+ === 0.4.0 2013-10-05
2
+
3
+ * MIT License
4
+ * bugfix ruby-client
5
+ * fix tests
6
+
1
7
  === 0.4.0 2013-10-04
2
8
 
3
9
  * bugfix of message push
data/README.md CHANGED
@@ -181,9 +181,13 @@ Test
181
181
 
182
182
  % gem install bundler
183
183
  % bundle install
184
- % export PORT=5000
185
- % export WS_PORT=9000
186
- % export PID_FILE=/tmp/sinatra-websocketio-test.pid
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
@@ -6,3 +6,9 @@ Rake::TestTask.new do |t|
6
6
  end
7
7
 
8
8
  task :default => :test
9
+
10
+ desc "Start test server"
11
+ task :test_server do
12
+ require File.expand_path 'test/app', File.dirname(__FILE__)
13
+ App.start
14
+ end
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module WebSocketIO
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
@@ -85,7 +85,7 @@ module Sinatra
85
85
 
86
86
  def close
87
87
  @running = false
88
- @websocket.close
88
+ @websocket.close if @websocket
89
89
  end
90
90
 
91
91
  def push(type, data)
@@ -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) }
@@ -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 @running
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
- 100.times do
44
- if File.exists? pid_file
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
@@ -6,6 +6,4 @@ $:.unshift File.expand_path '../../lib', File.dirname(__FILE__)
6
6
  require 'sinatra/websocketio'
7
7
  require File.dirname(__FILE__)+'/main'
8
8
 
9
- set :websocketio, :port => ENV['WS_PORT'].to_i
10
-
11
9
  run TestApp
@@ -1,8 +1,3 @@
1
- pid_file = ENV['PID_FILE'] || "/tmp/sinatra-websocketio-test-pid"
2
- File.open(pid_file, "w+") do |f|
3
- f.write Process.pid.to_s
4
- end
5
-
6
1
  class TestApp < Sinatra::Base
7
2
  register Sinatra::WebSocketIO
8
3
  io = Sinatra::WebSocketIO
@@ -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
@@ -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.0
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-04 00:00:00.000000000 Z
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: []