fluent-plugin-grep 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01a71925261dd9465cd10f28acf6af28861d9f6b
4
- data.tar.gz: cfacc3cb357efeacff1d486f0451ec3952db8a61
3
+ metadata.gz: 08a91d586b4f1b69b5859a4b504d6f20a2dcb885
4
+ data.tar.gz: 8b1e714a1fcc6121d1ea8b5cdbefb88b76866a67
5
5
  SHA512:
6
- metadata.gz: d885ec8a7c2180fdbc581b821fa826240b5aef21c120a5425f29f283d491f300f2fb84ea7abbfd7b2e76b555f69aa951833da598b6d35ebc5ac3359861547111
7
- data.tar.gz: 0c88d08c8f7e6a3f40191d54db854e59f47e13c2ec7259dac9de768f14eaf2df2c013d0eb4229aed50c186be623a2392fdb43d47e723dac135f9af9e60a641ac
6
+ metadata.gz: 0abf3dd5a6c4638eb2d27d36435844a164c74f0fc94faf551aa24d8cbccc8b29fdfcb5c4bdec3d3aca71f959fa701b7224cbd2200ca9572e8ef1ad67c8dc1ca9
7
+ data.tar.gz: c59f53e395fc5b0b14082c14452a977ac49e0ee925cfa32e3c99554c1e4d8a3c89d36c827d7c2e3e2ef08ef44302bcf8d0022522321494738227b02692d472fd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.3.1 (2013/12/16)
2
+
3
+ Changes:
4
+
5
+ - Make it possible that regexp to contain a heading space on `regexpN` and `excludeN` option.
6
+
1
7
  ## 0.3.0 (2013/12/15)
2
8
 
3
9
  Features:
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "fluent-plugin-grep"
6
- s.version = "0.3.0"
6
+ s.version = "0.3.1"
7
7
  s.authors = ["Naotoshi Seo"]
8
8
  s.email = ["sonots@gmail.com"]
9
9
  s.homepage = "https://github.com/sonots/fluent-plugin-grep"
@@ -22,5 +22,6 @@ Gem::Specification.new do |s|
22
22
  s.add_development_dependency "rake"
23
23
  s.add_development_dependency "rspec"
24
24
  s.add_development_dependency "pry"
25
+ s.add_development_dependency "pry-nav"
25
26
  s.add_development_dependency 'coveralls'
26
27
  end
@@ -13,6 +13,10 @@ class Fluent::GrepOutput < Fluent::Output
13
13
  (1..REGEXP_MAX_NUM).each {|i| config_param :"regexp#{i}", :string, :default => nil }
14
14
  (1..REGEXP_MAX_NUM).each {|i| config_param :"exclude#{i}", :string, :default => nil }
15
15
 
16
+ # for test
17
+ attr_reader :regexps
18
+ attr_reader :excludes
19
+
16
20
  def configure(conf)
17
21
  super
18
22
 
@@ -20,8 +24,9 @@ class Fluent::GrepOutput < Fluent::Output
20
24
  @regexps[@input_key] = Regexp.compile(@regexp) if @input_key and @regexp
21
25
  (1..REGEXP_MAX_NUM).each do |i|
22
26
  next unless conf["regexp#{i}"]
23
- key, regexp = conf["regexp#{i}"].split(/ +/, 2)
27
+ key, regexp = conf["regexp#{i}"].split(/ /, 2)
24
28
  raise Fluent::ConfigError, "regexp#{i} does not contain 2 parameters" unless regexp
29
+ raise Fluent::ConfigError, "regexp#{i} contains a duplicated key, #{key}" if @regexps[key]
25
30
  @regexps[key] = Regexp.compile(regexp)
26
31
  end
27
32
 
@@ -29,8 +34,9 @@ class Fluent::GrepOutput < Fluent::Output
29
34
  @excludes[@input_key] = Regexp.compile(@exclude) if @input_key and @exclude
30
35
  (1..REGEXP_MAX_NUM).each do |i|
31
36
  next unless conf["exclude#{i}"]
32
- key, exclude = conf["exclude#{i}"].split(/ +/, 2)
37
+ key, exclude = conf["exclude#{i}"].split(/ /, 2)
33
38
  raise Fluent::ConfigError, "exclude#{i} does not contain 2 parameters" unless exclude
39
+ raise Fluent::ConfigError, "exclude#{i} contains a duplicated key, #{key}" if @excludes[key]
34
40
  @excludes[key] = Regexp.compile(exclude)
35
41
  end
36
42
 
@@ -11,6 +11,22 @@ describe Fluent::GrepOutput do
11
11
 
12
12
  describe 'test configure' do
13
13
  describe 'bad configuration' do
14
+ context 'regexp contains a duplicated key' do
15
+ let(:config) { CONFIG + %[
16
+ input_key message
17
+ regexp foo
18
+ regexp1 message foo
19
+ ]}
20
+ it { expect { driver }.to raise_error(Fluent::ConfigError) }
21
+ end
22
+ context 'exclude contains a duplicated key' do
23
+ let(:config) { CONFIG + %[
24
+ input_key message
25
+ exclude foo
26
+ exclude1 message foo
27
+ ]}
28
+ it { expect { driver }.to raise_error(Fluent::ConfigError) }
29
+ end
14
30
  end
15
31
 
16
32
  describe 'good configuration' do
@@ -24,6 +40,16 @@ describe Fluent::GrepOutput do
24
40
  its(:tag) { should be_nil }
25
41
  its(:add_tag_prefix) { should == 'greped' }
26
42
  end
43
+
44
+ context "regexpN can contain a space" do
45
+ let(:config) { CONFIG + %[regexp1 message foo] }
46
+ it { subject.regexps['message'].should == Regexp.compile(/ foo/) }
47
+ end
48
+
49
+ context "excludeN can contain a space" do
50
+ let(:config) { CONFIG + %[exclude1 message foo] }
51
+ it { subject.excludes['message'].should == Regexp.compile(/ foo/) }
52
+ end
27
53
  end
28
54
  end
29
55
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-grep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-14 00:00:00.000000000 Z
11
+ date: 2013-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-nav
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: coveralls
71
85
  requirement: !ruby/object:Gem::Requirement