faye-reconnect 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +91 -0
- data/Rakefile +2 -0
- data/faye-reconnect.gemspec +30 -0
- data/lib/faye/patches/client.rb +22 -0
- data/lib/faye/reconnect/client_extension.rb +80 -0
- data/lib/faye/reconnect/server_extension.rb +27 -0
- data/lib/faye/reconnect/version.rb +5 -0
- data/lib/faye/reconnect.rb +9 -0
- data/spec/client_extension_spec.rb +16 -0
- data/spec/reconnect_spec.rb +135 -0
- data/spec/spec_helper.rb +89 -0
- metadata +162 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 141bb41cd03d805fec292ba3559e58d7d2ff0d03
|
4
|
+
data.tar.gz: 9c0f5a9ebb91b27c3fbf48bbca74e840170df810
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 64f766e8cb14afbded68ce643671f1a6c67a3c3fc02661abc0b20210c0e53d6fe918007bd84dd178893d564c7f5352f07f2482bacd2f74a06191421d369b3c35
|
7
|
+
data.tar.gz: 4897f0a8ab174023926e5c356c88aab45976e559554182b69bb664c1bd61e3d8c0f2eefa174a93f796979e1b678a00b78dac0f6083f80fd115f6a89358147ac7
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Adrien Siami
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# Faye::Reconnect
|
2
|
+
|
3
|
+
This extension allows a faye client to retrieve its client id when restarting, after a crash, etc; thus retrieving all the messages addresses to it sent during the disconnection.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'faye-reconnect'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install faye-reconnect
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
To require it in your application :
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require 'faye/reconnect'
|
27
|
+
```
|
28
|
+
|
29
|
+
``Faye::Reconnect`` is actually two faye extensions, one for the Faye server and one for the clients.
|
30
|
+
|
31
|
+
### Server Side
|
32
|
+
|
33
|
+
You just need to add the extension and pass your faye server to it :
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 15)
|
37
|
+
server.add_extension Faye::Reconnect::ServerExtension.new(server)
|
38
|
+
```
|
39
|
+
|
40
|
+
### Client Side
|
41
|
+
|
42
|
+
The client extension has a dependency on redis.
|
43
|
+
It uses redis to persist the client id after each successful handshake so it can re-use it when trying to reconnect.
|
44
|
+
|
45
|
+
Add the extension to your faye client :
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
client = Faye::Client.new('http://localhost:9292/faye')
|
49
|
+
client.add_extension Faye::Reconnect::ClientExtension.new({
|
50
|
+
name: 'your_client_name',
|
51
|
+
redis: {
|
52
|
+
host: 'localhost',
|
53
|
+
port: 6379,
|
54
|
+
password: '',
|
55
|
+
database: 0
|
56
|
+
}
|
57
|
+
})
|
58
|
+
```
|
59
|
+
|
60
|
+
``:name`` is mandatory, it is used to distinct clients.
|
61
|
+
|
62
|
+
If you don't specify redis options, the ones provided in the above example will be used.
|
63
|
+
|
64
|
+
### Shutting down and catching signals
|
65
|
+
|
66
|
+
You may already have something along the lines of :
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
trap('TERM') do
|
70
|
+
client.disconnect
|
71
|
+
end
|
72
|
+
```
|
73
|
+
|
74
|
+
If you plan on reconnecting with the same client id and get missing messages, you have to use the ``stop!`` method provided by this gem :
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
trap('TERM') do
|
78
|
+
client.stop!
|
79
|
+
end
|
80
|
+
```
|
81
|
+
|
82
|
+
Instead of sending a ``/meta/disconnect`` message to the server, it will cleanly stop the Event Machine reactor, so the faye server is not aware you are disconnected and it will keep incoming messages until you handshake again.
|
83
|
+
|
84
|
+
|
85
|
+
## Contributing
|
86
|
+
|
87
|
+
1. Fork it ( https://github.com/dimelo/faye-reconnect/fork )
|
88
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
89
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
90
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
91
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'faye/reconnect/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "faye-reconnect"
|
8
|
+
spec.version = Faye::Reconnect::VERSION
|
9
|
+
spec.authors = ["Adrien Siami"]
|
10
|
+
spec.email = ["adrien.siami@dimelo.com"]
|
11
|
+
spec.summary = "Allow a long running faye client to reconnect to a faye server with the same client ID"
|
12
|
+
spec.description = "Allow a long running faye client to reconnect to a faye server with the same client ID"
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'em-hiredis', '~> 0.3'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.1.0'
|
26
|
+
spec.add_development_dependency 'rspec-eventmachine', '~> 0.2.0'
|
27
|
+
spec.add_development_dependency 'thin'
|
28
|
+
spec.add_development_dependency 'pry-byebug'
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Faye
|
2
|
+
module Patches
|
3
|
+
|
4
|
+
def stop!
|
5
|
+
@state = Faye::Client::DISCONNECTED
|
6
|
+
|
7
|
+
info('Disconnecting ?', @dispatcher.client_id)
|
8
|
+
@dispatcher.close
|
9
|
+
info('Clearing channel listeners for ?', @dispatcher.client_id)
|
10
|
+
@channels = Channel::Set.new
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
def reconnect(&block)
|
15
|
+
@reconnect_callback = block
|
16
|
+
connect
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Faye::Client.send(:include, Faye::Patches)
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'em-hiredis'
|
2
|
+
|
3
|
+
module Faye
|
4
|
+
module Reconnect
|
5
|
+
class ClientExtension
|
6
|
+
|
7
|
+
def initialize redis: nil, name:
|
8
|
+
@name = name
|
9
|
+
@clientIdFetched = false
|
10
|
+
redis ||= {}
|
11
|
+
redis[:host] ||= 'localhost'
|
12
|
+
redis[:port] ||= 6379
|
13
|
+
redis[:password] ||= ''
|
14
|
+
|
15
|
+
@redis = EventMachine::Hiredis::Client.new(redis[:host], redis[:port], redis[:password], redis[:database])
|
16
|
+
EM.schedule do
|
17
|
+
@redis.connect
|
18
|
+
@redis.errback do |reason|
|
19
|
+
raise "Connection to redis failed : #{reason}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def clientIdKey
|
25
|
+
"#{@name}/client_id"
|
26
|
+
end
|
27
|
+
|
28
|
+
def fetch_client_id(&callback)
|
29
|
+
if @clientIdFetched == false
|
30
|
+
@clientIdFetched = true
|
31
|
+
@redis.get(clientIdKey, &callback)
|
32
|
+
else
|
33
|
+
callback.call(nil)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def set_client_id(value, &callback)
|
38
|
+
@redis.set(clientIdKey, value, &callback).errback(&callback)
|
39
|
+
end
|
40
|
+
|
41
|
+
def del_client_id(&callback)
|
42
|
+
@redis.del(clientIdKey, &callback).errback(&callback)
|
43
|
+
end
|
44
|
+
|
45
|
+
def outgoing(message, callback)
|
46
|
+
if message['channel'] == '/meta/disconnect'
|
47
|
+
del_client_id { callback.call(message) }
|
48
|
+
elsif message['channel'] == '/meta/handshake'
|
49
|
+
fetch_client_id do |clientId|
|
50
|
+
message['previousClientId'] = clientId if !clientId.nil?
|
51
|
+
callback.call(message)
|
52
|
+
end
|
53
|
+
else
|
54
|
+
callback.call(message)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def incoming(message, callback)
|
59
|
+
if message['channel'] == '/meta/handshake'
|
60
|
+
if message['error'] == 'Already connected' && message.key?('clientId')
|
61
|
+
message.delete('error')
|
62
|
+
message['successful'] = true
|
63
|
+
callback.call(message)
|
64
|
+
else
|
65
|
+
fetch_client_id do |clientId|
|
66
|
+
if clientId.nil?
|
67
|
+
set_client_id(message['clientId']) { callback.call(message) }
|
68
|
+
else
|
69
|
+
callback.call(message)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
else
|
74
|
+
callback.call(message)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Faye
|
2
|
+
module Reconnect
|
3
|
+
class ServerExtension
|
4
|
+
|
5
|
+
def initialize(app)
|
6
|
+
@server = app.instance_variable_get(:@server)
|
7
|
+
end
|
8
|
+
|
9
|
+
def incoming(message, callback)
|
10
|
+
if message.key?('previousClientId')
|
11
|
+
client_id = message['previousClientId']
|
12
|
+
@server.engine.client_exists(client_id) do |exists|
|
13
|
+
if exists
|
14
|
+
@server.engine.ping(client_id)
|
15
|
+
message['clientId'] = client_id
|
16
|
+
message['error'] = 'Already connected'
|
17
|
+
end
|
18
|
+
callback.call(message)
|
19
|
+
end
|
20
|
+
else
|
21
|
+
callback.call(message)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'faye'
|
2
|
+
require 'faye/reconnect'
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Faye::Reconnect::ClientExtension do
|
6
|
+
|
7
|
+
it 'requires a name option' do
|
8
|
+
expect {
|
9
|
+
Faye::Reconnect::ClientExtension.new
|
10
|
+
}.to raise_error(ArgumentError, "missing keyword: name")
|
11
|
+
expect {
|
12
|
+
Faye::Reconnect::ClientExtension.new(name: 'foobar')
|
13
|
+
}.to_not raise_error
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
require 'faye'
|
2
|
+
require 'faye/reconnect'
|
3
|
+
require 'rspec/em'
|
4
|
+
require 'spec_helper'
|
5
|
+
|
6
|
+
ReconnectSteps = RSpec::EM.async_steps do
|
7
|
+
|
8
|
+
def client(name, channels, &callback)
|
9
|
+
@clients ||= {}
|
10
|
+
@inboxes ||= {}
|
11
|
+
@clients[name] = Faye::Client.new('http://localhost:9876/faye')
|
12
|
+
@clients[name].add_extension(Faye::Reconnect::ClientExtension.new(name: name, redis: {database: 9}))
|
13
|
+
@inboxes[name] = {}
|
14
|
+
|
15
|
+
n = channels.size
|
16
|
+
return @clients[name].connect(&callback) if n.zero?
|
17
|
+
|
18
|
+
channels.each do |channel|
|
19
|
+
subscription = @clients[name].subscribe(channel) do |message|
|
20
|
+
@inboxes[name][channel] ||= []
|
21
|
+
@inboxes[name][channel] << message
|
22
|
+
end
|
23
|
+
subscription.callback do
|
24
|
+
n -= 1
|
25
|
+
callback.call if n.zero?
|
26
|
+
end
|
27
|
+
subscription.errback do |e|
|
28
|
+
raise e.to_s
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def publish(name, channel, message, &callback)
|
34
|
+
@clients[name].publish(channel, message)
|
35
|
+
EM.add_timer(0.1, &callback)
|
36
|
+
end
|
37
|
+
|
38
|
+
def check_inbox(name, channel, messages, &callback)
|
39
|
+
inbox = @inboxes[name][channel] || []
|
40
|
+
expect(inbox).to eq(messages)
|
41
|
+
callback.call
|
42
|
+
end
|
43
|
+
|
44
|
+
def kill_client(name, &callback)
|
45
|
+
client = @clients[name]
|
46
|
+
@clients.delete(name)
|
47
|
+
@inboxes.delete(name)
|
48
|
+
client.stop!
|
49
|
+
EM.add_timer(0.1, &callback)
|
50
|
+
end
|
51
|
+
|
52
|
+
def disconnect_client(name, &callback)
|
53
|
+
client = @clients[name]
|
54
|
+
@clients.delete(name)
|
55
|
+
@inboxes.delete(name)
|
56
|
+
client.disconnect
|
57
|
+
EM.add_timer(0.1, &callback)
|
58
|
+
end
|
59
|
+
|
60
|
+
def flushdb(&callback)
|
61
|
+
@clients = {}
|
62
|
+
@inboxes = {}
|
63
|
+
@redis = EventMachine::Hiredis::Client.new('localhost', 6379, '', 9)
|
64
|
+
@redis.connect
|
65
|
+
@redis.errback do |reason|
|
66
|
+
raise "Connection to redis failed : #{reason}"
|
67
|
+
end
|
68
|
+
@redis.flushdb(&callback)
|
69
|
+
end
|
70
|
+
|
71
|
+
def launch_server(&callback)
|
72
|
+
Faye::WebSocket.load_adapter('thin')
|
73
|
+
app = Faye::RackAdapter.new(:mount => '/faye', :timeout => 25)
|
74
|
+
app.add_extension(Faye::Reconnect::ServerExtension.new(app))
|
75
|
+
Thin::Logging.silent = true
|
76
|
+
@server = Thin::Server.new('127.0.0.1', 9876, app)
|
77
|
+
@server.start
|
78
|
+
callback.call
|
79
|
+
end
|
80
|
+
|
81
|
+
def stop_server(&callback)
|
82
|
+
@server.stop
|
83
|
+
# Hack EM to stop the timers
|
84
|
+
EM.instance_variable_get(:@timers).each { |t,_| EM.cancel_timer(t) }
|
85
|
+
EM.add_timer(0.1, &callback)
|
86
|
+
end
|
87
|
+
|
88
|
+
def wait(time, &callback)
|
89
|
+
EM.add_timer(time, &callback)
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
describe Faye::Reconnect do
|
95
|
+
include ReconnectSteps
|
96
|
+
|
97
|
+
before { launch_server }
|
98
|
+
before { flushdb }
|
99
|
+
|
100
|
+
it 'fetches messages sent while disconnected' do
|
101
|
+
client 'foo', ['/foo']
|
102
|
+
client 'bar', ['/bar']
|
103
|
+
kill_client 'foo'
|
104
|
+
publish 'bar', '/foo', {'hello' => 'world'}
|
105
|
+
client 'foo', ['/foo']
|
106
|
+
wait 0.2
|
107
|
+
check_inbox 'foo', '/foo', [{'hello' => 'world'}]
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'does not re-use clientId when issuing a legal disconnect' do
|
111
|
+
client 'foo', ['/foo']
|
112
|
+
client 'bar', ['/bar']
|
113
|
+
disconnect_client 'foo'
|
114
|
+
publish 'bar', '/foo', {'hello' => 'world'}
|
115
|
+
client 'foo', ['/foo']
|
116
|
+
wait 0.2
|
117
|
+
check_inbox 'foo', '/foo', []
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'is scoped by name' do
|
121
|
+
client 'foo', ['/foo']
|
122
|
+
client 'baz', ['/baz']
|
123
|
+
client 'bar', ['/bar']
|
124
|
+
kill_client 'foo'
|
125
|
+
kill_client 'baz'
|
126
|
+
publish 'bar', '/foo', {'hello' => 'foo'}
|
127
|
+
publish 'bar', '/baz', {'hello' => 'baz'}
|
128
|
+
client 'foo', ['/foo']
|
129
|
+
client 'baz', ['/baz']
|
130
|
+
wait 0.2
|
131
|
+
check_inbox 'foo', '/foo', [{'hello' => 'foo'}]
|
132
|
+
check_inbox 'baz', '/baz', [{'hello' => 'baz'}]
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
10
|
+
# a separate helper file that requires the additional dependencies and performs
|
11
|
+
# the additional setup, and require it from the spec files that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
15
|
+
#
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
+
RSpec.configure do |config|
|
18
|
+
# rspec-expectations config goes here. You can use an alternate
|
19
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
20
|
+
# assertions if you prefer.
|
21
|
+
config.expect_with :rspec do |expectations|
|
22
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
23
|
+
# and `failure_message` of custom matchers include text for helper methods
|
24
|
+
# defined using `chain`, e.g.:
|
25
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
26
|
+
# # => "be bigger than 2 and smaller than 4"
|
27
|
+
# ...rather than:
|
28
|
+
# # => "be bigger than 2"
|
29
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
30
|
+
end
|
31
|
+
|
32
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
33
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
34
|
+
config.mock_with :rspec do |mocks|
|
35
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
36
|
+
# a real object. This is generally recommended, and will default to
|
37
|
+
# `true` in RSpec 4.
|
38
|
+
mocks.verify_partial_doubles = true
|
39
|
+
end
|
40
|
+
|
41
|
+
# The settings below are suggested to provide a good initial experience
|
42
|
+
# with RSpec, but feel free to customize to your heart's content.
|
43
|
+
=begin
|
44
|
+
# These two settings work together to allow you to limit a spec run
|
45
|
+
# to individual examples or groups you care about by tagging them with
|
46
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
47
|
+
# get run.
|
48
|
+
config.filter_run :focus
|
49
|
+
config.run_all_when_everything_filtered = true
|
50
|
+
|
51
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
52
|
+
# For more details, see:
|
53
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
54
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
55
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
56
|
+
config.disable_monkey_patching!
|
57
|
+
|
58
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
59
|
+
# be too noisy due to issues in dependencies.
|
60
|
+
config.warnings = true
|
61
|
+
|
62
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
63
|
+
# file, and it's useful to allow more verbose output when running an
|
64
|
+
# individual spec file.
|
65
|
+
if config.files_to_run.one?
|
66
|
+
# Use the documentation formatter for detailed output,
|
67
|
+
# unless a formatter has already been configured
|
68
|
+
# (e.g. via a command-line flag).
|
69
|
+
config.default_formatter = 'doc'
|
70
|
+
end
|
71
|
+
|
72
|
+
# Print the 10 slowest examples and example groups at the
|
73
|
+
# end of the spec run, to help surface which specs are running
|
74
|
+
# particularly slow.
|
75
|
+
config.profile_examples = 10
|
76
|
+
|
77
|
+
# Run specs in random order to surface order dependencies. If you find an
|
78
|
+
# order dependency and want to debug it, you can fix the order by providing
|
79
|
+
# the seed, which is printed after each run.
|
80
|
+
# --seed 1234
|
81
|
+
config.order = :random
|
82
|
+
|
83
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
84
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
85
|
+
# test failures related to randomization by passing the same `--seed` value
|
86
|
+
# as the one that triggered the failure.
|
87
|
+
Kernel.srand config.seed
|
88
|
+
=end
|
89
|
+
end
|
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: faye-reconnect
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adrien Siami
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: em-hiredis
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.1.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.1.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-eventmachine
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.2.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.2.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: thin
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry-byebug
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Allow a long running faye client to reconnect to a faye server with the
|
112
|
+
same client ID
|
113
|
+
email:
|
114
|
+
- adrien.siami@dimelo.com
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rspec"
|
121
|
+
- Gemfile
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- faye-reconnect.gemspec
|
126
|
+
- lib/faye/patches/client.rb
|
127
|
+
- lib/faye/reconnect.rb
|
128
|
+
- lib/faye/reconnect/client_extension.rb
|
129
|
+
- lib/faye/reconnect/server_extension.rb
|
130
|
+
- lib/faye/reconnect/version.rb
|
131
|
+
- spec/client_extension_spec.rb
|
132
|
+
- spec/reconnect_spec.rb
|
133
|
+
- spec/spec_helper.rb
|
134
|
+
homepage: ''
|
135
|
+
licenses:
|
136
|
+
- MIT
|
137
|
+
metadata: {}
|
138
|
+
post_install_message:
|
139
|
+
rdoc_options: []
|
140
|
+
require_paths:
|
141
|
+
- lib
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
requirements: []
|
153
|
+
rubyforge_project:
|
154
|
+
rubygems_version: 2.5.1
|
155
|
+
signing_key:
|
156
|
+
specification_version: 4
|
157
|
+
summary: Allow a long running faye client to reconnect to a faye server with the same
|
158
|
+
client ID
|
159
|
+
test_files:
|
160
|
+
- spec/client_extension_spec.rb
|
161
|
+
- spec/reconnect_spec.rb
|
162
|
+
- spec/spec_helper.rb
|