stapfen 2.2.1-java → 3.0.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -27
- data/lib/stapfen.rb +15 -3
- data/lib/stapfen/client/kafka.rb +11 -1
- data/lib/stapfen/version.rb +1 -1
- data/lib/stapfen/worker.rb +158 -148
- data/spec/client/kafka_spec.rb +33 -4
- data/spec/spec_helper.rb +1 -0
- data/spec/worker_spec.rb +346 -201
- data/stapfen.gemspec +1 -1
- metadata +3 -6
- data/lib/stapfen/logger.rb +0 -48
- data/spec/logger_spec.rb +0 -41
data/stapfen.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stapfen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- R. Tyler Croy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,7 +45,6 @@ files:
|
|
45
45
|
- lib/stapfen/client/kafka.rb
|
46
46
|
- lib/stapfen/client/stomp.rb
|
47
47
|
- lib/stapfen/destination.rb
|
48
|
-
- lib/stapfen/logger.rb
|
49
48
|
- lib/stapfen/message.rb
|
50
49
|
- lib/stapfen/version.rb
|
51
50
|
- lib/stapfen/worker.rb
|
@@ -54,7 +53,6 @@ files:
|
|
54
53
|
- spec/client/stomp_spec.rb
|
55
54
|
- spec/client_spec.rb
|
56
55
|
- spec/destination_spec.rb
|
57
|
-
- spec/logger_spec.rb
|
58
56
|
- spec/message_spec.rb
|
59
57
|
- spec/spec_helper.rb
|
60
58
|
- spec/worker_spec.rb
|
@@ -78,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
76
|
version: '0'
|
79
77
|
requirements: []
|
80
78
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
79
|
+
rubygems_version: 2.4.5
|
82
80
|
signing_key:
|
83
81
|
specification_version: 4
|
84
82
|
summary: A simple gem for writing good basic STOMP workers
|
@@ -88,7 +86,6 @@ test_files:
|
|
88
86
|
- spec/client/stomp_spec.rb
|
89
87
|
- spec/client_spec.rb
|
90
88
|
- spec/destination_spec.rb
|
91
|
-
- spec/logger_spec.rb
|
92
89
|
- spec/message_spec.rb
|
93
90
|
- spec/spec_helper.rb
|
94
91
|
- spec/worker_spec.rb
|
data/lib/stapfen/logger.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
|
2
|
-
module Stapfen
|
3
|
-
# Logging module to ensure that {{Stapfen::Worker}} classes can perform
|
4
|
-
# logging if they've been configured to
|
5
|
-
module Logger
|
6
|
-
# Collection of methods to pass arguments through from the class and
|
7
|
-
# instance level to a configured logger
|
8
|
-
PROXY_METHODS = [:info, :debug, :warn, :error].freeze
|
9
|
-
|
10
|
-
module ClassMethods
|
11
|
-
PROXY_METHODS.each do |method|
|
12
|
-
define_method(method) do |*args|
|
13
|
-
proxy_log_method(method, args)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def proxy_log_method(method, arguments)
|
20
|
-
if self.logger
|
21
|
-
self.logger.call.send(method, *arguments)
|
22
|
-
return true
|
23
|
-
end
|
24
|
-
return false
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.included(klass)
|
29
|
-
klass.extend(ClassMethods)
|
30
|
-
end
|
31
|
-
|
32
|
-
PROXY_METHODS.each do |method|
|
33
|
-
define_method(method) do |*args|
|
34
|
-
proxy_log_method(method, args)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def proxy_log_method(method, arguments)
|
41
|
-
if self.class.logger
|
42
|
-
self.class.logger.call.send(method, *arguments)
|
43
|
-
return true
|
44
|
-
end
|
45
|
-
return false
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
data/spec/logger_spec.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Stapfen::Logger do
|
4
|
-
let(:mixin) do
|
5
|
-
Class.new do
|
6
|
-
include Stapfen::Logger
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
subject(:logger) { mixin.new }
|
11
|
-
|
12
|
-
context 'instance methods' do
|
13
|
-
it { should respond_to :info }
|
14
|
-
it { should respond_to :debug }
|
15
|
-
it { should respond_to :warn }
|
16
|
-
it { should respond_to :error }
|
17
|
-
|
18
|
-
context 'without an initialized logger' do
|
19
|
-
before :each do
|
20
|
-
logger.class.stub(:logger)
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should discard info messages' do
|
24
|
-
expect(logger.info('rspec')).to be false
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context 'with an initialized logger' do
|
29
|
-
let(:plogger) { double('RSpec Logger') }
|
30
|
-
|
31
|
-
before :each do
|
32
|
-
logger.class.stub(:logger).and_return(lambda { plogger })
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'should pass info messages along' do
|
36
|
-
plogger.should_receive(:info)
|
37
|
-
expect(logger.info('rspec')).to be true
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|