action_subscriber 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c31b26344944773ea0c63f2ba81c2b9d2d9e3c8b
4
- data.tar.gz: f8f231f821d5b33937abfff11ce996033d810f88
3
+ metadata.gz: 9575343e64c1b2390a894e3da791c3622d609a6a
4
+ data.tar.gz: 50b81796945c52e733b4ad3024bf9022986deda7
5
5
  SHA512:
6
- metadata.gz: 5f095a28d75908af71ef2bbf5d75638b434663248bef1b728818ff566c5b21cbd411a4dc17bd5ffa89964516636d38ffd506d781df4b53411bf5d3a3769bfa5c
7
- data.tar.gz: e20052f487628bd2bd7a4af42c399db06c4257f17b3adaaf3aafeff272f4031816899ef4a30053d871aa9313790b4cf591fbd70445117baed92734785d710d87
6
+ metadata.gz: fed4d194dd8ff1ecac1be9e89002578eb19d1e7628ee5ae63e3bd1941739cc783b482706be318652b4cbcd6755edb3ff7012d519eca6f9ea57f673b65d1eca93
7
+ data.tar.gz: 65de4790022a1b705f13a9a94a175c6dd53b0d85c4cfce1b274ad3657fad25f247e7c59d3b27b78cf551884f1e566ecfdbe14d4d09c0cd82e7f2a40e38d3287a
@@ -60,8 +60,12 @@ module ActionSubscriber
60
60
  end
61
61
 
62
62
  def self.draw_routes(&block)
63
- routes = Router.draw_routes(&block)
64
- @route_set = RouteSet.new(routes)
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
- 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"
126
- RouteSet.new(self.send(:default_routes))
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
@@ -1,3 +1,3 @@
1
1
  module ActionSubscriber
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -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.0
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-08 00:00:00.000000000 Z
15
+ date: 2016-02-19 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport