em-cometio-client 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,7 @@
1
+ === 0.0.5 2013-03-16
2
+
3
+ * fix test
4
+
1
5
  === 0.0.4 2013-03-12
2
6
 
3
7
  * parse multiple data on get
@@ -1,7 +1,7 @@
1
1
  module EventMachine
2
2
  module CometIO
3
3
  class Client
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
6
6
  end
7
7
  end
@@ -3,6 +3,7 @@ require 'bundler'
3
3
  Bundler.require
4
4
  $stdout.sync = true
5
5
  require 'sinatra'
6
+ require 'sinatra/base'
6
7
  require 'sinatra/cometio'
7
8
  require File.dirname(__FILE__)+'/main'
8
9
 
@@ -3,27 +3,29 @@ File.open(pid_file, "w+") do |f|
3
3
  f.write Process.pid.to_s
4
4
  end
5
5
 
6
- class TestApp < Sinatra::Application
6
+ class TestApp < Sinatra::Base
7
+ register Sinatra::CometIO
8
+ io = Sinatra::CometIO
7
9
 
8
10
  get '/' do
9
11
  "sinatra-cometio v#{Sinatra::CometIO::VERSION}"
10
12
  end
11
13
 
12
- CometIO.on :connect do |session|
14
+ io.on :connect do |session|
13
15
  puts "new client <#{session}>"
14
16
  end
15
17
 
16
- CometIO.on :disconnect do |session|
18
+ io.on :disconnect do |session|
17
19
  puts "disconnect client <#{session}>"
18
20
  end
19
21
 
20
- CometIO.on :broadcast do |data, from|
22
+ io.on :broadcast do |data, from|
21
23
  puts from
22
24
  puts "broadcast <#{from}> - #{data.to_json}"
23
25
  push :broadcast, data
24
26
  end
25
27
 
26
- CometIO.on :message do |data, from|
28
+ io.on :message do |data, from|
27
29
  puts "message <#{from}> - #{data.to_json}"
28
30
  push :message, data, :to => data['to']
29
31
  end
@@ -1,10 +1,10 @@
1
1
  require 'rubygems'
2
+ require 'bundler/setup'
3
+ $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
2
4
  require 'minitest/autorun'
3
5
  require 'em-cometio-client'
4
6
  require File.expand_path 'app', File.dirname(__FILE__)
5
7
 
6
- $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
7
-
8
8
  ['SIGHUP', 'SIGINT', 'SIGKILL', 'SIGTERM'].each do |sig|
9
9
  Kernel.trap sig do
10
10
  App.stop
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-cometio-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-12 00:00:00.000000000 Z
12
+ date: 2013-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine