fluent-plugin-forest 0.2.4 → 0.3.0

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: a3258fc645b387ab5f9dbd03981fff601d5ee66a
4
- data.tar.gz: 1254f5e53ce7d0ecb7195033c459f3a02c7d1976
3
+ metadata.gz: 05ff9d75e8864a29e9ae2c43cdff96a137e53062
4
+ data.tar.gz: f75361da08c4990575e0e8938df23c36f0b64465
5
5
  SHA512:
6
- metadata.gz: d4a445761e331b96e551a18c18937bfef3dff23ea71d9510d3f4e40be851b66364ed8eb63acc7a76d59d007f639023eb459cc01696bc8f8af237d6ce2f9e3e1a
7
- data.tar.gz: f038b8287ff57a31ff260af1de9e8449e5659042719d81242551de828889d07a26497526521c3aa277b4ebe7ac66ca5d6d710c43d33154e790938f6f93070708
6
+ metadata.gz: a6b921ca4e6b17126bcf80988eea42a541ec9cb15dcdfd1fe079a9bc0f5f674b6b2b074ff2b1abd7f75362661475f7a5037799fa08b9735a5e2491989b13ffb2
7
+ data.tar.gz: 7925733f1ce183561d5d4f67ec291c8dfda7e0a024a95fb941ba12cd6cdc19fb28b8d202f9c752d0adcb5178d5a6d0f9196aaba40e079d7c4e3b80decc6bb78e
data/README.md CHANGED
@@ -156,6 +156,10 @@ Subsections with same arguments will be overwritten. See this example:
156
156
 
157
157
  In this case, `<route {search,admin}.*>` subsection will be overwritten to add prefix 'other' for tag `service.admin.*`.
158
158
 
159
+ ### For Configuration DSL
160
+
161
+ In DSL configurations, `case` is reserved by Ruby itself. Use `pattern` instead of `case`. `pattern` works just as same as `case`. (`v0.3.0` or later.)
162
+
159
163
  ## TODO
160
164
 
161
165
  * patches welcome!
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = "fluent-plugin-forest"
4
- gem.version = "0.2.4"
4
+ gem.version = "0.3.0"
5
5
  gem.authors = ["TAGOMORI Satoshi"]
6
6
  gem.email = ["tagomoris@gmail.com"]
7
7
  gem.description = %q{create sub-plugin dynamically per tags, with template configuration and parameters}
@@ -40,7 +40,7 @@ class Fluent::ForestOutput < Fluent::MultiOutput
40
40
  case element.name
41
41
  when 'template'
42
42
  @template = element
43
- when 'case'
43
+ when 'case', 'pattern'
44
44
  matcher = Fluent::GlobMatchPattern.new(element.arg)
45
45
  @cases.push([matcher, element])
46
46
  end
@@ -82,6 +82,52 @@ subtype hoge
82
82
  assert_equal 'd.zz', conf['alt_key']
83
83
  end
84
84
 
85
+ def test_spec_with_pattern_section
86
+ d = create_driver %[
87
+ subtype hoge
88
+ <template>
89
+ keyx xxxxxx
90
+ keyy yyyyyy.__TAG__
91
+ alt_key a
92
+ </template>
93
+ <pattern xx>
94
+ keyz z1
95
+ alt_key b
96
+ </pattern>
97
+ <pattern yy.**>
98
+ keyz z2
99
+ alt_key c
100
+ </pattern>
101
+ <pattern *>
102
+ keyz z3
103
+ alt_key d.__TAG__
104
+ </pattern>
105
+ ]
106
+ conf = d.instance.spec('xx')
107
+ assert_equal 'xxxxxx', conf['keyx']
108
+ assert_equal 'yyyyyy.xx', conf['keyy']
109
+ assert_equal 'z1', conf['keyz']
110
+ assert_equal 'b', conf['alt_key']
111
+
112
+ conf = d.instance.spec('yy')
113
+ assert_equal 'xxxxxx', conf['keyx']
114
+ assert_equal 'yyyyyy.yy', conf['keyy']
115
+ assert_equal 'z2', conf['keyz']
116
+ assert_equal 'c', conf['alt_key']
117
+
118
+ conf = d.instance.spec('yy.3')
119
+ assert_equal 'xxxxxx', conf['keyx']
120
+ assert_equal 'yyyyyy.yy.3', conf['keyy']
121
+ assert_equal 'z2', conf['keyz']
122
+ assert_equal 'c', conf['alt_key']
123
+
124
+ conf = d.instance.spec('zz')
125
+ assert_equal 'xxxxxx', conf['keyx']
126
+ assert_equal 'yyyyyy.zz', conf['keyy']
127
+ assert_equal 'z3', conf['keyz']
128
+ assert_equal 'd.zz', conf['alt_key']
129
+ end
130
+
85
131
  NESTED_CONF = %[
86
132
  subtype hoge
87
133
  <template>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-forest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TAGOMORI Satoshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-07 00:00:00.000000000 Z
11
+ date: 2014-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -87,3 +87,4 @@ test_files:
87
87
  - test/output/out_forest_test.rb
88
88
  - test/plugin/test_out_forest.rb
89
89
  - test/plugin/test_out_forest_test.rb
90
+ has_rdoc: