ws-io 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/VERSION +1 -1
  2. data/bin/ws-irb +7 -1
  3. data/lib/ws-io.rb +9 -15
  4. data/ws-io.gemspec +5 -2
  5. metadata +22 -11
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.3
1
+ 1.1.4
data/bin/ws-irb CHANGED
@@ -2,8 +2,14 @@
2
2
  $:.unshift File.dirname(__FILE__) + "/../lib"
3
3
  require "ws-io"
4
4
  require 'irb'
5
+ require 'optparse'
5
6
 
6
- WsIo.start {
7
+ port = 8080
8
+ opt = OptionParser.new
9
+ opt.on('-p PORT') {|v| port = v }
10
+ opt.parse!(ARGV)
11
+
12
+ WsIo.start(port) {
7
13
  IRB.start
8
14
  }.after {
9
15
  WsIo.ws.send(
data/lib/ws-io.rb CHANGED
@@ -20,6 +20,7 @@ class WsIo
20
20
 
21
21
  fake_io
22
22
 
23
+ Thread.abort_on_exception = true
23
24
  m = Mutex.new
24
25
  c = ConditionVariable.new
25
26
 
@@ -39,10 +40,8 @@ class WsIo
39
40
  end # #### #### ## ## ## ## ## ## ####
40
41
  stop_server # ## ### ## ## ## ## ###### ### ##
41
42
  end # ## ## ## ## ## ## ## ##
42
- rescue => e # ## ## ## ## ## ## ## ## ####
43
- g e # ## ## ####### ## ######## ## ## ####
44
- end #
45
- end #
43
+ end # ## ## ## ## ## ## ## ## ####
44
+ end # ## ## ####### ## ######## ## ## ####
46
45
  #
47
46
  Thread.start do #
48
47
  m.synchronize { c.wait(m) } # <###
@@ -70,16 +69,6 @@ class WsIo
70
69
  end
71
70
 
72
71
  self
73
- rescue SignalException, StandardError => e
74
- g e
75
- unfake_io
76
- stop_server
77
- raise
78
- rescue Exception => e
79
- g e
80
- unfake_io
81
- stop_server
82
- raise
83
72
  end
84
73
 
85
74
  def after(&block)
@@ -89,6 +78,11 @@ class WsIo
89
78
 
90
79
  def join
91
80
  @server_thread.join if @server_thread
81
+ rescue Exception => e
82
+ g e
83
+ rescue
84
+ unfake_io
85
+ stop_server
92
86
  end
93
87
 
94
88
  def open
@@ -129,7 +123,7 @@ class WsIo
129
123
 
130
124
  def stop_server
131
125
  ws.close
132
- @server.tcp_server.close
126
+ @server.tcp_server.close unless @server.tcp_server.closed?
133
127
  g 'stop_server'
134
128
  rescue => e
135
129
  g e
data/ws-io.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ws-io}
8
- s.version = "1.1.3"
8
+ s.version = "1.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jugyo"]
12
- s.date = %q{2011-02-10}
12
+ s.date = %q{2011-02-17}
13
13
  s.default_executable = %q{ws-irb}
14
14
  s.description = %q{It provides a bridge between WebSocket and IO}
15
15
  s.email = %q{jugyo.org@gmail.com}
@@ -53,12 +53,14 @@ Gem::Specification.new do |s|
53
53
 
54
54
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
55
  s.add_runtime_dependency(%q<web-socket-ruby>, ["~> 0.1.0"])
56
+ s.add_runtime_dependency(%q<launchy>, [">= 0"])
56
57
  s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
57
58
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
58
59
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
59
60
  s.add_development_dependency(%q<rcov>, [">= 0"])
60
61
  else
61
62
  s.add_dependency(%q<web-socket-ruby>, ["~> 0.1.0"])
63
+ s.add_dependency(%q<launchy>, [">= 0"])
62
64
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
63
65
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
64
66
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
@@ -66,6 +68,7 @@ Gem::Specification.new do |s|
66
68
  end
67
69
  else
68
70
  s.add_dependency(%q<web-socket-ruby>, ["~> 0.1.0"])
71
+ s.add_dependency(%q<launchy>, [">= 0"])
69
72
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
70
73
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
71
74
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ws-io
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.3
5
+ version: 1.1.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - jugyo
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-10 00:00:00 +09:00
13
+ date: 2011-02-17 00:00:00 +09:00
14
14
  default_executable: ws-irb
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -25,8 +25,19 @@ dependencies:
25
25
  prerelease: false
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
28
+ name: launchy
29
29
  requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: rspec
40
+ requirement: &id003 !ruby/object:Gem::Requirement
30
41
  none: false
31
42
  requirements:
32
43
  - - ~>
@@ -34,10 +45,10 @@ dependencies:
34
45
  version: 2.3.0
35
46
  type: :development
36
47
  prerelease: false
37
- version_requirements: *id002
48
+ version_requirements: *id003
38
49
  - !ruby/object:Gem::Dependency
39
50
  name: bundler
40
- requirement: &id003 !ruby/object:Gem::Requirement
51
+ requirement: &id004 !ruby/object:Gem::Requirement
41
52
  none: false
42
53
  requirements:
43
54
  - - ~>
@@ -45,10 +56,10 @@ dependencies:
45
56
  version: 1.0.0
46
57
  type: :development
47
58
  prerelease: false
48
- version_requirements: *id003
59
+ version_requirements: *id004
49
60
  - !ruby/object:Gem::Dependency
50
61
  name: jeweler
51
- requirement: &id004 !ruby/object:Gem::Requirement
62
+ requirement: &id005 !ruby/object:Gem::Requirement
52
63
  none: false
53
64
  requirements:
54
65
  - - ~>
@@ -56,10 +67,10 @@ dependencies:
56
67
  version: 1.5.2
57
68
  type: :development
58
69
  prerelease: false
59
- version_requirements: *id004
70
+ version_requirements: *id005
60
71
  - !ruby/object:Gem::Dependency
61
72
  name: rcov
62
- requirement: &id005 !ruby/object:Gem::Requirement
73
+ requirement: &id006 !ruby/object:Gem::Requirement
63
74
  none: false
64
75
  requirements:
65
76
  - - ">="
@@ -67,7 +78,7 @@ dependencies:
67
78
  version: "0"
68
79
  type: :development
69
80
  prerelease: false
70
- version_requirements: *id005
81
+ version_requirements: *id006
71
82
  description: It provides a bridge between WebSocket and IO
72
83
  email: jugyo.org@gmail.com
73
84
  executables:
@@ -109,7 +120,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
120
  requirements:
110
121
  - - ">="
111
122
  - !ruby/object:Gem::Version
112
- hash: 1945173680197557230
123
+ hash: 4513446448000690900
113
124
  segments:
114
125
  - 0
115
126
  version: "0"