msgr 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b23217108455c5fa7ffc2234c8794e95b42ea10b
4
- data.tar.gz: 5209c89733bc064d09a4ca7a706a2abdaf49ce17
3
+ metadata.gz: 215a101ca6344455fab1e0f317255ade10db36ba
4
+ data.tar.gz: 4b385815fa5c1c614e0455c38b8804561a4ad5df
5
5
  SHA512:
6
- metadata.gz: 260954767ff2fa347eeae118ac9ba9e7e75e5da624ef98b408e560a81822f1831c532fc6f6428b783e13c70d67c6bebc248ba0d8974fe97822a4396a8e97b5f8
7
- data.tar.gz: 996f1024666f2f3232fe92b9ca047f0425e94020405b2e4e0aff9002fb412e319ded02ea3d59cb71e2d10748d3ce7d9c6d9dc1ef8bb0c4cc6c8751e9337c5881
6
+ metadata.gz: 17ae46bee690a9f5f5b661d444f0937e0cc60431274dc72f681992f67a97497012735929b6c9167764b7ed90ade36b234e1165e00bcfb45666aec78127edadac
7
+ data.tar.gz: 107d3c4a8bb486f8239f078b4c20371a22719d139f7433e34c959e9ffbfec8ef9ebb070946264b38640ff93a1e519476dc5c1f567910a936fbb0d615113e0fcd
data/Gemfile CHANGED
@@ -26,7 +26,6 @@ end
26
26
 
27
27
  platform :rbx do
28
28
  gem 'rubysl'
29
- gem 'rubysl-json'
30
29
  gem 'rubinius-coverage'
31
30
  gem 'racc'
32
31
  end
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.' unless config.is_a? Hash
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
- client = Msgr::Client.new config[Rails.env]
32
- client.routes.files << app.config.msgr.routes_file
33
- client.routes.reload
30
+ if config[Rails.env].is_a?(Hash)
31
+ cfg = HashWithIndifferentAccess.new config[Rails.env]
34
32
 
35
- if Rails.env.development?
36
- reloader = ActiveSupport::FileUpdateChecker.new client.routes.files do
37
- client.routes.reload
38
- client.reload
39
- end
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
- ActionDispatch::Reloader.to_prepare do
42
- reloader.execute_if_updated
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
@@ -1,8 +1,8 @@
1
1
  module Msgr
2
2
  module VERSION
3
3
  MAJOR = 0
4
- MINOR = 1
5
- PATCH = 1
4
+ MINOR = 2
5
+ PATCH = 0
6
6
  STAGE = nil
7
7
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.')
8
8
 
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.1.1
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-20 00:00:00.000000000 Z
11
+ date: 2014-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport