reactor 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changes.md +5 -0
- data/Gemfile.lock +3 -3
- data/lib/reactor/models/concerns/subscribable.rb +4 -3
- data/lib/reactor/version.rb +1 -1
- data/spec/models/concerns/subscribable_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a676751a31b8f702d1cbd084a9363e6bfcc5cf26
|
4
|
+
data.tar.gz: a67b5fdac18be4bb1b61a950af4e23e3d9e0d686
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cafbfba4b07912a67188de843589fe97e5b7bc00a445803ef8f2b6836173336e37a46f9c9c7bcd0517f65cf0c5cdb9461db63e869b30504236dff2e0b9f8c31
|
7
|
+
data.tar.gz: 41616d18f3ef3a6244d084aff2c326f389c061d8839b8fa33aff312c3ab41aefe9c327ac0c776bba18d0c386e45c399c8c4f968dec4a1b24272a1910bd395c75
|
data/Changes.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Reactor Change Log
|
2
2
|
|
3
|
+
0.11.1
|
4
|
+
-----------
|
5
|
+
Bug fix for namespaced Subscribable objects
|
6
|
+
|
3
7
|
0.11.0
|
4
8
|
-----------
|
5
9
|
Static Subscriber class names have changed to be more deterministic. THIS _MAY BE_ A BREAKING CHANGE.
|
@@ -9,5 +13,6 @@ Previously, when you added an `on_event :foo` block to an object, say `MyObject`
|
|
9
13
|
|
10
14
|
In 0.11.0, the naming of this dynamically generated worker class has changed to `Reactor::StaticSubscribers::MyObject::FooHandler`.
|
11
15
|
If you require more than one `on_event` block for the same event, you must name the handler so that it is unique and deterministic: i.e. `on_event :foo, handler_name: :do_better` otherwise an exception will be raised at load time.
|
16
|
+
This example would generate a `Reactor::StaticSubscribers::MyObject::DoBetter` class for the worker.
|
12
17
|
|
13
18
|
Because the worker class names are changing, when deploying this change it's important that your Sidekiq queue not have any pending jobs with the old naming scheme, otherwise they will fail to deserialize!
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
reactor (0.11.
|
4
|
+
reactor (0.11.1)
|
5
5
|
activerecord (< 5.0)
|
6
6
|
sidekiq
|
7
7
|
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
builder (3.2.2)
|
26
26
|
byebug (8.2.2)
|
27
27
|
coderay (1.1.0)
|
28
|
-
concurrent-ruby (1.0.
|
28
|
+
concurrent-ruby (1.0.1)
|
29
29
|
connection_pool (2.2.0)
|
30
30
|
diff-lcs (1.2.5)
|
31
31
|
i18n (0.7.0)
|
@@ -57,7 +57,7 @@ GEM
|
|
57
57
|
diff-lcs (>= 1.2.0, < 2.0)
|
58
58
|
rspec-support (~> 3.4.0)
|
59
59
|
rspec-support (3.4.1)
|
60
|
-
sidekiq (4.1.
|
60
|
+
sidekiq (4.1.1)
|
61
61
|
concurrent-ruby (~> 1.0)
|
62
62
|
connection_pool (~> 2.2, >= 2.2.0)
|
63
63
|
redis (~> 3.2, >= 3.2.1)
|
@@ -68,11 +68,12 @@ module Reactor::Subscribable
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def static_subscriber_namespace
|
71
|
-
|
72
|
-
|
71
|
+
ns = self.name.demodulize
|
72
|
+
unless Reactor::StaticSubscribers.const_defined?(ns, false)
|
73
|
+
Reactor::StaticSubscribers.const_set(ns, Module.new)
|
73
74
|
end
|
74
75
|
|
75
|
-
Reactor::StaticSubscribers.const_get(
|
76
|
+
Reactor::StaticSubscribers.const_get(ns, false)
|
76
77
|
end
|
77
78
|
end
|
78
79
|
end
|
data/lib/reactor/version.rb
CHANGED
@@ -24,6 +24,17 @@ class Auction < ActiveRecord::Base
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
module MyNamespace
|
28
|
+
class MyClass
|
29
|
+
include Reactor::Subscribable
|
30
|
+
on_event :rain, :umbrella
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.umbrella
|
34
|
+
puts 'get an umbrella'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
27
38
|
Reactor.in_test_mode do
|
28
39
|
class TestModeAuction < ActiveRecord::Base
|
29
40
|
on_event :test_puppy_delivered, -> (event) { "success" }
|
@@ -45,6 +56,10 @@ describe Reactor::Subscribable do
|
|
45
56
|
expect(Reactor::SUBSCRIBERS['puppy_delivered'][0]).to eq(Reactor::StaticSubscribers::Auction::PuppyDeliveredHandler)
|
46
57
|
expect(Reactor::SUBSCRIBERS['puppy_delivered'][1]).to eq(Reactor::StaticSubscribers::Auction::DoNothingHandler)
|
47
58
|
end
|
59
|
+
|
60
|
+
it 'adds a static subscriber for namespaced classes' do
|
61
|
+
expect(Reactor::SUBSCRIBERS['rain'][0]).to eq(Reactor::StaticSubscribers::MyClass::RainHandler)
|
62
|
+
end
|
48
63
|
end
|
49
64
|
|
50
65
|
describe 'binding symbol of class method' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reactor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- winfred
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-03-
|
14
|
+
date: 2016-03-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: sidekiq
|