reel 0.3.0 → 0.4.0.pre

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of reel might be problematic. Click here for more details.

checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2e1a822cd1a5dff03e573f0220f40e9c0990ebd7
4
+ data.tar.gz: a560a182cfede95adaf56b9e7adadb51871cc0b2
5
+ SHA512:
6
+ metadata.gz: bf75fd111a422d070f574895cd2866e515e6645daab72f2bd654562af56419140826aaec4695f5f7a4c58d115ac4ae5025af74b2a3d4d06aead1134c9bb76ef9
7
+ data.tar.gz: a126435e2b5c33a7256ad8ecd9e3aed5396b3a791a88d6dd643f134e9c06869b369a8bba52cb710e4a01e9bf556dc485421d55a1b45da5960c7beab9ee5921bf
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service-name: travis-pro
data/.travis.yml CHANGED
@@ -1,9 +1,15 @@
1
1
  rvm:
2
2
  - 1.9.3
3
+ - 2.0.0
3
4
  - ruby-head
4
5
  - jruby-19mode
5
6
  - jruby-head
6
7
  - rbx-19mode
7
8
 
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
12
+ - rvm: jruby-head
13
+
8
14
  notifications:
9
15
  irc: "irc.freenode.org#celluloid"
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ HEAD
2
+ ----
3
+ * Remove on_error callback system
4
+
1
5
  0.3.0
2
6
  -----
3
7
  * Reel::App: Sinatra-like DSL for defining Reel apps using Octarine
data/Gemfile CHANGED
@@ -1,8 +1,10 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'celluloid', github: 'celluloid/celluloid', branch: 'master'
4
+ gem 'celluloid-io', github: 'celluloid/celluloid-io', branch: 'master'
2
5
 
3
- gem 'celluloid', :git => 'https://github.com/celluloid/celluloid.git'
4
- gem 'celluloid-io', :git => 'https://github.com/celluloid/celluloid-io.git'
5
6
  gem 'jruby-openssl' if defined? JRUBY_VERSION
7
+ gem 'coveralls', require: false
6
8
 
7
9
  # Specify your gem's dependencies in reel.gemspec
8
10
  gemspec
