fluent-plugin-cat-sweep 0.1.2 → 0.1.3

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: 7c416b3c5df83179c396c4343661ca0d6edabf9c
4
- data.tar.gz: 99f032ae97d3276572f4d83c986a2b8cf9ed47bd
3
+ metadata.gz: a1a1bc310740299a8f62e3f801ba1715b5bbe7b6
4
+ data.tar.gz: 3d9b318ff11fc7f90ab805d7d10101dd93800555
5
5
  SHA512:
6
- metadata.gz: 7e04a78004b577267659870f282bca66eb6212892a013db0f2c1ada39d1c7b4829264afe1c2183c499e9b3a339f5da179fce52162119c8a5f17e564c5b595873
7
- data.tar.gz: 29e6a7cc393cb249f9008c387f4b7d42740177b6c1908aecbce54b31b8181ca910bae46a1d282eea19707e9bb01cb1aff802984316e079988812b46061ea92f0
6
+ metadata.gz: 8f74d5c1faf9b9f5190b58c219ed2d3c982a3779cb7d7d5fccc86637b1e000b718a420b97120bf37eaa61d2664bf1706cea693c469d99621229da170625802f8
7
+ data.tar.gz: 175666731ebeb4c8f7b1115b46f0437f7ccfafcca820d47beacd8cfa1e20bc5b20d4024eae3b6af471678192ef7c652d08390598e2b51c966fe36172ca9c7cd6
@@ -5,4 +5,6 @@ rvm:
5
5
  - 2.1.*
6
6
  - 2.2.*
7
7
  gemfile:
8
- - Gemfile
8
+ - gemfiles/Gemfile.fluentd.0.12
9
+ - gemfiles/Gemfile.fluentd.0.10
10
+ - gemfiles/Gemfile.fluentd.0.10.45
@@ -1,3 +1,10 @@
1
+ # 0.1.3
2
+
3
+ Enhancements:
4
+
5
+ * Supported fluentd versions fixed (from fluentd v0.10.45)
6
+ * Add messages for end of support fluentd version
7
+
1
8
  # 0.1.2
2
9
 
3
10
  Enhancements:
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # fluent-plugin-cat-sweep
2
2
 
