fluent-plugin-script 0.0.4 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d65cd428e94420db53c0bb98d13c70c3bcc77b38
4
- data.tar.gz: 06342a822a3c23facd9ea046e1923f91f02bf940
3
+ metadata.gz: 8b7c2a59a03a4142ff2215547ad71758f0e5dd7f
4
+ data.tar.gz: e722d96124e96dfedf35b423ab69911053349c4c
5
5
  SHA512:
6
- metadata.gz: 5eb1fe8c00da41a6cc46b7ecb79af5d8ef24c45a90db6062c31a3e917038121a7da51e5948025df3d3f07e12ad94c63de91d3d25e4c3aea3ffca65b19e884719
7
- data.tar.gz: d5a7a4cd81dd8cb41d0248c874770992692849fdc75e729d97a7d34bccfbbabb735997923a40a078e3863edf288498a02d0640e002c48e2a1ccc8811c0944fdc
6
+ metadata.gz: 9851a8d70d497e63d03c9f1d659700cd39a0735ac07017429f5caa82d1780086122e5279302e53a2e218a80d276e4d92b45569252130ec6da8f0db81c029d332
7
+ data.tar.gz: de4ac6ced65451d860dbc569a22fdd68cabc05c0653196bfe0994f20bae36ca5157b080092d7d20ba3367539ce80bf7787262121222792fce44ad9d29e23bef0
@@ -1,4 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "2.2.2"
4
- - "2.1.6"
3
+ - 2.4.2
4
+ - 2.3.5
5
+ - 2.2
6
+ - 2.1
data/README.md CHANGED
@@ -11,6 +11,13 @@ Fluent filter plugin to external ruby script.
11
11
  gem install fluent-plugin-filter-script
12
12
  ``
13
13
 
14
+ ### Requirements
15
+
16
+ | fluent-plugin-script | fluentd |
17
+ |----------------------|------------|
18
+ | >= 0.1.0 | >= v0.14.0 |
19
+ | < 0.0.4 | < v0.14.0 |
20
+
14
21
  ## Configuration
15
22
 
16
23
  #### fluent.conf
@@ -27,7 +34,7 @@ gem install fluent-plugin-filter-script
27
34
  def start
28
35
  super
29
36
  # This is the first method to be called when it starts running
30
- # Use it to allocate resources, etc.
37
+ # Use it to allocate resources, etc.
31
38
  end
32
39
 
33
40
  def shutdown
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "fluent-plugin-script"
3
- s.version = "0.0.4"
3
+ s.version = "0.1.0"
4
4
  s.licenses = ["MIT"]
5
5
  s.summary = "Fluentd filter plugin to external ruby script"
6
6
  s.description = s.summary
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.test_files = `git ls-files -- test/*`.split("\n")
12
12
  s.require_paths = ["lib"]
13
13
 
14
- s.add_runtime_dependency "fluentd", "~> 0.12.0"
14
+ s.add_runtime_dependency "fluentd", [">= 0.14.0", "< 2"]
15
15
  s.add_development_dependency "rake", "~> 10.4.2"
16
16
  s.add_development_dependency "test-unit", "~> 3.1.3"
17
17
  end
@@ -1,6 +1,8 @@
1
- module Fluent
1
+ require 'fluent/plugin/filter'
2
+
3
+ module Fluent::Plugin
2
4
  class ScriptFilter < Filter
3
- Plugin.register_filter('script', self)
5
+ Fluent::Plugin.register_filter('script', self)
4
6
 
5
7
  config_param :path, :string
6
8
 
@@ -10,9 +12,12 @@ module Fluent
10
12
  end
11
13
 
12
14
  def load_script_file(path)
13
- raise ConfigError, "Ruby script file does not exist: #{path}" unless File.exist?(path)
15
+ raise Fluent::ConfigError, "Ruby script file does not exist: #{path}" unless File.exist?(path)
14
16
  eval "self.instance_eval do;" + IO.read(path) + ";\nend"
15
17
  end
18
+
19
+ def filter(tag, time, record)
20
+ # Overwritten by evaluated script.
21
+ end
16
22
  end
17
23
  end
18
-
@@ -1,6 +1,7 @@
1
1
  require 'test/unit'
2
2
  require 'fluent/log'
3
3
  require 'fluent/test'
4
+ require 'fluent/test/driver/filter'
4
5
  require 'fluent/plugin/filter_script'
5
6
 
6
7
  class RubyFilterTest < Test::Unit::TestCase
@@ -11,7 +12,7 @@ class RubyFilterTest < Test::Unit::TestCase
11
12
  end
12
13
 
13
14
  def create_driver(conf = '')
14
- Test::FilterTestDriver.new(ScriptFilter).configure(conf, true)
15
+ Test::Driver::Filter.new(Plugin::ScriptFilter).configure(conf)
15
16
  end
16
17
 
17
18
  sub_test_case 'configure' do
@@ -32,9 +33,10 @@ class RubyFilterTest < Test::Unit::TestCase
32
33
  sub_test_case 'filter' do
33
34
  def emit(conf, msg)
34
35
  d = create_driver(conf)
35
- d.run {
36
- d.emit({'foo' => 'bar', 'message' => msg}, Fluent::Engine.now)
37
- }.filtered
36
+ d.run(default_tag: 'test') {
37
+ d.feed(Fluent::Engine.now, {'foo' => 'bar', 'message' => msg})
38
+ }
39
+ d.filtered
38
40
  end
39
41
  test 'execute filter' do
40
42
  conf = "path #{__dir__}/example.rb"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-script
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SNakano
@@ -14,16 +14,22 @@ dependencies:
14
14
  name: fluentd
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.14.0
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: 0.12.0
22
+ version: '2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.14.0
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 0.12.0
32
+ version: '2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rake
29
35
  requirement: !ruby/object:Gem::Requirement