mantle 2.2.3 → 2.2.4
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/CHANGELOG.md +6 -0
- data/lib/mantle/configuration.rb +2 -1
- data/lib/mantle/message.rb +5 -0
- data/lib/mantle/version.rb +1 -1
- data/mantle.gemspec +2 -2
- data/spec/lib/mantle/configuration_spec.rb +6 -0
- data/spec/lib/mantle/message_spec.rb +26 -4
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b063e0fab15144d55d5a71c69de66fffe6c5f87
|
4
|
+
data.tar.gz: 81caadf6fb95b73451c39e3cc59a3ba211179a53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a508daa877cca134a8bdedcdb656564867f2e1ed768a4db94dd5e579b3fc36c161d287a94ed799fb6dfe80392335eba8d82585cef383fe7b3598be29d23d010d
|
7
|
+
data.tar.gz: 81df67beed7ec2e8d6846cbc9765f8177a2325330d2519998f875b25690b89e31411d487a1d1b9f17629bcc9de32537e1459f14ea035d624473e796c1794a41e
|
data/CHANGELOG.md
CHANGED
data/lib/mantle/configuration.rb
CHANGED
data/lib/mantle/message.rb
CHANGED
@@ -10,6 +10,7 @@ module Mantle
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def publish(message)
|
13
|
+
message = message.merge(__MANTLE__: { message_source: whoami }) if whoami
|
13
14
|
message_bus.publish(channel, message)
|
14
15
|
catch_up.add_message(channel, message)
|
15
16
|
end
|
@@ -17,5 +18,9 @@ module Mantle
|
|
17
18
|
private
|
18
19
|
|
19
20
|
attr_reader :message_bus, :catch_up
|
21
|
+
|
22
|
+
def whoami
|
23
|
+
Mantle.configuration.whoami
|
24
|
+
end
|
20
25
|
end
|
21
26
|
end
|
data/lib/mantle/version.rb
CHANGED
data/mantle.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'mantle/version'
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "mantle"
|
8
8
|
gem.version = Mantle::VERSION
|
9
|
-
gem.authors = ["Grant Ammons", "Brandon Hilkert"]
|
10
|
-
gem.email = ["gammons@gmail.com", "brandonhilkert@gmail.com"]
|
9
|
+
gem.authors = ["Grant Ammons", "Brandon Hilkert", "Scott Gibson", "Frank Hmeidan"]
|
10
|
+
gem.email = ["gammons@gmail.com", "brandonhilkert@gmail.com", "sevgibson@gmail.com", "frank.hmeidan@gmail.com"]
|
11
11
|
gem.description = %q{Ruby application message bus subscriptions with Sidekiq and Redis Pubsub.}
|
12
12
|
gem.summary = %q{Ruby application message bus subscriptions with Sidekiq and Redis Pubsub.}
|
13
13
|
gem.homepage = "https://github.com/PipelineDeals/mantle"
|
@@ -14,6 +14,12 @@ describe Mantle::Configuration do
|
|
14
14
|
expect(config.message_handlers).to eq({'a_channel' => 'FakeHandler'})
|
15
15
|
end
|
16
16
|
|
17
|
+
it 'can set/get whoami' do
|
18
|
+
config = Mantle::Configuration.new
|
19
|
+
config.whoami = 'SantaClaus'
|
20
|
+
expect(config.whoami).to eq('SantaClaus')
|
21
|
+
end
|
22
|
+
|
17
23
|
it 'configures default message handler' do
|
18
24
|
config = Mantle::Configuration.new
|
19
25
|
expect(config.message_handlers).to be_instance_of(Mantle::MessageHandlers)
|
@@ -12,12 +12,34 @@ describe Mantle::Message do
|
|
12
12
|
mantle_message.message_bus = bus
|
13
13
|
mantle_message.catch_up = catch_up
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
allow(bus).to receive(:publish)
|
16
|
+
allow(catch_up).to receive(:add_message)
|
17
17
|
|
18
18
|
mantle_message.publish(message)
|
19
|
+
|
20
|
+
expect(bus).to have_received(:publish).with(channel, message)
|
21
|
+
expect(catch_up).to have_received(:add_message).with(channel, message)
|
19
22
|
end
|
20
|
-
end
|
21
|
-
end
|
22
23
|
|
24
|
+
it "published message includes message_source" do
|
25
|
+
Mantle.configure { |config| config.whoami = 'SantaClaus' }
|
26
|
+
bus = double("message bus")
|
27
|
+
catch_up = double("catch up")
|
28
|
+
channel = "create:person"
|
29
|
+
message = { id: 1 }
|
30
|
+
actual_message = message.merge(__MANTLE__: { message_source: 'SantaClaus' })
|
23
31
|
|
32
|
+
mantle_message = Mantle::Message.new(channel)
|
33
|
+
mantle_message.message_bus = bus
|
34
|
+
mantle_message.catch_up = catch_up
|
35
|
+
|
36
|
+
allow(bus).to receive(:publish)
|
37
|
+
allow(catch_up).to receive(:add_message)
|
38
|
+
|
39
|
+
mantle_message.publish(message)
|
40
|
+
|
41
|
+
expect(bus).to have_received(:publish).with(channel, actual_message)
|
42
|
+
expect(catch_up).to have_received(:add_message).with(channel, actual_message)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mantle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Ammons
|
8
8
|
- Brandon Hilkert
|
9
|
+
- Scott Gibson
|
10
|
+
- Frank Hmeidan
|
9
11
|
autorequire:
|
10
12
|
bindir: bin
|
11
13
|
cert_chain: []
|
12
|
-
date:
|
14
|
+
date: 2017-06-20 00:00:00.000000000 Z
|
13
15
|
dependencies:
|
14
16
|
- !ruby/object:Gem::Dependency
|
15
17
|
name: redis
|
@@ -71,6 +73,8 @@ description: Ruby application message bus subscriptions with Sidekiq and Redis P
|
|
71
73
|
email:
|
72
74
|
- gammons@gmail.com
|
73
75
|
- brandonhilkert@gmail.com
|
76
|
+
- sevgibson@gmail.com
|
77
|
+
- frank.hmeidan@gmail.com
|
74
78
|
executables:
|
75
79
|
- mantle
|
76
80
|
extensions: []
|
@@ -140,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
144
|
version: '0'
|
141
145
|
requirements: []
|
142
146
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
147
|
+
rubygems_version: 2.4.8
|
144
148
|
signing_key:
|
145
149
|
specification_version: 4
|
146
150
|
summary: Ruby application message bus subscriptions with Sidekiq and Redis Pubsub.
|