watership 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/watership/version.rb +1 -1
- data/lib/watership.rb +14 -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: 56677c57d836c14527c4f17df9988561f3972c27
|
4
|
+
data.tar.gz: 27ea7ce1bd196216472f2140a2fa4367ae01ef18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba65da99ea01c47e4b1da2cc9fde44f094c68178a028ec54301ea029eddf4e6a0de94da296e452c7fdce87d0635f9313ae9e03fc34702c3b30e5e19d533d0158
|
7
|
+
data.tar.gz: 97eed4dccb8d43e852fd196dd9bbcc0d9faabd859a6d8f2bf9c4c0c9e9ab7fa6a6839115f32e26239fe965324723896b522df3aaee36afa67e27757960ba820e
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Watership is a wrapper around Bunny. It attempts to catch connection issues to the RabbitMQ server and provide a fake backend, switching back to the real backend when it becomes available.
|
4
4
|
|
5
|
-
|
5
|
+
It is currently being used in production on a set of applications, but be warned that it's still early in its life.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
data/lib/watership/version.rb
CHANGED
data/lib/watership.rb
CHANGED
@@ -11,6 +11,10 @@ module Watership
|
|
11
11
|
]
|
12
12
|
|
13
13
|
class << self
|
14
|
+
def environment=(env)
|
15
|
+
@env = env
|
16
|
+
end
|
17
|
+
|
14
18
|
def config=(path)
|
15
19
|
@config = IO.read(path).chomp
|
16
20
|
end
|
@@ -25,7 +29,7 @@ module Watership
|
|
25
29
|
queue.publish(JSON.generate(message))
|
26
30
|
rescue StandardError => exception
|
27
31
|
fallback.call if fallback
|
28
|
-
|
32
|
+
notify(exception)
|
29
33
|
logger.error(exception.class.name)
|
30
34
|
end
|
31
35
|
|
@@ -42,7 +46,7 @@ module Watership
|
|
42
46
|
def channel
|
43
47
|
$channel ||= connection.create_channel
|
44
48
|
rescue *CONNECTION_EXCEPTIONS => exception
|
45
|
-
|
49
|
+
notify(exception)
|
46
50
|
$channel = nil
|
47
51
|
end
|
48
52
|
|
@@ -50,6 +54,14 @@ module Watership
|
|
50
54
|
Bunny.new(@config).tap { |bunny| bunny.start }
|
51
55
|
end
|
52
56
|
|
57
|
+
def notify(exception)
|
58
|
+
Airbrake.notify_or_ignore(exception) if defined?(Airbrake) && @env == 'production'
|
59
|
+
end
|
60
|
+
|
61
|
+
def logger=(logger)
|
62
|
+
@logger = logger
|
63
|
+
end
|
64
|
+
|
53
65
|
def logger
|
54
66
|
@logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
55
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watership
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Scofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|