msgr 0.8.0 → 0.9.0

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: e8a5f1855aedba423ec56af15b0c7eaae43de164
4
- data.tar.gz: f381c0d8a3e7f03c71cf74f0442ed2f5da542513
3
+ metadata.gz: 7d7147b5f93af8abbb88769c9bc5ad79e6aaccce
4
+ data.tar.gz: 51d0238c5a3f1da6c31727096f696741f2ed86cf
5
5
  SHA512:
6
- metadata.gz: 9b81be68fb9dfc0e0f85ced01240f2d9893378413bec0e29a1026b8b184596ba2854047872261b02b8ab22908a4b29889201ddc1856a38b706c3f8c77a0286f2
7
- data.tar.gz: 68991d14641cee9915128bf7bd03ac371c7bcd8efda5803cfed61dca4da1c09d4415f873384ec48dd7c1a733c0306a1e68faca2f84a2b46b630bae58bbd9b0d2
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) { 'Fork detected. Reset internal state...' }
102
+ log(:warn) { "Fork detected. Reset internal state. (Old PID: #{@pid} / New PID: #{::Process.pid}" }
103
103
 
104
104
  reset
105
- @pid = ::Process.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', nil
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
@@ -1,7 +1,7 @@
1
1
  module Msgr
2
2
  module VERSION
3
3
  MAJOR = 0
4
- MINOR = 8
4
+ MINOR = 9
5
5
  PATCH = 0
6
6
  STAGE = nil
7
7
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.')
@@ -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 = false' do
66
+ context 'with autostart is true' do
83
67
  it 'should not start Msgr' do
84
- expect(Msgr).not_to receive(:start)
85
- expect(Msgr::Railtie).to receive(:load_config).and_return({ "test" => { uri: 'test', autostart: false} })
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).to receive(:start)
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.8.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-20 00:00:00.000000000 Z
11
+ date: 2014-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport