pubsubstub 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +4 -1
- data/Gemfile +3 -2
- data/gemfiles/Gemfile.rack-1.x +4 -3
- data/gemfiles/Gemfile.rack-1.x.lock +35 -35
- data/gemfiles/Gemfile.rack-2.x +4 -3
- data/gemfiles/Gemfile.rack-2.x.lock +35 -35
- data/lib/pubsubstub/subscriber.rb +1 -1
- data/lib/pubsubstub/version.rb +1 -1
- data/pubsubstub.gemspec +2 -2
- data/spec/spec_helper.rb +6 -1
- data/spec/subscriber_spec.rb +7 -2
- data/spec/support/http_helpers.rb +1 -1
- metadata +18 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 52d4022c66cab3176cf8b4d22ad1486f5a85e9ae7b0d5da879ca880f85dfe810
|
4
|
+
data.tar.gz: cb11ca87209e5c282f99fbb0cba80dd9a143a25148d9771a50a713688cb19b40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a1ad2e300ee2ac5e7c438b0000e0fc21c3403655abfcc04606a1f4abd1a53676ea04383826ce2014abc92b6141be132e0802df231185c07051a7e39615f2e20
|
7
|
+
data.tar.gz: 00205b7eede161dd87212a0c40d4cc8b4b06a3c97c8a54f0bde3dc0778c246a364e0d5e15ecf218b78d97e3351d67e8293ff4bce2c2e748f2ccbee5271dd6722
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -3,10 +3,11 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in pubsubstub.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem
|
6
|
+
gem 'rspec', '~> 3.8'
|
7
7
|
gem "pry-byebug"
|
8
|
+
gem "byebug", '~> 10.0'
|
8
9
|
gem "puma", "~> 3.4"
|
9
10
|
gem "thin", "~> 1.6"
|
10
11
|
gem "rack-test"
|
11
12
|
gem "timecop"
|
12
|
-
gem "rake"
|
13
|
+
gem "rake"
|
data/gemfiles/Gemfile.rack-1.x
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'rack', '< 2'
|
4
|
-
gem 'redis', '~>
|
5
|
-
gem
|
4
|
+
gem 'redis', '~> 4.0'
|
5
|
+
gem 'rspec', '~> 3.8'
|
6
6
|
gem "pry-byebug"
|
7
|
+
gem "byebug", '~> 10.0'
|
7
8
|
gem "puma", "~> 3.4"
|
8
9
|
gem "thin", "~> 1.6"
|
9
10
|
gem "rack-test"
|
10
11
|
gem "timecop"
|
11
|
-
gem "rake"
|
12
|
+
gem "rake"
|
@@ -1,57 +1,57 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
byebug (
|
5
|
-
coderay (1.1.
|
6
|
-
daemons (1.
|
7
|
-
diff-lcs (1.
|
8
|
-
eventmachine (1.2.
|
9
|
-
method_source (0.
|
10
|
-
pry (0.
|
4
|
+
byebug (10.0.2)
|
5
|
+
coderay (1.1.2)
|
6
|
+
daemons (1.3.1)
|
7
|
+
diff-lcs (1.3)
|
8
|
+
eventmachine (1.2.7)
|
9
|
+
method_source (0.9.2)
|
10
|
+
pry (0.12.2)
|
11
11
|
coderay (~> 1.1.0)
|
12
|
-
method_source (~> 0.
|
13
|
-
|
14
|
-
|
15
|
-
byebug (~> 9.0)
|
12
|
+
method_source (~> 0.9.0)
|
13
|
+
pry-byebug (3.6.0)
|
14
|
+
byebug (~> 10.0)
|
16
15
|
pry (~> 0.10)
|
17
|
-
puma (3.
|
18
|
-
rack (1.6.
|
19
|
-
rack-test (
|
20
|
-
rack (>= 1.0)
|
21
|
-
rake (
|
22
|
-
redis (
|
23
|
-
rspec (3.
|
24
|
-
rspec-core (~> 3.
|
25
|
-
rspec-expectations (~> 3.
|
26
|
-
rspec-mocks (~> 3.
|
27
|
-
rspec-core (3.
|
28
|
-
rspec-support (~> 3.
|
29
|
-
rspec-expectations (3.
|
16
|
+
puma (3.12.1)
|
17
|
+
rack (1.6.11)
|
18
|
+
rack-test (1.1.0)
|
19
|
+
rack (>= 1.0, < 3)
|
20
|
+
rake (12.3.3)
|
21
|
+
redis (4.1.2)
|
22
|
+
rspec (3.8.0)
|
23
|
+
rspec-core (~> 3.8.0)
|
24
|
+
rspec-expectations (~> 3.8.0)
|
25
|
+
rspec-mocks (~> 3.8.0)
|
26
|
+
rspec-core (3.8.2)
|
27
|
+
rspec-support (~> 3.8.0)
|
28
|
+
rspec-expectations (3.8.4)
|
30
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
-
rspec-support (~> 3.
|
32
|
-
rspec-mocks (3.1
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
thin (1.7.
|
30
|
+
rspec-support (~> 3.8.0)
|
31
|
+
rspec-mocks (3.8.1)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.8.0)
|
34
|
+
rspec-support (3.8.2)
|
35
|
+
thin (1.7.2)
|
37
36
|
daemons (~> 1.0, >= 1.0.9)
|
38
37
|
eventmachine (~> 1.0, >= 1.0.4)
|
39
38
|
rack (>= 1, < 3)
|
40
|
-
timecop (0.
|
39
|
+
timecop (0.9.1)
|
41
40
|
|
42
41
|
PLATFORMS
|
43
42
|
ruby
|
44
43
|
|
45
44
|
DEPENDENCIES
|
45
|
+
byebug (~> 10.0)
|
46
46
|
pry-byebug
|
47
47
|
puma (~> 3.4)
|
48
48
|
rack (< 2)
|
49
49
|
rack-test
|
50
|
-
rake
|
51
|
-
redis (~>
|
52
|
-
rspec (
|
50
|
+
rake
|
51
|
+
redis (~> 4.0)
|
52
|
+
rspec (~> 3.8)
|
53
53
|
thin (~> 1.6)
|
54
54
|
timecop
|
55
55
|
|
56
56
|
BUNDLED WITH
|
57
|
-
1.
|
57
|
+
1.17.3
|
data/gemfiles/Gemfile.rack-2.x
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'rack', '~> 2.0'
|
4
|
-
gem 'redis', '~>
|
5
|
-
gem
|
4
|
+
gem 'redis', '~> 4.0'
|
5
|
+
gem 'rspec', '~> 3.8'
|
6
6
|
gem "pry-byebug"
|
7
|
+
gem "byebug", '~> 10.0'
|
7
8
|
gem "puma", "~> 3.4"
|
8
9
|
gem "thin", "~> 1.6"
|
9
10
|
gem "rack-test"
|
10
11
|
gem "timecop"
|
11
|
-
gem "rake"
|
12
|
+
gem "rake"
|
@@ -1,57 +1,57 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
byebug (
|
5
|
-
coderay (1.1.
|
6
|
-
daemons (1.
|
7
|
-
diff-lcs (1.
|
8
|
-
eventmachine (1.2.
|
9
|
-
method_source (0.
|
10
|
-
pry (0.
|
4
|
+
byebug (10.0.2)
|
5
|
+
coderay (1.1.2)
|
6
|
+
daemons (1.3.1)
|
7
|
+
diff-lcs (1.3)
|
8
|
+
eventmachine (1.2.7)
|
9
|
+
method_source (0.9.2)
|
10
|
+
pry (0.12.2)
|
11
11
|
coderay (~> 1.1.0)
|
12
|
-
method_source (~> 0.
|
13
|
-
|
14
|
-
|
15
|
-
byebug (~> 9.0)
|
12
|
+
method_source (~> 0.9.0)
|
13
|
+
pry-byebug (3.6.0)
|
14
|
+
byebug (~> 10.0)
|
16
15
|
pry (~> 0.10)
|
17
|
-
puma (3.
|
18
|
-
rack (2.0.
|
19
|
-
rack-test (
|
20
|
-
rack (>= 1.0)
|
21
|
-
rake (
|
22
|
-
redis (
|
23
|
-
rspec (3.
|
24
|
-
rspec-core (~> 3.
|
25
|
-
rspec-expectations (~> 3.
|
26
|
-
rspec-mocks (~> 3.
|
27
|
-
rspec-core (3.
|
28
|
-
rspec-support (~> 3.
|
29
|
-
rspec-expectations (3.
|
16
|
+
puma (3.12.1)
|
17
|
+
rack (2.0.7)
|
18
|
+
rack-test (1.1.0)
|
19
|
+
rack (>= 1.0, < 3)
|
20
|
+
rake (12.3.3)
|
21
|
+
redis (4.1.2)
|
22
|
+
rspec (3.8.0)
|
23
|
+
rspec-core (~> 3.8.0)
|
24
|
+
rspec-expectations (~> 3.8.0)
|
25
|
+
rspec-mocks (~> 3.8.0)
|
26
|
+
rspec-core (3.8.2)
|
27
|
+
rspec-support (~> 3.8.0)
|
28
|
+
rspec-expectations (3.8.4)
|
30
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
-
rspec-support (~> 3.
|
32
|
-
rspec-mocks (3.1
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
thin (1.7.
|
30
|
+
rspec-support (~> 3.8.0)
|
31
|
+
rspec-mocks (3.8.1)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.8.0)
|
34
|
+
rspec-support (3.8.2)
|
35
|
+
thin (1.7.2)
|
37
36
|
daemons (~> 1.0, >= 1.0.9)
|
38
37
|
eventmachine (~> 1.0, >= 1.0.4)
|
39
38
|
rack (>= 1, < 3)
|
40
|
-
timecop (0.
|
39
|
+
timecop (0.9.1)
|
41
40
|
|
42
41
|
PLATFORMS
|
43
42
|
ruby
|
44
43
|
|
45
44
|
DEPENDENCIES
|
45
|
+
byebug (~> 10.0)
|
46
46
|
pry-byebug
|
47
47
|
puma (~> 3.4)
|
48
48
|
rack (~> 2.0)
|
49
49
|
rack-test
|
50
|
-
rake
|
51
|
-
redis (~>
|
52
|
-
rspec (
|
50
|
+
rake
|
51
|
+
redis (~> 4.0)
|
52
|
+
rspec (~> 3.8)
|
53
53
|
thin (~> 1.6)
|
54
54
|
timecop
|
55
55
|
|
56
56
|
BUNDLED WITH
|
57
|
-
1.
|
57
|
+
1.17.3
|
@@ -31,7 +31,7 @@ module Pubsubstub
|
|
31
31
|
# redis.client.call allow to bypass the client mutex
|
32
32
|
# Since we now that the only other possible caller is blocking on reading the socket this is safe
|
33
33
|
synchronize do
|
34
|
-
redis.
|
34
|
+
redis._client.call(['punsubscribe', pubsub_pattern])
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
data/lib/pubsubstub/version.rb
CHANGED
data/pubsubstub.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency 'rack'
|
22
|
-
spec.add_dependency 'redis', "~>
|
22
|
+
spec.add_dependency 'redis', "~> 4.0"
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler", "~> 1.
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.17.3"
|
25
25
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -19,7 +19,7 @@ Pubsubstub.logger.level = Logger::DEBUG
|
|
19
19
|
# Fake EM
|
20
20
|
module EventMachine
|
21
21
|
extend self
|
22
|
-
|
22
|
+
|
23
23
|
def reactor_running?
|
24
24
|
false
|
25
25
|
end
|
@@ -36,4 +36,9 @@ RSpec.configure do |config|
|
|
36
36
|
config.order = 'random'
|
37
37
|
|
38
38
|
config.before(:each) { Redis.new(url: Pubsubstub.redis_url).flushdb }
|
39
|
+
|
40
|
+
# Clean threads after finish
|
41
|
+
config.after(:each) do
|
42
|
+
Thread.list.each { |thread| thread.join(0.5) if thread != Thread.current }
|
43
|
+
end
|
39
44
|
end
|
data/spec/subscriber_spec.rb
CHANGED
@@ -10,12 +10,17 @@ RSpec.describe Pubsubstub::Subscriber do
|
|
10
10
|
subject.add_event_listener('plop', -> (event) { published_events << event })
|
11
11
|
subscribe_thread = Thread.new { subject.start }
|
12
12
|
|
13
|
-
expect { subject.subscribed? }.to happen
|
13
|
+
expect { subject.subscribed? }.to happen.in_under(1)
|
14
14
|
|
15
15
|
events.each(&channel.method(:publish))
|
16
16
|
|
17
|
+
expect { published_events.size == events.size }.to happen.in_under(2)
|
18
|
+
|
17
19
|
subject.stop
|
18
|
-
|
20
|
+
|
21
|
+
subscribe_thread.join(2)
|
22
|
+
|
23
|
+
expect { ! subject.subscribed? }.to happen.in_under(1)
|
19
24
|
|
20
25
|
expect(subscribe_thread).to complete
|
21
26
|
|
@@ -6,7 +6,7 @@ module HTTPHelpers
|
|
6
6
|
queue = Queue.new
|
7
7
|
Thread.start do
|
8
8
|
begin
|
9
|
-
Net::HTTP.start(uri.host, uri.port) do |http|
|
9
|
+
Net::HTTP.start(uri.host, uri.port, open_timeout: 10) do |http|
|
10
10
|
request = Net::HTTP::Get.new uri.request_uri
|
11
11
|
headers.each do |name, value|
|
12
12
|
request.add_field(name, value)
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubsubstub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillaume Malette
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redis
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.17.3
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.17.3
|
55
55
|
description: Pubsubstub can be added to a rack Application or deployed standalone.
|
56
56
|
It uses Redis to do the Pub/Sub
|
57
57
|
email:
|
@@ -62,9 +62,9 @@ executables:
|
|
62
62
|
extensions: []
|
63
63
|
extra_rdoc_files: []
|
64
64
|
files:
|
65
|
-
- .gitignore
|
66
|
-
- .rspec
|
67
|
-
- .travis.yml
|
65
|
+
- ".gitignore"
|
66
|
+
- ".rspec"
|
67
|
+
- ".travis.yml"
|
68
68
|
- Gemfile
|
69
69
|
- LICENSE.txt
|
70
70
|
- README.md
|
@@ -109,17 +109,16 @@ require_paths:
|
|
109
109
|
- lib
|
110
110
|
required_ruby_version: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
|
-
- -
|
112
|
+
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- -
|
117
|
+
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
|
-
|
122
|
-
rubygems_version: 2.0.14.1
|
121
|
+
rubygems_version: 3.0.4
|
123
122
|
signing_key:
|
124
123
|
specification_version: 4
|
125
124
|
summary: Pubsubstub is a rack middleware to add Pub/Sub
|