jackal 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/jackal/formatter.rb +12 -1
- data/lib/jackal/loader.rb +13 -2
- data/lib/jackal/version.rb +1 -1
- 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: ff99ce5082a3420d7bd3e8b37080b6c45cc6a631
|
4
|
+
data.tar.gz: 181ebc2ce81ee6975634876df0c837432842fb62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fa1626917c81a7b48079c4cbb06b59a68c42a6010cad6bce62139526d447a6c8f05f3061a109a87751602d576b20932c8b1ed5daf1c055db80f247502fe6ce5
|
7
|
+
data.tar.gz: f903b018316cee786c2029341474577fd66e75871c2bdbc91b479dcfb24a925b0461046c8aaf48edf7b2c7e3a317e15ead4f7339cb26acb9ecc7d4f76a92cc30
|
data/CHANGELOG.md
CHANGED
data/lib/jackal/formatter.rb
CHANGED
@@ -26,7 +26,8 @@ module Jackal
|
|
26
26
|
# Create a new instance
|
27
27
|
#
|
28
28
|
# @return [self]
|
29
|
-
def initialize
|
29
|
+
def initialize(callback=nil)
|
30
|
+
@callback = callback
|
30
31
|
[:SOURCE, :DESTINATION].each do |key|
|
31
32
|
unless(self.class.const_get(key))
|
32
33
|
raise NotImplementedError.new("Formatter class must define #{key} constant")
|
@@ -34,6 +35,16 @@ module Jackal
|
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
38
|
+
# Provide a simple proxy out to originating callback if provided
|
39
|
+
# to access helpers
|
40
|
+
def method_missing(m_name, *args, &block)
|
41
|
+
if(@callback && @callback.respond_to?(m_name))
|
42
|
+
@callback.send(m_name, *args, &block)
|
43
|
+
else
|
44
|
+
super
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
37
48
|
# @return [Symbol]
|
38
49
|
def source
|
39
50
|
self.class.const_get(:SOURCE).to_sym
|
data/lib/jackal/loader.rb
CHANGED
@@ -37,12 +37,23 @@ module Jackal
|
|
37
37
|
:type => source_args[:type].to_sym,
|
38
38
|
:args => source_args.fetch(:args, {}).merge(:name => "#{namespace}_#{key}_#{kind}"),
|
39
39
|
:orphan_callback => lambda{|message|
|
40
|
-
|
40
|
+
warn "No callbacks matched message. Auto confirming message from source. (#{message})"
|
41
41
|
message.confirm!
|
42
|
+
if(name.to_s.end_with?('input'))
|
43
|
+
destination = Carnivore::Supervisor.supervisor[name.to_s.sub('_input', '_output')]
|
44
|
+
if(destination)
|
45
|
+
warn "Auto pushing orphaned message to next destination (#{message} -> #{destination.name})"
|
46
|
+
begin
|
47
|
+
destination.transmit(Utils.unpack(message))
|
48
|
+
rescue => e
|
49
|
+
error "Failed to auto push message (#{message}): #{e.class} - #{e}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
42
53
|
}
|
43
54
|
)
|
44
55
|
Carnivore::Utils.info "Registered new source: #{namespace}_#{key}_#{kind}"
|
45
|
-
if(kind ==
|
56
|
+
if(kind.to_s == 'input')
|
46
57
|
opts.fetch(:callbacks, []).each do |klass_name|
|
47
58
|
klass = Utils.constantize(klass_name)
|
48
59
|
source.add_callback(klass_name, klass)
|
data/lib/jackal/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jackal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carnivore
|