msgr 0.8.0 → 0.9.0
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/msgr/client.rb +2 -2
- data/lib/msgr/railtie.rb +3 -2
- data/lib/msgr/version.rb +1 -1
- data/spec/integration/msgr/railtie_spec.rb +4 -20
- 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: 7d7147b5f93af8abbb88769c9bc5ad79e6aaccce
|
|
4
|
+
data.tar.gz: 51d0238c5a3f1da6c31727096f696741f2ed86cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4a0de140ab0c7195f422add2998dfdaef6c089acdcde696a7e10e9b0cd5d08203b0d5adc5ff4ddfeb71ae5d981f0a2f9eb6b0ec91098b57e142217027731493
|
|
7
|
+
data.tar.gz: 7b1be5091653909b0fd4ea7bd2f22aa85c926b82ab796ed1e4cc30a3f2ba358e7df1202e5265aad421fd92d4a9a2c34c09e945ae778b372eb946bc564e64f584
|
data/lib/msgr/client.rb
CHANGED
|
@@ -99,10 +99,10 @@ module Msgr
|
|
|
99
99
|
|
|
100
100
|
def check_process!
|
|
101
101
|
unless ::Process.pid == @pid
|
|
102
|
-
log(:warn) {
|
|
102
|
+
log(:warn) { "Fork detected. Reset internal state. (Old PID: #{@pid} / New PID: #{::Process.pid}" }
|
|
103
103
|
|
|
104
104
|
reset
|
|
105
|
-
@pid
|
|
105
|
+
@pid = ::Process.pid
|
|
106
106
|
end
|
|
107
107
|
end
|
|
108
108
|
|
data/lib/msgr/railtie.rb
CHANGED
|
@@ -28,6 +28,7 @@ module Msgr
|
|
|
28
28
|
|
|
29
29
|
Msgr.config = cfg
|
|
30
30
|
Msgr.client.connect
|
|
31
|
+
Msgr.start if !cfg[:autostart].nil? && cfg[:autostart]
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
def parse_config(cfg)
|
|
@@ -47,9 +48,9 @@ module Msgr
|
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
case cfg[:autostart]
|
|
50
|
-
when true, 'true', 'enabled'
|
|
51
|
+
when true, 'true', 'enabled'
|
|
51
52
|
cfg[:autostart] = true
|
|
52
|
-
when false, 'false', 'disabled'
|
|
53
|
+
when false, 'false', 'disabled', nil
|
|
53
54
|
cfg[:autostart] = false
|
|
54
55
|
else
|
|
55
56
|
raise ArgumentError, "Invalid value for rabbitmq config autostart: \"#{cfg[:autostart]}\""
|
data/lib/msgr/version.rb
CHANGED
|
@@ -10,11 +10,6 @@ describe Msgr::Railtie do
|
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
describe 'msgr should have load config/msgr.rb' do
|
|
14
|
-
subject { Msgr.client.routes }
|
|
15
|
-
its(:files) { should eq [Rails.root.join('config/msgr.rb').to_s] }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
13
|
describe '#parse_config' do
|
|
19
14
|
let(:settings) { {} }
|
|
20
15
|
let(:action) { described_class.parse_config settings }
|
|
@@ -22,17 +17,6 @@ describe Msgr::Railtie do
|
|
|
22
17
|
|
|
23
18
|
context 'with incorrect settings' do
|
|
24
19
|
subject { -> { action } }
|
|
25
|
-
context 'without an hash config' do
|
|
26
|
-
let(:settings) { '' }
|
|
27
|
-
|
|
28
|
-
it { should raise_error 'Could not load rabbitmq config: Config must be a Hash' }
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
context 'without an hash for the current environment' do
|
|
32
|
-
let(:settings) { {} }
|
|
33
|
-
|
|
34
|
-
it { should raise_error 'Could not load rabbitmq config for environment "test": is not a Hash' }
|
|
35
|
-
end
|
|
36
20
|
|
|
37
21
|
context 'with config without url' do
|
|
38
22
|
let(:settings) { {"test" => { hans: 'otto'}} }
|
|
@@ -79,17 +63,17 @@ describe Msgr::Railtie do
|
|
|
79
63
|
cfg
|
|
80
64
|
end
|
|
81
65
|
|
|
82
|
-
context 'with autostart
|
|
66
|
+
context 'with autostart is true' do
|
|
83
67
|
it 'should not start Msgr' do
|
|
84
|
-
expect(Msgr).
|
|
85
|
-
expect(Msgr::Railtie).to receive(:load_config).and_return({ "test" => { uri: 'test', autostart:
|
|
68
|
+
expect(Msgr).to receive(:start)
|
|
69
|
+
expect(Msgr::Railtie).to receive(:load_config).and_return({ "test" => { uri: 'test', autostart: true} })
|
|
86
70
|
Msgr::Railtie.load config
|
|
87
71
|
end
|
|
88
72
|
end
|
|
89
73
|
|
|
90
74
|
context 'without autostart value' do
|
|
91
75
|
it 'should not start Msgr' do
|
|
92
|
-
expect(Msgr).
|
|
76
|
+
expect(Msgr).to_not receive(:start)
|
|
93
77
|
expect(Msgr::Railtie).to receive(:load_config).and_return({ "test" => { uri: 'test' } })
|
|
94
78
|
Msgr::Railtie.load config
|
|
95
79
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: msgr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jan Graichen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-03-
|
|
11
|
+
date: 2014-03-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|