lapine 1.0.0 → 1.0.1
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/Changelog.md +6 -0
- data/lib/lapine.rb +4 -6
- data/lib/lapine/dtrace.rb +1 -1
- data/lib/lapine/errors.rb +6 -0
- data/lib/lapine/exchange.rb +2 -1
- data/lib/lapine/publisher.rb +6 -2
- data/lib/lapine/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17ff6eda9eaea1807ee77240e11fa2dc336f7350
|
4
|
+
data.tar.gz: b94a4cbada011e8f4fe12e6873b2def2ab923e27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f68160452a12c78121c0175e2cbf8448924a6d4dd075de8e5051628240cb097b2e3bf8ecd6bf3b5779a83b3a8b24fb020fdd7b977caa71d236628bb44ea68d13
|
7
|
+
data.tar.gz: 391d24cbd65e613f44f46df60eca15c1958c20466b01eb3425faea7448225127f45f6e78758ddc7f3b2b9ef56ce4259bfa1fe283c68c768b5bbde7bd214b9dbf
|
data/Changelog.md
CHANGED
data/lib/lapine.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
require 'lapine/version'
|
2
|
+
require 'lapine/errors'
|
2
3
|
require 'lapine/configuration'
|
3
4
|
require 'lapine/exchange'
|
4
5
|
require 'lapine/publisher'
|
5
6
|
require 'lapine/annotated_logger'
|
6
7
|
|
7
8
|
module Lapine
|
8
|
-
class UndefinedConnection < StandardError; end
|
9
|
-
class UndefinedExchange < StandardError; end
|
10
|
-
|
11
9
|
def self.config
|
12
10
|
@config ||= Configuration.new
|
13
11
|
end
|
@@ -18,14 +16,14 @@ module Lapine
|
|
18
16
|
|
19
17
|
def self.add_exchange(name, properties)
|
20
18
|
connection = properties[:connection]
|
21
|
-
raise UndefinedConnection unless connection
|
22
|
-
raise UndefinedConnection unless config.connection_properties[connection]
|
19
|
+
raise UndefinedConnection.new("No connection for #{name}, properties: #{properties}") unless connection
|
20
|
+
raise UndefinedConnection.new("No connection properties for #{name}, properties: #{properties}") unless config.connection_properties[connection]
|
23
21
|
config.exchange_properties[name] = properties
|
24
22
|
end
|
25
23
|
|
26
24
|
def self.find_exchange(name)
|
27
25
|
exchange = config.exchange_properties[name]
|
28
|
-
raise UndefinedExchange unless exchange
|
26
|
+
raise UndefinedExchange.new("No exchange for #{name}") unless exchange
|
29
27
|
return config.exchanges[name].exchange if config.exchanges[name]
|
30
28
|
config.exchanges[name] = Lapine::Exchange.new(name, exchange)
|
31
29
|
config.exchanges[name].exchange
|
data/lib/lapine/dtrace.rb
CHANGED
@@ -22,7 +22,7 @@ module Lapine
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.fire!(probe_name, *args)
|
25
|
-
raise "Unknown probe: #{probe_name}" unless self.provider.probes[probe_name]
|
25
|
+
raise ArgumentError.new("Unknown probe: #{probe_name}") unless self.provider.probes[probe_name]
|
26
26
|
probe = self.provider.probes[probe_name]
|
27
27
|
probe.fire(*args) if probe.enabled?
|
28
28
|
end
|
data/lib/lapine/exchange.rb
CHANGED
data/lib/lapine/publisher.rb
CHANGED
@@ -8,7 +8,7 @@ module Lapine
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def publish(routing_key = nil)
|
11
|
-
Lapine.find_exchange(self.class.
|
11
|
+
Lapine.find_exchange(self.class.current_lapine_exchange).publish(to_json, routing_key: routing_key)
|
12
12
|
end
|
13
13
|
|
14
14
|
def to_json
|
@@ -17,7 +17,11 @@ module Lapine
|
|
17
17
|
|
18
18
|
module ClassMethods
|
19
19
|
def exchange(name)
|
20
|
-
@
|
20
|
+
@lapine_exchange = name
|
21
|
+
end
|
22
|
+
|
23
|
+
def current_lapine_exchange
|
24
|
+
@lapine_exchange
|
21
25
|
end
|
22
26
|
end
|
23
27
|
end
|
data/lib/lapine/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lapine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Saxby
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-02-
|
12
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: amqp
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- lib/lapine/consumer/runner.rb
|
185
185
|
- lib/lapine/consumer/topology.rb
|
186
186
|
- lib/lapine/dtrace.rb
|
187
|
+
- lib/lapine/errors.rb
|
187
188
|
- lib/lapine/exchange.rb
|
188
189
|
- lib/lapine/publisher.rb
|
189
190
|
- lib/lapine/test/exchange.rb
|