sinatra-cometio 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.4.1 2013-03-24
2
+
3
+ * Sinatra::CometIO::Client#timeout = 120
4
+
1
5
  === 0.4.0 2013-03-23
2
6
 
3
7
  * rename CometIO::Client -> Sinatra::CometIO::Client
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module CometIO
3
- VERSION = '0.4.0'
3
+ VERSION = '0.4.1'
4
4
  end
5
5
  end
@@ -11,12 +11,14 @@ module Sinatra
11
11
 
12
12
  include EventEmitter
13
13
  attr_reader :url, :session
14
+ attr_accessor :timeout
14
15
 
15
16
  def initialize(url)
16
17
  raise ArgumentError, "invalid URL (#{url})" unless url.kind_of? String and url =~ /^https?:\/\/.+/
17
18
  @url = url
18
19
  @session = nil
19
20
  @running = false
21
+ @timeout = 120
20
22
  end
21
23
 
22
24
  def push(type, data)
@@ -49,7 +51,7 @@ module Sinatra
49
51
  Thread.new do
50
52
  while @running do
51
53
  begin
52
- res = HTTParty.get "#{@url}?session=#{@session}", :timeout => 120
54
+ res = HTTParty.get "#{@url}?session=#{@session}", :timeout => @timeout
53
55
  unless res.code == 200
54
56
  self.emit :error, "CometIO get error"
55
57
  sleep 10
data/sample/README.md CHANGED
@@ -15,7 +15,7 @@ Install Dependencies
15
15
  Run
16
16
  ---
17
17
 
18
- % foreman start
18
+ % rackup config.ru -p 5000
19
19
 
20
20
  => http://localhost:5000
21
21
 
@@ -6,6 +6,7 @@ require 'sinatra/cometio/client'
6
6
  name = `whoami`.strip || 'shokai'
7
7
 
8
8
  client = Sinatra::CometIO::Client.new('http://localhost:5000/cometio/io').connect
9
+ puts "timeout:#{client.timeout}"
9
10
 
10
11
  client.on :connect do |session|
11
12
  puts "connect!! (session_id:#{session})"
@@ -16,6 +16,8 @@ Gem::Specification.new do |gem|
16
16
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
17
  gem.require_paths = ["lib"]
18
18
 
19
+ gem.add_development_dependency 'bundler', '~> 1.3'
20
+ gem.add_development_dependency 'rake'
19
21
  gem.add_development_dependency 'minitest'
20
22
  gem.add_development_dependency 'thin'
21
23
  gem.add_development_dependency 'haml'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-cometio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,6 +11,38 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2013-03-23 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
14
46
  - !ruby/object:Gem::Dependency
15
47
  name: minitest
16
48
  requirement: !ruby/object:Gem::Requirement
@@ -221,12 +253,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
221
253
  - - ! '>='
222
254
  - !ruby/object:Gem::Version
223
255
  version: '0'
256
+ segments:
257
+ - 0
258
+ hash: -3631185313350720463
224
259
  required_rubygems_version: !ruby/object:Gem::Requirement
225
260
  none: false
226
261
  requirements:
227
262
  - - ! '>='
228
263
  - !ruby/object:Gem::Version
229
264
  version: '0'
265
+ segments:
266
+ - 0
267
+ hash: -3631185313350720463
230
268
  requirements: []
231
269
  rubyforge_project:
232
270
  rubygems_version: 1.8.24