action_subscriber 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/action_subscriber.rb +13 -4
- data/lib/action_subscriber/version.rb +1 -1
- data/spec/integration/inferred_routes_spec.rb +7 -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: 9575343e64c1b2390a894e3da791c3622d609a6a
|
4
|
+
data.tar.gz: 50b81796945c52e733b4ad3024bf9022986deda7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fed4d194dd8ff1ecac1be9e89002578eb19d1e7628ee5ae63e3bd1941739cc783b482706be318652b4cbcd6755edb3ff7012d519eca6f9ea57f673b65d1eca93
|
7
|
+
data.tar.gz: 65de4790022a1b705f13a9a94a175c6dd53b0d85c4cfce1b274ad3657fad25f247e7c59d3b27b78cf551884f1e566ecfdbe14d4d09c0cd82e7f2a40e38d3287a
|
data/lib/action_subscriber.rb
CHANGED
@@ -60,8 +60,12 @@ module ActionSubscriber
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def self.draw_routes(&block)
|
63
|
-
|
64
|
-
|
63
|
+
fail "No block provided to ActionSubscriber.draw_routes" unless block_given?
|
64
|
+
|
65
|
+
# We need to delay the execution of this block because ActionSubscriber is
|
66
|
+
# not configured at this point if we're calling from within the required app.
|
67
|
+
@route_set = nil
|
68
|
+
@draw_routes_block = block
|
65
69
|
end
|
66
70
|
|
67
71
|
def self.logger
|
@@ -122,8 +126,13 @@ module ActionSubscriber
|
|
122
126
|
#
|
123
127
|
def self.route_set
|
124
128
|
@route_set ||= begin
|
125
|
-
|
126
|
-
|
129
|
+
if @draw_routes_block
|
130
|
+
routes = Router.draw_routes(&@draw_routes_block)
|
131
|
+
RouteSet.new(routes)
|
132
|
+
else
|
133
|
+
logger.warn "DEPRECATION WARNING: We are inferring your routes by looking at your subscribers. This behavior is deprecated and will be removed in version 2.0. Please see the routing guide at https://github.com/mxenabled/action_subscriber/blob/master/routing.md"
|
134
|
+
RouteSet.new(self.send(:default_routes))
|
135
|
+
end
|
127
136
|
end
|
128
137
|
end
|
129
138
|
private_class_method :route_set
|
@@ -33,6 +33,13 @@ describe "A Subscriber With Inferred Routes", :integration => true do
|
|
33
33
|
|
34
34
|
# This is the deprecated behavior we want to keep until version 2.0
|
35
35
|
context "no explicit routes" do
|
36
|
+
before do
|
37
|
+
# TEST HACK: Bust any memoized routes.
|
38
|
+
::ActionSubscriber.instance_variable_set(:@route_set, nil)
|
39
|
+
::ActionSubscriber.instance_variable_set(:@draw_routes_block, nil)
|
40
|
+
::ActionSubscriber.setup_queues!
|
41
|
+
end
|
42
|
+
|
36
43
|
it "registers the routes and sets up the queues" do
|
37
44
|
::ActionSubscriber.auto_subscribe!
|
38
45
|
::ActionSubscriber::Publisher.publish("kyle.inference.yo", "YO", "events")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_subscriber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Stien
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-02-
|
15
|
+
date: 2016-02-19 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|