rainbows 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v4.1.0.GIT
4
+ DEF_VER=v4.2.0.GIT
5
5
 
6
6
  LF='
7
7
  '
@@ -2,7 +2,7 @@
2
2
  # :enddoc:
3
3
  module Rainbows::Const
4
4
 
5
- RAINBOWS_VERSION = '4.1.0'
5
+ RAINBOWS_VERSION = '4.2.0'
6
6
 
7
7
  include Unicorn::Const
8
8
 
@@ -50,6 +50,21 @@ module Rainbows::EventMachine
50
50
 
51
51
  include Rainbows::Base
52
52
 
53
+ # Cramp (and possibly others) can subclass Rainbows::EventMachine::Client
54
+ # and provide the :em_client_class option. We /don't/ want to load
55
+ # Rainbows::EventMachine::Client in the master process since we need
56
+ # reloadability.
57
+ def em_client_class
58
+ case klass = Rainbows::O[:em_client_class]
59
+ when Proc
60
+ klass.call # e.g.: proc { Cramp::WebSocket::Rainbows }
61
+ when Symbol, String
62
+ eval(klass.to_s) # Object.const_get won't resolve multi-level paths
63
+ else # @use should be either :EventMachine or :NeverBlock
64
+ Rainbows.const_get(@use).const_get(:Client)
65
+ end
66
+ end
67
+
53
68
  # runs inside each forked worker, this sits around and waits
54
69
  # for connections and doesn't die until the parent dies (or is
55
70
  # given a INT, QUIT, or TERM signal)
@@ -63,11 +78,11 @@ module Rainbows::EventMachine
63
78
  EM.epoll
64
79
  EM.kqueue
65
80
  logger.info "#@use: epoll=#{EM.epoll?} kqueue=#{EM.kqueue?}"
66
- client_class = Rainbows.const_get(@use).const_get(:Client)
81
+ client_class = em_client_class
67
82
  max = worker_connections + LISTENERS.size
68
83
  Rainbows::EventMachine::Server.const_set(:MAX, max)
69
84
  Rainbows::EventMachine::Server.const_set(:CL, client_class)
70
- client_class.const_set(:APP, Rainbows.server.app)
85
+ Rainbows::EventMachine::Client.const_set(:APP, Rainbows.server.app)
71
86
  EM.run {
72
87
  conns = EM.instance_variable_get(:@conns) or
73
88
  raise RuntimeError, "EM @conns instance variable not accessible!"
@@ -17,7 +17,7 @@ lock = File.open(__FILE__, "rb")
17
17
  lock.flock(File::LOCK_EX)
18
18
  Isolate.now!(opts) do
19
19
  if engine == "ruby"
20
- gem 'cramp', '0.12'
20
+ gem 'cramp', '0.14'
21
21
  end
22
22
  end
23
23
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rainbows
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 4
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 4.1.0
10
+ version: 4.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rainbows! hackers
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-30 00:00:00 Z
18
+ date: 2011-08-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rack