loggregator_emitter 0.0.8.pre → 0.0.9.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/loggregator_emitter/emit.rb +2 -1
- data/loggregator_emitter.gemspec +1 -1
- data/spec/loggregator_emitter/emit_spec.rb +8 -0
- metadata +2 -2
data/Gemfile.lock
CHANGED
@@ -5,7 +5,8 @@ module LoggregatorEmitter
|
|
5
5
|
class Emitter
|
6
6
|
def initialize(loggregator_server, source_type)
|
7
7
|
host, port = loggregator_server.split(":")
|
8
|
-
raise RuntimeError, "Must
|
8
|
+
raise RuntimeError, "Must provide valid loggregator server: #{loggregator_server}" if (host == nil || port == nil)
|
9
|
+
raise RuntimeError, "Must provide IP address for loggregator server: #{loggregator_server}" unless host.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)
|
9
10
|
@sockaddr_in = Socket.sockaddr_in(port, host)
|
10
11
|
|
11
12
|
raise RuntimeError, "Must provide valid source type" unless valid_source_type?(source_type)
|
data/loggregator_emitter.gemspec
CHANGED
@@ -20,6 +20,14 @@ describe LoggregatorEmitter do
|
|
20
20
|
it 'raises if source_type is invalid' do
|
21
21
|
expect { LoggregatorEmitter::Emitter.new('0.0.0.0:12345', 40) }.to raise_error(RuntimeError)
|
22
22
|
end
|
23
|
+
|
24
|
+
it 'raises if host is not ip is invalid' do
|
25
|
+
expect { LoggregatorEmitter::Emitter.new('localhost:12345', 40) }.to raise_error(RuntimeError)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'raises if host has protocol' do
|
29
|
+
expect { LoggregatorEmitter::Emitter.new('http://0.0.0.0:12345', 40) }.to raise_error(RuntimeError)
|
30
|
+
end
|
23
31
|
end
|
24
32
|
|
25
33
|
describe 'Sending To STDOUT' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loggregator_emitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9.pre
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: loggregator_messages
|