em-websocketio-client 0.0.3 → 0.0.4

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: 8534916661595829b6f14ecaa8fa29ee8a7d8108
4
- data.tar.gz: 8422f6f5e1bce8f06cac2f5692adf7005196476b
3
+ metadata.gz: 2d06291870ec93d17dc9417ed93f06321c850d01
4
+ data.tar.gz: 788550881b480d534b0ced4c709fa00c181dcf15
5
5
  SHA512:
6
- metadata.gz: 1efcaa9a6b87760a1a471ab6268a017122a482f3b35069d464bd6834227fa26f87d7c8509342ced0fdcff32071fb3103ebf037a290408a8c976dc2bdb11ee2d3
7
- data.tar.gz: 715adacd26221cfc6d9185c27e9408b087a4cdd80b3673e199a526f3769c23d421d9a6efb148cba6c962b708f1331da900114cb5ccea4dc40a10f195a3bd6d65
6
+ metadata.gz: 0ea2f6e5fbd88be250e8641abf6215c6a396ba5e62612a79b5ec135faccfc06a16e77db46948cb2a6a892dbe881fc67acb961a0f3b181e132522ebc1966fb14f
7
+ data.tar.gz: 20b995fbfa2bfeb2499fe18020fbc15f5b1505b1d28afd378c10324f643d6f05972147e9b9adfc3446ef19173139a66a71b15fb1e6ef05d34822617b826951c7
@@ -1,3 +1,7 @@
1
+ === 0.0.4 2013-10-14
2
+
3
+ * update for em-websocket-client v0.1.2
4
+
1
5
  === 0.0.3 2013-08-02
2
6
 
3
7
  * fix default websocket port 8080 -> 9000
data/README.md CHANGED
@@ -68,10 +68,14 @@ Test
68
68
 
69
69
  % gem install bundler
70
70
  % bundle install
71
- % export PORT=5000
72
- % export WS_PORT=9000
73
- % export PID_FILE=/tmp/em-websocketio-client-testapp.pid
74
- % rake test
71
+
72
+ start test server
73
+
74
+ % bundle exec rake test_server
75
+
76
+ run test
77
+
78
+ % bundle exec rake test
75
79
 
76
80
 
77
81
  Contributing
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
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "sinatra-websocketio"
25
25
  spec.add_development_dependency "thin"
26
26
 
27
- spec.add_dependency "em-websocket-client"
27
+ spec.add_dependency "em-websocket-client", "0.1.2"
28
28
  spec.add_dependency "eventmachine"
29
29
  spec.add_dependency "event_emitter"
30
30
  spec.add_dependency "json"
@@ -23,7 +23,7 @@ module EventMachine
23
23
  @running = true
24
24
 
25
25
  @ws.stream do |msg|
26
- data = JSON.parse msg
26
+ data = JSON.parse msg.data
27
27
  self.emit data['type'], data['data']
28
28
  end
29
29
 
@@ -1,7 +1,7 @@
1
1
  module EventMachine
2
2
  module WebSocketIO
3
3
  class Client
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
6
6
  end
7
7
  end
@@ -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/em-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
@@ -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
@@ -2,14 +2,6 @@ require File.expand_path 'test_helper', File.dirname(__FILE__)
2
2
 
3
3
  class TestEmWebSocketIOClient < 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
  post_data = {:time => Time.now.to_s, :msg => 'hello!!'}
15
7
  res = nil
@@ -4,12 +4,3 @@ $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
4
4
  require 'minitest/autorun'
5
5
  require 'em-websocketio-client'
6
6
  require File.expand_path 'app', File.dirname(__FILE__)
7
-
8
- ['SIGHUP', 'SIGINT', 'SIGKILL', 'SIGTERM'].each do |sig|
9
- Kernel.trap sig do
10
- App.stop
11
- EM::add_timer do
12
- EM::stop
13
- end
14
- end
15
- end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-websocketio-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
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-08-02 00:00:00.000000000 Z
11
+ date: 2013-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: em-websocket-client
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 0.1.2
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 0.1.2
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: eventmachine
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  version: '0'
180
180
  requirements: []
181
181
  rubyforge_project:
182
- rubygems_version: 2.0.5
182
+ rubygems_version: 2.1.5
183
183
  signing_key:
184
184
  specification_version: 4
185
185
  summary: Sinatra WebSocketIO client for eventmachine