3
- [![Circle CI](https://circleci.com/gh/civitaspo/fluent-plugin-cat-sweep.svg?style=svg)](https://circleci.com/gh/civitaspo/fluent-plugin-cat-sweep) [![Build Status](https://secure.travis-ci.org/civitaspo/fluent-plugin-cat-sweep.png?branch=master)](http://travis-ci.org/civitaspo/fluent-plugin-cat-sweep)
3
+ [![Build Status](https://secure.travis-ci.org/civitaspo/fluent-plugin-cat-sweep.png?branch=master)](http://travis-ci.org/civitaspo/fluent-plugin-cat-sweep)
4
4
 
5
5
  Fluentd plugin to read data from files and to remove or move after processing.
6
6
 
@@ -93,6 +93,12 @@ Our assumption is that this mechanism should provide more durability than `in_ta
93
93
 
94
94
  [CHANGELOG.md](CHANGELOG.md)
95
95
 
96
+ ## Warning
97
+
98
+ * This plugin supports fluentd from v0.10.45
99
+ * The support for fluentd v0.10 will end near future
100
+ * The support for fluentd v0.14 is not yet
101
+
96
102
  ## Contributing
97
103
 
98
104
  1. Fork it ( https://github.com/civitaspo/fluent-plugin-cat-sweep/fork )
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-cat-sweep"
7
- spec.version = "0.1.2"
7
+ spec.version = "0.1.3"
8
8
  spec.authors = ["Civitaspo(takahiro.nakayama)", "Naotoshi Seo"]
9
9
  spec.email = ["civitaspo@gmail.com", "sonots@gmail.com"]
10
10
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "fluentd"
21
+ spec.add_runtime_dependency "fluentd", ">= 0.10.45"
22
22
  spec.add_development_dependency "bundler"
23
23
  spec.add_development_dependency "rake"
24
24
  spec.add_development_dependency "test-unit"
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'fluentd', '~> 0.10.45'
4
+ gemspec :path => "../"
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'fluentd', '= 0.10.45'
4
+ gemspec :path => "../"
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'fluentd', '~> 0.12.0'
4
+ gemspec :path => "../"
@@ -35,8 +35,10 @@ module Fluent
35
35
  def configure(conf)
36
36
  super
37
37
 
38
- @parser = Plugin.new_parser(@format)
39
- @parser.configure(conf)
38
+ # Message for users about supported fluentd versions
39
+ supported_versions_information
40
+
41
+ configure_parser(conf)
40
42
 
41
43
  if @processing_file_suffix.empty?
42
44
  raise Fluent::ConfigError, "in_cat_sweep: `processing_file_suffix` must has some letters."
@@ -104,6 +106,56 @@ module Fluent
104
106
 
105
107
  private
106
108
 
109
+ def configure_parser(conf)
110
+ if Plugin.respond_to?(:new_parser)
111
+ @parser = Plugin.new_parser(@format)
112
+ @parser.configure(conf)
113
+ else # For supporting fluentd lower than v0.10.58
114
+ @parser = TextParser.new
115
+ @parser.configure(conf)
116
+ # In lower version of fluentd than v0.10.50,
117
+ # `Fluent::Parser#parse` does not support block based API.
118
+ # cf. https://github.com/fluent/fluentd/blob/v0.10.49/lib/fluent/parser.rb#L270
119
+ # On the other hand, in newer version(like v0.14) of fluentd,
120
+ # `Fluent::Parser#parse` only supports block based API.
121
+ # cf. https://github.com/fluent/fluentd/blob/v0.14.0.rc.3/lib/fluent/plugin/parser_tsv.rb#L33
122
+ # So, lower version of `Fluent::Parser#parse` extends the way to call by block based API.
123
+ @parser.extend(Module.new {
124
+ def parse(line)
125
+ time, record = super
126
+ yield(time, record)
127
+ return
128
+ end
129
+ })
130
+ end
131
+ end
132
+
133
+ def supported_versions_information
134
+ if current_fluent_version < fluent_version('0.12.0')
135
+ log.warn "in_cat_sweep: the support for fluentd v0.10 will end near future. Please upgrade your fluentd or fix this plugin version."
136
+ end
137
+ if current_fluent_version < fluent_version('0.10.58')
138
+ log.warn "in_cat_sweep: fluentd officially supports Plugin.new_parser/Plugin.register_parser APIs from v0.10.58." \
139
+ " The support for v0.10.58 will end near future." \
140
+ " Please upgrade your fluentd or fix this plugin version."
141
+ end
142
+ if current_fluent_version < fluent_version('0.10.46')
143
+ log.warn "in_cat_sweep: fluentd officially supports parser plugin from v0.10.46." \
144
+ " If you use `time_key` parameter and fluentd v0.10.45, doesn't work properly." \
145
+ " The support for v0.10.45 will end near future." \
146
+ " Please upgrade your fluentd or fix this plugin version."
147
+ end
148
+ end
149
+
150
+ def current_fluent_version
151
+ parse_version_comparable(Fluent::VERSION)
152
+ end
153
+
154
+ def parse_version_comparable(v)
155
+ Gem::Version.new(v)
156
+ end
157
+ alias :fluent_version :parse_version_comparable # For the readability
158
+
107
159
  def will_process?(filename)
108
160
  !(processing?(filename) or error_file?(filename) or sufficient_waiting?(filename))
109
161
  end
@@ -1,4 +1,5 @@
1
1
  require 'test/unit'
2
+ require 'fluent/version'
2
3
  require 'fluent/log'
3
4
  require 'fluent/test'
4
5
 
@@ -26,3 +27,12 @@ module Fluent
26
27
  end
27
28
  end
28
29
  end
30
+
31
+
32
+ def current_fluent_version
33
+ fluent_version(Fluent::VERSION)
34
+ end
35
+
36
+ def fluent_version(v)
37
+ Gem::Version.new(v)
38
+ end
@@ -1,5 +1,6 @@
1
1
  require_relative 'helper'
2
2
  require 'rr'
3
+ require 'fluent/input'
3
4
  require 'fluent/plugin/in_cat_sweep'
4
5
 
5
6
  class CatSweepInputTest < Test::Unit::TestCase
@@ -22,13 +23,28 @@ class CatSweepInputTest < Test::Unit::TestCase
22
23
  run_interval 0.05
23
24
  ]
24
25
 
25
- CONFIG_MINIMUM_REQUIRED = CONFIG_BASE + %[
26
- format tsv
27
- waiting_seconds 5
28
- ]
26
+ CONFIG_MINIMUM_REQUIRED =
27
+ if current_fluent_version < fluent_version('0.12.0')
28
+ CONFIG_BASE + %[
29
+ format tsv
30
+ keys ""
31
+ waiting_seconds 5
32
+ ]
33
+ else
34
+ CONFIG_BASE + %[
35
+ format tsv
36
+ waiting_seconds 5
37
+ ]
38
+ end
29
39
 
30
40
  def create_driver(conf, use_v1 = true)
31
- Fluent::Test::InputTestDriver.new(Fluent::CatSweepInput).configure(conf, use_v1)
41
+ driver = Fluent::Test::InputTestDriver.new(Fluent::CatSweepInput)
42
+ if current_fluent_version < fluent_version('0.10.51')
43
+ driver.configure(conf)
44
+ else
45
+ driver.configure(conf, use_v1)
46
+ end
47
+ driver
32
48
  end
33
49
 
34
50
  def test_required_configure
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-cat-sweep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Civitaspo(takahiro.nakayama)
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-04 00:00:00.000000000 Z
12
+ date: 2016-06-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: 0.10.45
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '0'
27
+ version: 0.10.45
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -127,6 +127,9 @@ files:
127
127
  - Rakefile
128
128
  - example.conf
129
129
  - fluent-plugin-cat-sweep.gemspec
130
+ - gemfiles/Gemfile.fluentd.0.10
131
+ - gemfiles/Gemfile.fluentd.0.10.45
132
+ - gemfiles/Gemfile.fluentd.0.12
130
133
  - lib/fluent/plugin/in_cat_sweep.rb
131
134
  - test/helper.rb
132
135
  - test/test_in_cat_sweep.rb
@@ -150,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
153
  version: '0'
151
154
  requirements: []
152
155
  rubyforge_project:
153
- rubygems_version: 2.4.5.1
156
+ rubygems_version: 2.5.1
154
157
  signing_key:
155
158
  specification_version: 4
156
159
  summary: Fluentd plugin to cat files and move them.