msgr 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/lib/msgr/railtie.rb +30 -15
- data/lib/msgr/version.rb +2 -2
- 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: 215a101ca6344455fab1e0f317255ade10db36ba
|
4
|
+
data.tar.gz: 4b385815fa5c1c614e0455c38b8804561a4ad5df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17ae46bee690a9f5f5b661d444f0937e0cc60431274dc72f681992f67a97497012735929b6c9167764b7ed90ade36b234e1165e00bcfb45666aec78127edadac
|
7
|
+
data.tar.gz: 107d3c4a8bb486f8239f078b4c20371a22719d139f7433e34c959e9ffbfec8ef9ebb070946264b38640ff93a1e519476dc5c1f567910a936fbb0d615113e0fcd
|
data/Gemfile
CHANGED
data/lib/msgr/railtie.rb
CHANGED
@@ -25,26 +25,41 @@ module Msgr
|
|
25
25
|
cfile = app.config.msgr.rabbitmq_config.to_s
|
26
26
|
config = YAML.load ERB.new(File.read(cfile)).result
|
27
27
|
|
28
|
-
raise ArgumentError, 'Could not load rabbitmq config
|
29
|
-
raise ArgumentError, 'Could not load rabbitmq environment config ' unless config[Rails.env]
|
28
|
+
raise ArgumentError, 'Could not load rabbitmq config: Config must be a Hash' unless config.is_a? Hash
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
client.routes.reload
|
30
|
+
if config[Rails.env].is_a?(Hash)
|
31
|
+
cfg = HashWithIndifferentAccess.new config[Rails.env]
|
34
32
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
if cfg[:enabled].nil? || cfg[:enabled] == 'true'
|
34
|
+
if cfg[:uri]
|
35
|
+
client = Msgr::Client.new
|
36
|
+
client.routes.files << app.config.msgr.routes_file
|
37
|
+
client.routes.reload
|
38
|
+
|
39
|
+
if Rails.env.development? || config
|
40
|
+
reloader = ActiveSupport::FileUpdateChecker.new client.routes.files do
|
41
|
+
client.routes.reload
|
42
|
+
client.reload
|
43
|
+
end
|
44
|
+
|
45
|
+
ActionDispatch::Reloader.to_prepare do
|
46
|
+
reloader.execute_if_updated
|
47
|
+
end
|
48
|
+
end
|
40
49
|
|
41
|
-
|
42
|
-
|
50
|
+
Msgr.client = client
|
51
|
+
client.start
|
52
|
+
else
|
53
|
+
raise ArgumentError, 'Could not load rabbitmq environment config: URI missing.'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
else
|
57
|
+
if Rails.env.production?
|
58
|
+
raise ArgumentError, 'Could not load rabbitmq environment config: Not a hash.'
|
59
|
+
else
|
60
|
+
Rails.logger.warn 'Could not load rabbitmq environment config: Not a hash.'
|
43
61
|
end
|
44
62
|
end
|
45
|
-
|
46
|
-
Msgr.client = client
|
47
|
-
client.start
|
48
63
|
end
|
49
64
|
end
|
50
65
|
end
|
data/lib/msgr/version.rb
CHANGED
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.2.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-02-
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|