sinatra-rocketio 0.2.4 → 0.2.5

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: 5e83f8cf2d3ec769975e49a8c87cbce77e55eb02
4
- data.tar.gz: 35d737b0f6b92ee4ea41486cb262e5fc2ae8ad5f
3
+ metadata.gz: 574c09d0944df2356c86d057c1e80eb81496845b
4
+ data.tar.gz: 237b7b7762880c7e1d875dbea7e1443731ae36ec
5
5
  SHA512:
6
- metadata.gz: 1a5cd2031b22d2119780cc0eb95ce9ff85418af7c4c97f632afe89e9ead697c6a4843c21e32f61fac130791dda4e61b5818715d477ce51b4effb2f89e25dec06
7
- data.tar.gz: c16dab7e6f2ed676be4dff89180d7f9a74a3c87919fbf732f2f5c2439b1709312e2c970f38c7b7e1c4b476ee8008863847b9e1d7cfb217d290852591274e2cb1
6
+ metadata.gz: 5b05e9851fc7213cd9a486aecd761830fc1449a264d0f9a68869e4a474673e15a0d22708b054b6665515be74c2831ebd9b868e1c236a620eba8da8619cfc1c4d
7
+ data.tar.gz: 1d4f6b5018b2921baf2176b9a528fd5fd7f09255f2afcde4b844c652e8dbfa12455b2d70c455bd06f49fb4ea07b913b58a65ee25970b6693b164e49119d438a1
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.2.5 2013-05-26
2
+
3
+ * add function RocketIO::Client#wait
4
+ * enable/disable websocket by ENV["WEBSOCKET"]=disable
5
+
1
6
  === 0.2.4 2013-05-23
2
7
 
3
8
  * bugfix RocketIO start process
data/README.md CHANGED
@@ -32,7 +32,7 @@ Server Side
32
32
  require 'sinatra'
33
33
  require 'sinatra/rocketio'
34
34
  set :cometio, :timeout => 120, :post_interval => 2
35
- set :websocketio, :port => 8080
35
+ set :websocketio, :port => 5001
36
36
  set :rocketio, :websocket => true, :comet => true # enable WebSocket and Comet
37
37
 
38
38
  run Sinatra::Application
@@ -182,6 +182,18 @@ end
182
182
  ```
183
183
 
184
184
 
185
+ ### Config with ENV[]
186
+
187
+ configure with ENV variables.
188
+
189
+ % export WS_PORT=9000
190
+ % export WEBSOCKET=disable
191
+ % export COMET=enable
192
+ % bundle exec rackup config.ru #=> start sinatra app
193
+
194
+ disable comet and enable websocket on port 9000.
195
+
196
+
185
197
  Sample App
186
198
  ----------
187
199
 
@@ -11,8 +11,14 @@ module Sinatra
11
11
 
12
12
  def self.default_options
13
13
  {
14
- :comet => [true, lambda{|v| [true, false].include? v }],
15
- :websocket => [true, lambda{|v| [true, false].include? v }]
14
+ :comet => [
15
+ (ENV["COMET"].to_s =~ /^(false|disable)$/i ? false : true),
16
+ lambda{|v| [true, false].include? v }
17
+ ],
18
+ :websocket => [
19
+ (ENV["WEBSOCKET"].to_s =~ /^(false|disable)$/i ? false : true),
20
+ lambda{|v| [true, false].include? v }
21
+ ]
16
22
  }
17
23
  end
18
24
 
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module RocketIO
3
- VERSION = "0.2.4"
3
+ VERSION = "0.2.5"
4
4
  end
5
5
  end
@@ -90,6 +90,13 @@ module Sinatra
90
90
  @io.push type, data if @io
91
91
  end
92
92
 
93
+ def wait(&block)
94
+ loop do
95
+ sleep 1
96
+ yield if block_given?
97
+ end
98
+ end
99
+
93
100
  def method_missing(name, *args)
94
101
  @io.__send__ name, *args
95
102
  end
@@ -25,8 +25,8 @@ Gem::Specification.new do |gem|
25
25
  gem.add_development_dependency "httparty"
26
26
  gem.add_development_dependency "json"
27
27
 
28
- gem.add_dependency "sinatra-cometio", ">= 0.5.4"
29
- gem.add_dependency "sinatra-websocketio", ">= 0.2.9"
28
+ gem.add_dependency "sinatra-cometio", ">= 0.5.6"
29
+ gem.add_dependency "sinatra-websocketio", ">= 0.3.0"
30
30
  gem.add_dependency "sinatra"
31
31
  gem.add_dependency "eventmachine", ">= 1.0.0"
32
32
  gem.add_dependency "event_emitter", ">= 0.2.5"
data/test/app/config.ru CHANGED
@@ -6,6 +6,4 @@ $:.unshift File.expand_path '../../lib', File.dirname(__FILE__)
6
6
  require 'sinatra/rocketio'
7
7
  require File.dirname(__FILE__)+'/main'
8
8
 
9
- set :websocketio, :port => ENV['WS_PORT'].to_i
10
-
11
9
  run TestApp
data/test/test_channel.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require File.expand_path 'test_helper', File.dirname(__FILE__)
2
2
 
3
- class TestChannel < MiniTest::Unit::TestCase
3
+ class TestChannel < MiniTest::Test
4
4
 
5
5
  def test_channel
6
6
  ## client1(comet, channel "aaa") --> server --> client3(websocket, channel "aaa")
@@ -1,6 +1,6 @@
1
1
  require File.expand_path 'test_helper', File.dirname(__FILE__)
2
2
 
3
- class TestPushMultiClient < MiniTest::Unit::TestCase
3
+ class TestPushMultiClient < MiniTest::Test
4
4
 
5
5
  def test_push_multi
6
6
  ## client1(comet) --> server --> client2(comet) & client3(websocket)
@@ -1,6 +1,6 @@
1
1
  require File.expand_path 'test_helper', File.dirname(__FILE__)
2
2
 
3
- class TestRocketIO < MiniTest::Unit::TestCase
3
+ class TestRocketIO < MiniTest::Test
4
4
 
5
5
  def test_websocket_to_comet
6
6
  ## websocket --> server --> comet
@@ -1,6 +1,6 @@
1
1
  require File.expand_path 'test_helper', File.dirname(__FILE__)
2
2
 
3
- class TestSettingsIO < MiniTest::Unit::TestCase
3
+ class TestSettingsIO < MiniTest::Test
4
4
 
5
5
  def test_settings
6
6
  res = JSON.parse HTTParty.get("#{App.url}/rocketio/settings").body
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-rocketio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
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-05-22 00:00:00.000000000 Z
11
+ date: 2013-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,28 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - '>='
130
130
  - !ruby/object:Gem::Version
131
- version: 0.5.4
131
+ version: 0.5.6
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '>='
137
137
  - !ruby/object:Gem::Version
138
- version: 0.5.4
138
+ version: 0.5.6
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: sinatra-websocketio
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - '>='
144
144
  - !ruby/object:Gem::Version
145
- version: 0.2.9
145
+ version: 0.3.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - '>='
151
151
  - !ruby/object:Gem::Version
152
- version: 0.2.9
152
+ version: 0.3.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: sinatra
155
155
  requirement: !ruby/object:Gem::Requirement