promiscuous 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/promiscuous/publisher/lint.rb +1 -1
- data/lib/promiscuous/subscriber/lint.rb +3 -1
- data/lib/promiscuous/subscriber/lint/amqp.rb +1 -1
- data/lib/promiscuous/subscriber/lint/base.rb +8 -2
- data/lib/promiscuous/subscriber/lint/polymorphic.rb +11 -11
- data/lib/promiscuous/version.rb +1 -1
- metadata +1 -1
@@ -20,8 +20,8 @@ module Promiscuous::Publisher::Lint
|
|
20
20
|
lint = ::Class.new(Base)
|
21
21
|
lint.__send__(:include, Class) if pub.include?(Promiscuous::Publisher::Class)
|
22
22
|
lint.__send__(:include, Attributes) if pub.include?(Promiscuous::Publisher::Attributes)
|
23
|
-
lint.__send__(:include, Polymorphic) if pub.include?(Promiscuous::Publisher::Polymorphic)
|
24
23
|
lint.__send__(:include, AMQP) if pub.include?(Promiscuous::Publisher::AMQP)
|
24
|
+
lint.__send__(:include, Polymorphic) if pub.include?(Promiscuous::Publisher::Polymorphic)
|
25
25
|
lint.new(:klass => klass, :publisher => pub, :to => to).lint
|
26
26
|
end
|
27
27
|
true
|
@@ -6,6 +6,8 @@ module Promiscuous::Subscriber::Lint
|
|
6
6
|
autoload :AMQP, 'promiscuous/subscriber/lint/amqp'
|
7
7
|
|
8
8
|
def self.lint(binding_classes)
|
9
|
+
Base.reload_publishers
|
10
|
+
|
9
11
|
binding_classes.each do |from, klass|
|
10
12
|
sub = Promiscuous::Subscriber::AMQP.subscribers[from]
|
11
13
|
raise "#{from} has no subscriber" if sub.nil?
|
@@ -13,8 +15,8 @@ module Promiscuous::Subscriber::Lint
|
|
13
15
|
lint = ::Class.new(Base)
|
14
16
|
lint.__send__(:include, Class) if sub.include?(Promiscuous::Subscriber::Class)
|
15
17
|
lint.__send__(:include, Attributes) if sub.include?(Promiscuous::Subscriber::Attributes)
|
16
|
-
lint.__send__(:include, Polymorphic) if sub.include?(Promiscuous::Subscriber::Polymorphic)
|
17
18
|
lint.__send__(:include, AMQP) if sub.include?(Promiscuous::Subscriber::AMQP)
|
19
|
+
lint.__send__(:include, Polymorphic) if sub.include?(Promiscuous::Subscriber::Polymorphic)
|
18
20
|
lint.new(:klass => klass, :subscriber => sub, :from => from).lint
|
19
21
|
end
|
20
22
|
true
|
@@ -2,7 +2,7 @@ module Promiscuous::Subscriber::Lint::AMQP
|
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
4
|
def publisher
|
5
|
-
|
5
|
+
publishers.
|
6
6
|
select { |pub| pub.superclass == Promiscuous::Publisher::Mock }.
|
7
7
|
select { |pub| pub.to == from }.
|
8
8
|
tap { |pubs| raise "#{from} has multiple publishers: #{pubs}" if pubs.size > 1 }.
|
@@ -1,8 +1,14 @@
|
|
1
1
|
class Promiscuous::Subscriber::Lint::Base
|
2
2
|
include Promiscuous::Common::Lint::Base
|
3
3
|
|
4
|
-
class_attribute :
|
5
|
-
self.
|
4
|
+
class_attribute :publishers
|
5
|
+
def self.reload_publishers
|
6
|
+
self.publishers = Promiscuous::Publisher::Mock.descendants
|
7
|
+
end
|
8
|
+
|
9
|
+
def check_publisher
|
10
|
+
self.class.publishers.present?
|
11
|
+
end
|
6
12
|
|
7
13
|
use_option(:subscriber)
|
8
14
|
end
|
@@ -1,17 +1,16 @@
|
|
1
1
|
module Promiscuous::Subscriber::Lint::Polymorphic
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
|
-
def parent_publisher
|
5
|
-
publisher
|
6
|
-
@parent_publisher
|
7
|
-
end
|
8
|
-
|
9
4
|
def publisher
|
10
|
-
|
11
|
-
if
|
12
|
-
|
13
|
-
|
14
|
-
|
5
|
+
parent_publisher = super
|
6
|
+
if parent_publisher
|
7
|
+
if parent_publisher.class_name == subscriber.from_type
|
8
|
+
parent_publisher
|
9
|
+
else
|
10
|
+
parent_publisher.descendants.
|
11
|
+
select { |pub| pub.class_name == subscriber.from_type }.
|
12
|
+
first
|
13
|
+
end
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
@@ -29,7 +28,8 @@ module Promiscuous::Subscriber::Lint::Polymorphic
|
|
29
28
|
|
30
29
|
unless skip_polymorphic
|
31
30
|
subscriber.descendants.each do |pub|
|
32
|
-
self.class.new(options.merge(:
|
31
|
+
self.class.new(options.merge(:subscriber => pub,
|
32
|
+
:klass => nil,
|
33
33
|
:skip_polymorphic => true)).lint
|
34
34
|
end
|
35
35
|
end
|
data/lib/promiscuous/version.rb
CHANGED