fluent-plugin-typecast 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +14 -0
- data/Gemfile +1 -8
- data/README.rdoc +4 -0
- data/Rakefile.ci +21 -0
- data/VERSION +1 -1
- data/fluent-plugin-typecast.gemspec +16 -9
- data/gemfiles/Gemfile.ci +8 -0
- data/gemfiles/Gemfile.v0.10 +9 -0
- data/lib/fluent/plugin/out_typecast.rb +3 -1
- data/test/helper.rb +6 -0
- data/test/plugin/test_out_typecast.rb +16 -1
- metadata +34 -28
- data/Gemfile.lock +0 -65
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 510c018e16eb7479a7efd5cb7bf2ee3ea3292f0c
|
4
|
+
data.tar.gz: 6bd41fdf862ebb65cce6ba807ead30c5e7d12444
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 918a097b0f96e4d469d10fbe186e4e68ffbf114471de9b8a9d02ab733c5d8b0f501c6c79abe0626ab4dea7e7bb58a3651d0f2ccdb832d7869aa3192472703e07
|
7
|
+
data.tar.gz: 035af1bd96288f1447b0e8c2113ed3d4876b984499a85d8df767375601f2475ccee704561f737f6369068e89697e7d8027c9fe08b0eda7ece79bf86594ae2b9c
|
data/.travis.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- "1.9.3"
|
5
|
+
- "2.0.0"
|
6
|
+
- "2.1"
|
7
|
+
- "2.2"
|
8
|
+
gemfile:
|
9
|
+
- gemfiles/Gemfile.ci
|
10
|
+
- gemfiles/Gemfile.v0.10
|
11
|
+
script: bundle exec rake -f Rakefile.ci
|
12
|
+
addons:
|
13
|
+
code_climate:
|
14
|
+
repo_token: 1441f8d69173e16966b6cb700c64df009ae41f7eb0ea4dc07434d6f3582ae965
|
data/Gemfile
CHANGED
@@ -1,10 +1,3 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
# Add dependencies to develop your gem here.
|
6
|
-
# Include everything needed to run rake, tests, features, etc.
|
7
|
-
group :development do
|
8
|
-
gem "rdoc", "~> 3.12"
|
9
|
-
gem "jeweler", "~> 1.8.4"
|
10
|
-
end
|
3
|
+
gemspec
|
data/README.rdoc
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
= fluent-plugin-typecast
|
2
2
|
|
3
|
+
{<img src="https://travis-ci.org/tarom/fluent-plugin-typecast.png?branch=master" alt="Build Status" />}[https://travis-ci.org/tarom/fluent-plugin-typecast]
|
4
|
+
{<img src="https://badge.fury.io/rb/fluent-plugin-typecast.png" alt="Gem Version" />}[http://badge.fury.io/rb/fluent-plugin-typecast]
|
5
|
+
|
3
6
|
typecast output plugin for fluentd.
|
4
7
|
|
5
8
|
== Configuration
|
@@ -12,6 +15,7 @@ typecast output plugin for fluentd.
|
|
12
15
|
- time
|
13
16
|
- bool
|
14
17
|
- array
|
18
|
+
- json
|
15
19
|
|
16
20
|
[time_format] format for typecast to time
|
17
21
|
|
data/Rakefile.ci
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'rake/testtask'
|
15
|
+
Rake::TestTask.new(:test) do |test|
|
16
|
+
test.libs << 'lib' << 'test'
|
17
|
+
test.pattern = 'test/**/test_*.rb'
|
18
|
+
test.verbose = true
|
19
|
+
end
|
20
|
+
|
21
|
+
task :default => :test
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -2,14 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: fluent-plugin-typecast 0.2.0 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "fluent-plugin-typecast"
|
8
|
-
s.version = "0.
|
9
|
+
s.version = "0.2.0"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["MORIYA Taro"]
|
12
|
-
s.date = "
|
14
|
+
s.date = "2015-05-15"
|
13
15
|
s.description = "typecast output plugin for fluentd"
|
14
16
|
s.email = "taro.toys@gmail.com"
|
15
17
|
s.extra_rdoc_files = [
|
@@ -18,39 +20,44 @@ Gem::Specification.new do |s|
|
|
18
20
|
]
|
19
21
|
s.files = [
|
20
22
|
".document",
|
23
|
+
".travis.yml",
|
21
24
|
"Gemfile",
|
22
|
-
"Gemfile.lock",
|
23
25
|
"LICENSE.txt",
|
24
26
|
"README.rdoc",
|
25
27
|
"Rakefile",
|
28
|
+
"Rakefile.ci",
|
26
29
|
"VERSION",
|
27
30
|
"fluent-plugin-typecast.gemspec",
|
31
|
+
"gemfiles/Gemfile.ci",
|
32
|
+
"gemfiles/Gemfile.v0.10",
|
28
33
|
"lib/fluent/plugin/out_typecast.rb",
|
29
34
|
"test/helper.rb",
|
30
35
|
"test/plugin/test_out_typecast.rb"
|
31
36
|
]
|
32
37
|
s.homepage = "http://github.com/tarom/fluent-plugin-typecast"
|
33
38
|
s.licenses = ["Apache License 2.0"]
|
34
|
-
s.
|
35
|
-
s.rubygems_version = "1.8.25"
|
39
|
+
s.rubygems_version = "2.4.6"
|
36
40
|
s.summary = "typecast output plugin for fluentd"
|
37
41
|
|
38
42
|
if s.respond_to? :specification_version then
|
39
|
-
s.specification_version =
|
43
|
+
s.specification_version = 4
|
40
44
|
|
41
45
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
|
-
s.add_runtime_dependency(%q<fluentd>, ["
|
46
|
+
s.add_runtime_dependency(%q<fluentd>, [">= 0"])
|
43
47
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
44
48
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
49
|
+
s.add_development_dependency(%q<test-unit>, ["~> 3.0.9"])
|
45
50
|
else
|
46
|
-
s.add_dependency(%q<fluentd>, ["
|
51
|
+
s.add_dependency(%q<fluentd>, [">= 0"])
|
47
52
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
48
53
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
54
|
+
s.add_dependency(%q<test-unit>, ["~> 3.0.9"])
|
49
55
|
end
|
50
56
|
else
|
51
|
-
s.add_dependency(%q<fluentd>, ["
|
57
|
+
s.add_dependency(%q<fluentd>, [">= 0"])
|
52
58
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
53
59
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
60
|
+
s.add_dependency(%q<test-unit>, ["~> 3.0.9"])
|
54
61
|
end
|
55
62
|
end
|
56
63
|
|
data/gemfiles/Gemfile.ci
ADDED
@@ -17,7 +17,7 @@ class TypecastOutput < Output
|
|
17
17
|
config_param :tag, :string, default: nil
|
18
18
|
config_param :prefix, :string, default: nil
|
19
19
|
|
20
|
-
ITEM_TYPES = ['string', 'integer', 'float', 'bool', 'time', 'array']
|
20
|
+
ITEM_TYPES = ['json', 'string', 'integer', 'float', 'bool', 'time', 'array']
|
21
21
|
|
22
22
|
def configure(conf)
|
23
23
|
super
|
@@ -49,6 +49,8 @@ class TypecastOutput < Output
|
|
49
49
|
|
50
50
|
def cast_proc(key)
|
51
51
|
case key
|
52
|
+
when 'json'
|
53
|
+
Proc.new {|value| value.to_json }
|
52
54
|
when 'string'
|
53
55
|
Proc.new {|value| value.to_s }
|
54
56
|
when 'integer'
|
data/test/helper.rb
CHANGED
@@ -14,5 +14,11 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
14
14
|
require 'fluent/test'
|
15
15
|
require 'fluent/plugin/out_typecast'
|
16
16
|
|
17
|
+
begin
|
18
|
+
require "codeclimate-test-reporter"
|
19
|
+
CodeClimate::TestReporter.start
|
20
|
+
rescue LoadError => e
|
21
|
+
end
|
22
|
+
|
17
23
|
class Test::Unit::TestCase
|
18
24
|
end
|
@@ -18,7 +18,7 @@ class TestTypecastOutput < Test::Unit::TestCase
|
|
18
18
|
tag = "test.tag"
|
19
19
|
prefix = "prefix"
|
20
20
|
d = create_driver(DEFAULT_CONFIG + %[
|
21
|
-
item_types test1:integer,test2:string,test3:time,test4:bool
|
21
|
+
item_types test1:integer,test2:string,test3:time,test4:bool,test5:json
|
22
22
|
time_format #{time_format}
|
23
23
|
tag #{tag}
|
24
24
|
prefix #{prefix}
|
@@ -28,6 +28,7 @@ class TestTypecastOutput < Test::Unit::TestCase
|
|
28
28
|
assert_equal('string', d.item_types['test2'])
|
29
29
|
assert_equal('time', d.item_types['test3'])
|
30
30
|
assert_equal('bool', d.item_types['test4'])
|
31
|
+
assert_equal('json', d.item_types['test5'])
|
31
32
|
|
32
33
|
assert_equal(time_format, d.time_format)
|
33
34
|
assert_equal(tag, d.tag)
|
@@ -71,6 +72,20 @@ class TestTypecastOutput < Test::Unit::TestCase
|
|
71
72
|
assert_equal(v, record['f'])
|
72
73
|
end
|
73
74
|
|
75
|
+
def test_typecast_json
|
76
|
+
d = create_driver(DEFAULT_CONFIG + %[
|
77
|
+
tag test.tag
|
78
|
+
item_types j:json
|
79
|
+
])
|
80
|
+
v = {"msg" => "ok"}
|
81
|
+
time = Time.parse('2015-01-19 08:35:15 UTC').to_i
|
82
|
+
d.run do
|
83
|
+
d.emit({'j' => v }, time)
|
84
|
+
end
|
85
|
+
record = d.emits[0][2]
|
86
|
+
assert_equal(v.to_json, record['j'])
|
87
|
+
end
|
88
|
+
|
74
89
|
def test_prefix
|
75
90
|
d = create_driver(DEFAULT_CONFIG + %[
|
76
91
|
item_types i:integer,s:string,t:time,b:bool,a:array
|
metadata
CHANGED
@@ -1,64 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-typecast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- MORIYA Taro
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-05-15 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: fluentd
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0
|
19
|
+
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0
|
26
|
+
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rdoc
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '3.12'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '3.12'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: jeweler
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- - ~>
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 1.8.4
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- - ~>
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 1.8.4
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: test-unit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.9
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.0.9
|
62
69
|
description: typecast output plugin for fluentd
|
63
70
|
email: taro.toys@gmail.com
|
64
71
|
executables: []
|
@@ -67,43 +74,42 @@ extra_rdoc_files:
|
|
67
74
|
- LICENSE.txt
|
68
75
|
- README.rdoc
|
69
76
|
files:
|
70
|
-
- .document
|
77
|
+
- ".document"
|
78
|
+
- ".travis.yml"
|
71
79
|
- Gemfile
|
72
|
-
- Gemfile.lock
|
73
80
|
- LICENSE.txt
|
74
81
|
- README.rdoc
|
75
82
|
- Rakefile
|
83
|
+
- Rakefile.ci
|
76
84
|
- VERSION
|
77
85
|
- fluent-plugin-typecast.gemspec
|
86
|
+
- gemfiles/Gemfile.ci
|
87
|
+
- gemfiles/Gemfile.v0.10
|
78
88
|
- lib/fluent/plugin/out_typecast.rb
|
79
89
|
- test/helper.rb
|
80
90
|
- test/plugin/test_out_typecast.rb
|
81
91
|
homepage: http://github.com/tarom/fluent-plugin-typecast
|
82
92
|
licenses:
|
83
93
|
- Apache License 2.0
|
94
|
+
metadata: {}
|
84
95
|
post_install_message:
|
85
96
|
rdoc_options: []
|
86
97
|
require_paths:
|
87
98
|
- lib
|
88
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
100
|
requirements:
|
91
|
-
- -
|
101
|
+
- - ">="
|
92
102
|
- !ruby/object:Gem::Version
|
93
103
|
version: '0'
|
94
|
-
segments:
|
95
|
-
- 0
|
96
|
-
hash: 2044205134208786053
|
97
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
105
|
requirements:
|
100
|
-
- -
|
106
|
+
- - ">="
|
101
107
|
- !ruby/object:Gem::Version
|
102
108
|
version: '0'
|
103
109
|
requirements: []
|
104
110
|
rubyforge_project:
|
105
|
-
rubygems_version:
|
111
|
+
rubygems_version: 2.4.6
|
106
112
|
signing_key:
|
107
|
-
specification_version:
|
113
|
+
specification_version: 4
|
108
114
|
summary: typecast output plugin for fluentd
|
109
115
|
test_files: []
|
data/Gemfile.lock
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
addressable (2.3.5)
|
5
|
-
builder (3.2.2)
|
6
|
-
cool.io (1.1.0)
|
7
|
-
iobuffer (>= 1.0.0)
|
8
|
-
faraday (0.8.8)
|
9
|
-
multipart-post (~> 1.2.0)
|
10
|
-
fluentd (0.10.32)
|
11
|
-
cool.io (~> 1.1.0)
|
12
|
-
http_parser.rb (~> 0.5.1)
|
13
|
-
json (>= 1.4.3)
|
14
|
-
msgpack (~> 0.4.4)
|
15
|
-
yajl-ruby (~> 1.0)
|
16
|
-
git (1.2.6)
|
17
|
-
github_api (0.10.1)
|
18
|
-
addressable
|
19
|
-
faraday (~> 0.8.1)
|
20
|
-
hashie (>= 1.2)
|
21
|
-
multi_json (~> 1.4)
|
22
|
-
nokogiri (~> 1.5.2)
|
23
|
-
oauth2
|
24
|
-
hashie (2.0.5)
|
25
|
-
highline (1.6.20)
|
26
|
-
http_parser.rb (0.5.3)
|
27
|
-
httpauth (0.2.0)
|
28
|
-
iobuffer (1.1.2)
|
29
|
-
jeweler (1.8.8)
|
30
|
-
builder
|
31
|
-
bundler (~> 1.0)
|
32
|
-
git (>= 1.2.5)
|
33
|
-
github_api (= 0.10.1)
|
34
|
-
highline (>= 1.6.15)
|
35
|
-
nokogiri (= 1.5.10)
|
36
|
-
rake
|
37
|
-
rdoc
|
38
|
-
json (1.8.1)
|
39
|
-
jwt (0.1.8)
|
40
|
-
multi_json (>= 1.5)
|
41
|
-
msgpack (0.4.7)
|
42
|
-
multi_json (1.8.2)
|
43
|
-
multi_xml (0.5.5)
|
44
|
-
multipart-post (1.2.0)
|
45
|
-
nokogiri (1.5.10)
|
46
|
-
oauth2 (0.9.2)
|
47
|
-
faraday (~> 0.8)
|
48
|
-
httpauth (~> 0.2)
|
49
|
-
jwt (~> 0.1.4)
|
50
|
-
multi_json (~> 1.0)
|
51
|
-
multi_xml (~> 0.5)
|
52
|
-
rack (~> 1.2)
|
53
|
-
rack (1.5.2)
|
54
|
-
rake (10.1.0)
|
55
|
-
rdoc (3.12.2)
|
56
|
-
json (~> 1.4)
|
57
|
-
yajl-ruby (1.1.0)
|
58
|
-
|
59
|
-
PLATFORMS
|
60
|
-
ruby
|
61
|
-
|
62
|
-
DEPENDENCIES
|
63
|
-
fluentd (~> 0.10.0)
|
64
|
-
jeweler (~> 1.8.4)
|
65
|
-
rdoc (~> 3.12)
|