data/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  ![Reel](https://github.com/celluloid/reel/raw/master/logo.png)
2
2
  =======
3
+ [![Gem Version](https://badge.fury.io/rb/reel.png)](http://rubygems.org/gems/reel)
3
4
  [![Build Status](https://secure.travis-ci.org/celluloid/reel.png?branch=master)](http://travis-ci.org/celluloid/reel)
4
5
  [![Dependency Status](https://gemnasium.com/celluloid/reel.png)](https://gemnasium.com/celluloid/reel)
5
- [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/celluloid/reel)
6
+ [![Code Climate](https://codeclimate.com/github/celluloid/reel.png)](https://codeclimate.com/github/celluloid/reel)
7
+ [![Coverage Status](https://coveralls.io/repos/celluloid/reel/badge.png?branch=master)](https://coveralls.io/r/celluloid/reel)
8
+
9
+ > "A dizzying lifetime... Reeling by on Celluloid" _-- Rush / Between The Wheels_
6
10
 
7
11
  Reel is a fast, non-blocking "evented" web server built on [http_parser.rb][parser],
8
12
  [websocket_parser][websockets], [Celluloid::IO][celluloidio], and [nio4r][nio4r]. Thanks
@@ -83,6 +87,8 @@ Reel::Server.supervise("0.0.0.0", 3000) do |connection|
83
87
  end
84
88
  end
85
89
  end
90
+
91
+ sleep
86
92
  ```
87
93
 
88
94
  When we read a request from the incoming connection, we'll either get back
@@ -166,6 +172,12 @@ MyApp = Webmachine::Application.new do |app|
166
172
  config.ip = MYAPP_IP
167
173
  config.port = MYAPP_PORT
168
174
  config.adapter = :Reel
175
+
176
+ # Optional: (WM master only) handler for incoming websockets
177
+ config.adapter_options[:websocket_handler] = proc do |websocket|
178
+ # socket is a Reel::WebSocket
179
+ socket << "hello, world"
180
+ end
169
181
  end
170
182
  end
171
183
 
data/bin/reel CHANGED
@@ -3,7 +3,9 @@
3
3
  require 'reel'
4
4
  require 'optparse'
5
5
 
6
- options = {}
6
+ options = {
7
+ rackup: "config.ru"
8
+ }
7
9
 
8
10
  parser = OptionParser.new do |opts|
9
11
  opts.on "-p", "--port PORT", Integer,
@@ -43,10 +45,14 @@ parser.on_tail "-h", "--help", "Show help" do
43
45
  exit 1
44
46
  end
45
47
 
46
- parser.parse(ARGV)
48
+ parser.parse!(ARGV)
47
49
 
48
50
  if ARGV.last =~ /\.ru$/
49
- options[:rackup] = @argv.shift
51
+ options[:rackup] = ARGV.shift
52
+ end
53
+
54
+ unless File.exists?(options[:rackup])
55
+ abort "No rackup found at #{options[:rackup]}"
50
56
  end
51
57
 
52
58
  handler = Rack::Handler::Reel.new(options)
@@ -1,6 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'reel'
4
+ require 'celluloid/autostart'
4
5
 
5
6
 
6
7
  class RoundtripServer
@@ -1,37 +1,54 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'reel'
4
+ require 'reel/app'
4
5
 
5
- Connections = []
6
- Body = DATA.read
7
- app = Rack::Builder.new do
8
- map '/' do
9
- run lambda { |env|
10
- [200, {'Content-Type' => 'text/html'}, [Body]]
11
- }
6
+ class ServerSideEvents
7
+ include Reel::App
8
+
9
+ def initialize(host, port)
10
+ super
11
+ @connections = []
12
+ @body = DATA.read
12
13
  end
13
14
 
14
- map '/subscribe' do
15
- run lambda { |env|
16
- body = Reel::EventStream.new do |socket|
17
- Connections << socket
18
- socket.on_error { Connections.delete socket }
19
- end
20
- [200, {'Content-Type' => 'text/event-stream'}, body]
21
- }
15
+ get '/' do
16
+ [200, {'Content-Type' => 'text/html'}, @body]
17
+ end
18
+
19
+ get '/subscribe' do
20
+ Celluloid.logger.info "subscribing a client"
21
+ body = Reel::EventStream.new do |socket|
22
+ @connections << socket
23
+ end
24
+ Celluloid.logger.info "subscribing a client"
25
+ [200, {'Content-Type' => 'text/event-stream'}, body]
26
+ end
27
+
28
+ get '/wall/:rest' do |request|
29
+ deliver request.path.rest
30
+ end
31
+
32
+ get '/wall' do
33
+ deliver Time.now.to_s
22
34
  end
23
35
 
24
- map '/wall' do
25
- run lambda { |env|
26
- msg = env['PATH_INFO'].gsub(/\/+/, '').strip
27
- msg = Time.now if msg.empty?
28
- Connections.each { |s| s.data msg }
29
- [200, {'Content-Type' => 'text/html'}, ["Sent \"#{msg}\" to #{Connections.size} clients"]]
30
- }
36
+ def deliver(msg)
37
+ Celluloid.logger.info "sending a message to clients: #{msg.inspect}"
38
+ @connections.each do |s|
39
+ begin
40
+ s.data(msg)
41
+ rescue SocketError
42
+ @connections.delete(s)
43
+ end
44
+ end
45
+
46
+ [200, {'Content-Type' => 'text/html'}, "Sent \"#{msg}\" to #{@connections.size} clients"]
31
47
  end
32
- end.to_app
48
+ end
33
49
 
34
- Rack::Handler::Reel.run app, Port: 9292
50
+ ServerSideEvents.new("0.0.0.0", 9292)
51
+ sleep
35
52
 
36
53
  __END__
37
54
  <!doctype html>
data/examples/stream.rb CHANGED
@@ -1,26 +1,28 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'reel'
4
+ require 'reel/app'
4
5
 
5
- app = Rack::Builder.new do
6
- map '/' do
7
- run lambda { |env|
8
- body = Reel::Stream.new do |body|
9
- # sending a payload to make sure browsers will render chunks as received
10
- body << "<html>#{' '*1024}\n"
11
- ('A'..'Z').each do |l|
12
- body << "<div>#{l}</div>\n"
13
- sleep 0.5
14
- end
15
- body << "</html>\n"
16
- body.finish
6
+ class Streamer
7
+ include Reel::App
8
+
9
+ get '/' do
10
+ body = Reel::Stream.new do |body|
11
+ # sending a payload to make sure browsers will render chunks as received
12
+ body << "<html>#{' '*1024}\n"
13
+ ('A'..'Z').each do |l|
14
+ body << "<div>#{l}</div>\n"
15
+ sleep 0.5
17
16
  end
18
- [200, {
19
- 'Transfer-Encoding' => 'identity',
20
- 'Content-Type' => 'text/html'
21
- }, body]
22
- }
17
+ body << "</html>\n"
18
+ body.finish
19
+ end
20
+ [200, {
21
+ 'Transfer-Encoding' => 'identity',
22
+ 'Content-Type' => 'text/html'
23
+ }, body]
23
24
  end
24
- end.to_app
25
+ end
25
26
 
26
- Rack::Handler::Reel.run app, Port: 9292
27
+ Streamer.new("0.0.0.0", 9292)
28
+ sleep
@@ -14,10 +14,15 @@ app = Rack::Builder.new do
14
14
  map '/subscribe' do
15
15
  run lambda { |env|
16
16
  if socket = env['rack.websocket']
17
+
17
18
  socket.on_message do |m|
18
- socket << "Server got \"#{m}\" message"
19
+ begin
20
+ socket << 'Server got "%s" message' % m
21
+ rescue => SocketError
22
+ Connections.delete(socket)
23
+ end
19
24
  end
20
- socket.on_error { Connections.delete socket }
25
+
21
26
  Connections << socket
22
27
  socket.read_every 1
23
28
  end
@@ -29,7 +34,15 @@ app = Rack::Builder.new do
29
34
  run lambda { |env|
30
35
  msg = env['PATH_INFO'].gsub(/\/+/, '').strip
31
36
  msg = Time.now if msg.empty?
32
- Connections.each { |s| s << msg }
37
+
38
+ Connections.each do |s|
39
+ begin
40
+ s << msg
41
+ rescue => SocketError
42
+ Connections.delete(s)
43
+ end
44
+ end
45
+
33
46
  [200, {'Content-Type' => 'text/html'}, ["Sent \"#{msg}\" to #{Connections.size} clients"]]
34
47
  }
35
48
  end
@@ -1,6 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'reel'
4
+ require 'celluloid/autostart'
4
5
 
5
6
  class TimeServer
6
7
  include Celluloid
@@ -1,6 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'reel'
4
+ require 'celluloid/autostart'
4
5
 
5
6
  class TimeServer
6
7
  include Celluloid
@@ -47,6 +47,12 @@ module Rack
47
47
  sleep
48
48
  end
49
49
 
50
+ def stop
51
+ Celluloid::Actor[:reel_server].terminate!
52
+ Celluloid::Actor[:reel_rack_pool].terminate!
53
+ exit
54
+ end
55
+
50
56
  def [](option)
51
57
  @options[option]
52
58
  end
data/lib/reel.rb CHANGED
@@ -2,12 +2,13 @@ require 'uri'
2
2
 
3
3
  require 'http/parser'
4
4
  require 'http'
5
+
6
+ require 'celluloid/autostart'
5
7
  require 'celluloid/io'
6
8
 
7
9
  require 'reel/version'
8
10
 
9
11
  require 'reel/mixins'
10
-
11
12
  require 'reel/connection'
12
13
  require 'reel/logger'
13
14
  require 'reel/request'
@@ -36,4 +37,5 @@ module Reel
36
37
 
37
38
  # The method given was not understood
38
39
  class UnsupportedMethodError < ArgumentError; end
40
+
39
41
  end
data/lib/reel/app.rb CHANGED
@@ -17,7 +17,8 @@ module Reel
17
17
  @server = Reel::Server.supervise(host, port) do |connection|
18
18
  while request = connection.request
19
19
  status, headers, body = call Rack::MockRequest.env_for(request.url, :method => request.method, :input => request.body)
20
- connection.respond status_symbol(status), headers, body.to_s
20
+ response_klass = body.is_a?(Stream) ? StreamResponse : Response
21
+ connection.respond(response_klass.new(status_symbol(status), headers, body))
21
22
  end
22
23
  end
23
24
  end
@@ -27,7 +28,7 @@ module Reel
27
28
  end
28
29
 
29
30
  def terminate
30
- @server.terminate
31
+ @server.terminate if @server
31
32
  end
32
33
  end
33
34
  end
@@ -15,7 +15,7 @@ module Reel
15
15
  attr_reader :socket, :parser
16
16
 
17
17
  # Attempt to read this much data
18
- BUFFER_SIZE = 4096
18
+ BUFFER_SIZE = 16384
19
19
 
20
20
  def initialize(socket)
21
21
  @attached = true
data/lib/reel/mixins.rb CHANGED
@@ -1,57 +1,59 @@
1
- module HTTPVersionsMixin
1
+ module Reel
2
+ module HTTPVersionsMixin
2
3
 
3
- HTTP_VERSION_1_0 = '1.0'.freeze
4
- HTTP_VERSION_1_1 = '1.1'.freeze
5
- DEFAULT_HTTP_VERSION = HTTP_VERSION_1_1
6
- end
4
+ HTTP_VERSION_1_0 = '1.0'.freeze
5
+ HTTP_VERSION_1_1 = '1.1'.freeze
6
+ DEFAULT_HTTP_VERSION = HTTP_VERSION_1_1
7
+ end
7
8
 
8
- module ConnectionMixin
9
+ module ConnectionMixin
9
10
 
10
- # Obtain the IP address of the remote connection
11
- def remote_ip
12
- @socket.peeraddr(false)[3]
13
- end
14
- alias_method :remote_addr, :remote_ip
11
+ # Obtain the IP address of the remote connection
12
+ def remote_ip
13
+ @socket.peeraddr(false)[3]
14
+ end
15
+ alias_method :remote_addr, :remote_ip
15
16
 
16
- # Obtain the hostname of the remote connection
17
- def remote_host
18
- # NOTE: Celluloid::IO does not yet support non-blocking reverse DNS
19
- @socket.peeraddr(true)[2]
17
+ # Obtain the hostname of the remote connection
18
+ def remote_host
19
+ # NOTE: Celluloid::IO does not yet support non-blocking reverse DNS
20
+ @socket.peeraddr(true)[2]
21
+ end
20
22
  end
21
- end
22
23
 
23
- module RequestMixin
24
+ module RequestMixin
24
25
 
25
- def method
26
- @http_parser.http_method
27
- end
26
+ def method
27
+ @http_parser.http_method
28
+ end
28
29
 
29
- def headers
30
- @http_parser.headers
31
- end
30
+ def headers
31
+ @http_parser.headers
32
+ end
32
33
 
33
- def [] header
34
- headers[header]
35
- end
34
+ def [] header
35
+ headers[header]
36
+ end
36
37
 
37
- def version
38
- @http_parser.http_version || HTTPVersionsMixin::DEFAULT_HTTP_VERSION
39
- end
38
+ def version
39
+ @http_parser.http_version || HTTPVersionsMixin::DEFAULT_HTTP_VERSION
40
+ end
40
41
 
41
- def url
42
- @http_parser.url
43
- end
42
+ def url
43
+ @http_parser.url
44
+ end
44
45
 
45
- def uri
46
- @uri ||= URI(url)
47
- end
46
+ def uri
47
+ @uri ||= URI(url)
48
+ end
48
49
 
49
- def path
50
- @http_parser.request_path
51
- end
50
+ def path
51
+ @http_parser.request_path
52
+ end
52
53
 
53
- def query_string
54
- @http_parser.query_string
55
- end
54
+ def query_string
55
+ @http_parser.query_string
56
+ end
56
57
 
58
+ end
57
59
  end
data/lib/reel/response.rb CHANGED
@@ -103,7 +103,7 @@ module Reel
103
103
  end
104
104
  private :render_header
105
105
 
106
- def canonicalize_headers headers
106
+ def canonicalize_headers(headers)
107
107
  headers.inject({}) do |headers, (header, value)|
108
108
  headers.merge Http.canonicalize_header(header) => value.to_s
109
109
  end.freeze
data/lib/reel/server.rb CHANGED
@@ -2,19 +2,24 @@ module Reel
2
2
  class Server
3
3
  include Celluloid::IO
4
4
 
5
+ # How many connections to backlog in the TCP accept queue
6
+ DEFAULT_BACKLOG = 100
7
+
5
8
  # FIXME: remove respond_to? check after Celluloid 1.0
6
9
  finalizer :finalize if respond_to?(:finalizer)
7
10
 
8
- def initialize(host, port, &callback)
11
+ def initialize(host, port, backlog = DEFAULT_BACKLOG, &callback)
9
12
  # This is actually an evented Celluloid::IO::TCPServer
10
13
  @server = TCPServer.new(host, port)
11
- @server.listen(1024)
14
+ @server.listen(backlog)
12
15
  @callback = callback
13
16
  async.run
14
17
  end
15
18
 
19
+ execute_block_on_receiver :initialize
20
+
16
21
  def finalize
17
- @server.close
22
+ @server.close if @server
18
23
  end
19
24
 
20
25
  def run
data/lib/reel/stream.rb CHANGED
@@ -1,31 +1,27 @@
1
1
  module Reel
2
2
  class Stream
3
-
4
- def initialize &proc
3
+ def initialize(&proc)
5
4
  @proc = proc
6
5
  end
7
6
 
8
- def call socket
7
+ def call(socket)
9
8
  @socket = socket
10
9
  @proc.call self
11
10
  end
12
11
 
13
- def write data
14
- write! data
15
- self
12
+ def write(data)
13
+ @socket << data
14
+ data
15
+ rescue Errno::EPIPE
16
+ raise SocketError, "error writing to socket"
16
17
  end
17
18
  alias :<< :write
18
19
 
19
20
  # behaves like a true Rack::Response/BodyProxy object
20
- def each(*)
21
+ def each
21
22
  yield self
22
23
  end
23
24
 
24
- def on_error &proc
25
- @on_error = proc
26
- self
27
- end
28
-
29
25
  def close
30
26
  @socket.close unless closed?
31
27
  end
@@ -34,14 +30,6 @@ module Reel
34
30
  def closed?
35
31
  @socket.closed?
36
32
  end
37
-
38
- private
39
- def write! string
40
- @socket << string
41
- rescue => e
42
- @on_error ? @on_error.call(e) : raise(e)
43
- end
44
-
45
33
  end
46
34
 
47
35
  class EventStream < Stream
@@ -60,25 +48,24 @@ module Reel
60
48
  %w[event id retry].each do |meth|
61
49
  define_method meth do |data|
62
50
  # unlike on #data, these messages expects a single \n at the end.
63
- write! "%s: %s\n" % [meth, data]
51
+ write "%s: %s\n" % [meth, data]
64
52
  end
65
53
  end
66
54
 
67
- def data data
55
+ def data(data)
68
56
  # - any single message should not contain \n except at the end.
69
57
  # - EventSource expects \n\n at the end of each single message.
70
- write! "data: %s\n\n" % data.gsub(/\n|\r/, '')
58
+ write "data: %s\n\n" % data.gsub(/\n|\r/, '')
71
59
  self
72
60
  end
73
61
 
74
62
  end
75
63
 
76
64
  class ChunkStream < Stream
77
-
78
- def write chunk
65
+ def write(chunk)
79
66
  chunk_header = chunk.bytesize.to_s(16)
80
- write! chunk_header + Response::CRLF
81
- write! chunk + Response::CRLF
67
+ write chunk_header + Response::CRLF
68
+ write chunk + Response::CRLF
82
69
  self
83
70
  end
84
71
  alias :<< :write
@@ -86,7 +73,7 @@ module Reel
86
73
  # finish does not actually close the socket,
87
74
  # it only inform the browser there are no more messages
88
75
  def finish
89
- write! "0#{Response::CRLF * 2}"
76
+ write "0#{Response::CRLF * 2}"
90
77
  end
91
78
 
92
79
  def close
@@ -100,7 +87,7 @@ module Reel
100
87
 
101
88
  IDENTITY = 'identity'.freeze
102
89
 
103
- def initialize status, headers, body
90
+ def initialize(status, headers, body)
104
91
  self.status = status
105
92
  @body = body
106
93
 
@@ -119,7 +106,7 @@ module Reel
119
106
  @version = http_version
120
107
  end
121
108
 
122
- def render socket
109
+ def render(socket)
123
110
  socket << render_header
124
111
  @body.call socket
125
112
  end
data/lib/reel/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Reel
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0.pre"
3
3
  end
@@ -47,7 +47,7 @@ module Reel
47
47
  end
48
48
  end
49
49
 
50
- def read_every n, unit = :s
50
+ def read_every(n, unit = :s)
51
51
  cancel_timer! # only one timer allowed per stream
52
52
  seconds = case unit.to_s
53
53
  when /\Am/
@@ -65,9 +65,9 @@ module Reel
65
65
  def read
66
66
  @parser.append @socket.readpartial(Connection::BUFFER_SIZE) until msg = @parser.next_message
67
67
  msg
68
- rescue => e
68
+ rescue
69
69
  cancel_timer!
70
- @on_error ? @on_error.call(e) : raise(e)
70
+ raise
71
71
  end
72
72
 
73
73
  def body
@@ -77,9 +77,12 @@ module Reel
77
77
  def write(msg)
78
78
  @socket << ::WebSocket::Message.new(msg).to_data
79
79
  msg
80
- rescue => e
80
+ rescue Errno::EPIPE
81
81
  cancel_timer!
82
- @on_error ? @on_error.call(e) : raise(e)
82
+ raise SocketError, "error writing to socket"
83
+ rescue
84
+ cancel_timer!
85
+ raise
83
86
  end
84
87
  alias_method :<<, :write
85
88
 
data/reel.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.add_runtime_dependency 'celluloid-io', '>= 0.8.0'
19
19
  gem.add_runtime_dependency 'http', '>= 0.2.0'
20
20
  gem.add_runtime_dependency 'http_parser.rb', '>= 0.5.3'
21
- gem.add_runtime_dependency 'websocket_parser', '>= 0.1.0'
21
+ gem.add_runtime_dependency 'websocket_parser', '>= 0.1.2'
22
22
  gem.add_runtime_dependency 'rack', '>= 1.4.0'
23
23
 
24
24
  gem.add_development_dependency 'rake'
@@ -18,13 +18,13 @@ describe Reel::App do
18
18
  end
19
19
 
20
20
  after(:each) do
21
- @app.server.terminate if @app.server.alive?
21
+ @app.server.terminate if @app && @app.server.alive?
22
22
  end
23
23
 
24
24
  it 'responds to get requests' do
25
25
  res = Http.with_response(:object).get example_url
26
26
  res.status.should == 200
27
- res.headers.should == {"Connection" => "Keep-Alive", "Content-Length" => res.body.length.to_s}
27
+ res.headers.should == {"Content-Length" => res.body.length.to_s}
28
28
  res.body.should == "hello foo"
29
29
  end
30
30
 
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'bundler/setup'
2
2
  require 'reel'
3
+ require 'coveralls'
4
+ Coveralls.wear!
3
5
 
4
6
  logfile = File.open(File.expand_path("../../log/test.log", __FILE__), 'a')
5
7
  Celluloid.logger = Logger.new(logfile)
@@ -13,7 +15,7 @@ def with_reel(handler)
13
15
  server = Reel::Server.new(example_addr, example_port, &handler)
14
16
  yield server
15
17
  ensure
16
- server.terminate
18
+ server.terminate if server && server.alive?
17
19
  end
18
20
 
19
21
  def with_socket_pair
@@ -88,4 +90,4 @@ module WebSocketHelpers
88
90
  let(:handshake) { WebSocket::ClientHandshake.new(:get, example_url, handshake_headers) }
89
91
  end
90
92
  end
91
- end
93
+ end
metadata CHANGED
@@ -1,142 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
5
- prerelease:
4
+ version: 0.4.0.pre
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tony Arcieri
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-01 00:00:00.000000000 Z
11
+ date: 2013-05-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: celluloid-io
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.8.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.8.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: http
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: 0.2.0
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: 0.2.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: http_parser.rb
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: 0.5.3
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: 0.5.3
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: websocket_parser
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
- version: 0.1.0
61
+ version: 0.1.2
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
- version: 0.1.0
68
+ version: 0.1.2
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rack
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: 1.4.0
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: 1.4.0
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rake
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: rspec
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: octarine
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
142
125
  description: A Celluloid::IO-powered HTTP server
@@ -147,6 +130,7 @@ executables:
147
130
  extensions: []
148
131
  extra_rdoc_files: []
149
132
  files:
133
+ - .coveralls.yml
150
134
  - .gitignore
151
135
  - .rspec
152
136
  - .travis.yml
@@ -197,33 +181,26 @@ files:
197
181
  - tasks/rspec.rake
198
182
  homepage: https://github.com/celluloid/reel
199
183
  licenses: []
184
+ metadata: {}
200
185
  post_install_message:
201
186
  rdoc_options: []
202
187
  require_paths:
203
188
  - lib
204
189
  required_ruby_version: !ruby/object:Gem::Requirement
205
- none: false
206
190
  requirements:
207
- - - ! '>='
191
+ - - '>='
208
192
  - !ruby/object:Gem::Version
209
193
  version: '0'
210
- segments:
211
- - 0
212
- hash: -2509762787957367421
213
194
  required_rubygems_version: !ruby/object:Gem::Requirement
214
- none: false
215
195
  requirements:
216
- - - ! '>='
196
+ - - '>'
217
197
  - !ruby/object:Gem::Version
218
- version: '0'
219
- segments:
220
- - 0
221
- hash: -2509762787957367421
198
+ version: 1.3.1
222
199
  requirements: []
223
200
  rubyforge_project:
224
- rubygems_version: 1.8.23
201
+ rubygems_version: 2.0.3
225
202
  signing_key:
226
- specification_version: 3
203
+ specification_version: 4
227
204
  summary: A reel good HTTP server
228
205
  test_files:
229
206
  - spec/fixtures/example.txt