fluent-plugin-backlog 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.travis.yml +8 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +73 -0
- data/Rakefile +11 -0
- data/fluent-plugin-backlog.gemspec +25 -0
- data/lib/fluent/plugin/out_backlog_create.rb +55 -0
- data/sample/fluent.conf +17 -0
- data/test/helper.rb +27 -0
- data/test/plugin/test_out_backlog.rb +106 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d2df0559c761dcdcd78fe64628b0b344a47dbdfe
|
4
|
+
data.tar.gz: 967a0cd5e05dda75fe90acdbf381a5f8fe7530ff
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 808bab079894e44e60a411836f21752add16103608b728b603a19f5183157100b1aa9dfefdfe5f86e90eb294cf4355a98218fc2f7596e9a961039939a9bddbaa
|
7
|
+
data.tar.gz: 3f555dc12a4ba30e17c4c3c6d1c24eef4d00a7b5f6f24d5eedd5a6107cafd3b019a2240c08f039a8ac098320b11c41adf49801dcf572ff9eddec58400939ff18
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Hiroshi Toyama
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# fluent-plugin-backlog, a plugin for [Fluentd](http://fluentd.org) [![Build Status](https://secure.travis-ci.org/toyama0919/fluent-plugin-backlog.png?branch=master)](http://travis-ci.org/toyama0919/fluent-plugin-backlog)
|
2
|
+
|
3
|
+
output plugin for Backlog.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
### td-agent(Linux)
|
8
|
+
|
9
|
+
/usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-backlog
|
10
|
+
|
11
|
+
### td-agent(Mac)
|
12
|
+
|
13
|
+
sudo /usr/local/Cellar/td-agent/1.1.XX/bin/fluent-gem install fluent-plugin-backlog
|
14
|
+
|
15
|
+
### fluentd only
|
16
|
+
|
17
|
+
gem install fluent-plugin-backlog
|
18
|
+
|
19
|
+
## Parameters
|
20
|
+
|
21
|
+
param|value
|
22
|
+
--------|------
|
23
|
+
space|name space
|
24
|
+
user|user
|
25
|
+
password|password
|
26
|
+
project_id|project_id
|
27
|
+
summary_template|summary(sprintf)
|
28
|
+
summary_keys|summary key
|
29
|
+
description_template|description(sprintf format)
|
30
|
+
description_keys|description key
|
31
|
+
component|category_id
|
32
|
+
|
33
|
+
## Configuration Example(bulk insert)
|
34
|
+
|
35
|
+
```
|
36
|
+
<match backlog>
|
37
|
+
type backlog
|
38
|
+
space toyama0919
|
39
|
+
user toyama0919
|
40
|
+
password hogehoge
|
41
|
+
project_id 1761
|
42
|
+
summary_template %s
|
43
|
+
summary_keys code
|
44
|
+
description_template %s_%s
|
45
|
+
description_keys code,host
|
46
|
+
component bug
|
47
|
+
</match>
|
48
|
+
```
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
## spec
|
53
|
+
|
54
|
+
```
|
55
|
+
bundle install
|
56
|
+
rake test
|
57
|
+
```
|
58
|
+
|
59
|
+
## todo
|
60
|
+
|
61
|
+
update
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
1. Fork it
|
66
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
67
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
68
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
69
|
+
5. Create new [Pull Request](../../pull/new/master)
|
70
|
+
|
71
|
+
## Copyright
|
72
|
+
|
73
|
+
Copyright (c) 2014 Hiroshi Toyama. See [LICENSE](LICENSE) for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
Gem::Specification.new do |gem|
|
3
|
+
gem.name = "fluent-plugin-backlog"
|
4
|
+
gem.version = "0.0.1"
|
5
|
+
gem.authors = ["Hiroshi Toyama"]
|
6
|
+
gem.email = ["toyama0919@gmail.com"]
|
7
|
+
gem.description = %q{output plugin for Backlog.}
|
8
|
+
gem.summary = %q{output plugin for Backlog.}
|
9
|
+
gem.homepage = "https://github.com/toyama0919/fluent-plugin-backlog"
|
10
|
+
gem.licenses = ["MIT"]
|
11
|
+
gem.has_rdoc = false
|
12
|
+
|
13
|
+
gem.files = `git ls-files`.split($\)
|
14
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
15
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
16
|
+
gem.require_paths = ["lib"]
|
17
|
+
|
18
|
+
gem.add_runtime_dependency "fluentd"
|
19
|
+
gem.add_development_dependency "bundler"
|
20
|
+
gem.add_development_dependency "rake"
|
21
|
+
gem.add_development_dependency "rspec"
|
22
|
+
gem.add_development_dependency "spork"
|
23
|
+
gem.add_development_dependency "pry"
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module Fluent
|
3
|
+
class Fluent::BacklogOutput < Fluent::BufferedOutput
|
4
|
+
Fluent::Plugin.register_output('backlog', self)
|
5
|
+
|
6
|
+
config_param :space, :string
|
7
|
+
config_param :user, :string
|
8
|
+
config_param :password, :string
|
9
|
+
config_param :project_id, :string
|
10
|
+
config_param :summary_template, :string
|
11
|
+
config_param :summary_keys, :string, default: nil
|
12
|
+
config_param :description_template, :string, default: nil
|
13
|
+
config_param :description_keys, :string, default: nil
|
14
|
+
config_param :component, :string, default: nil
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
super
|
18
|
+
require 'xmlrpc/client'
|
19
|
+
end
|
20
|
+
|
21
|
+
def configure(conf)
|
22
|
+
super
|
23
|
+
@server = XMLRPC::Client.new2("https://#{@user}:#{@password}@#{@space}.backlog.jp/XML-RPC")
|
24
|
+
@summary_keys = @summary_keys.split(',')
|
25
|
+
if @description_keys
|
26
|
+
@description_keys = @description_keys.split(',')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def start
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
def shutdown
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
38
|
+
def format(tag, time, record)
|
39
|
+
[tag, time, record].to_msgpack
|
40
|
+
end
|
41
|
+
|
42
|
+
def write(chunk)
|
43
|
+
chunk.msgpack_each do |tag, time, record|
|
44
|
+
summary = @summary_template % @summary_keys.map { |key| record[key] }
|
45
|
+
args = { projectId: @project_id, summary: summary }
|
46
|
+
if @description_template
|
47
|
+
description = @description_template % @description_keys.map { |key| record[key] }
|
48
|
+
args[:description] = description
|
49
|
+
end
|
50
|
+
args[:component] = @component if @component
|
51
|
+
@server.call('backlog.createIssue', args)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/sample/fluent.conf
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
<source>
|
2
|
+
type forward
|
3
|
+
port 24225
|
4
|
+
</source>
|
5
|
+
|
6
|
+
<match backlog>
|
7
|
+
type backlog
|
8
|
+
space toyama0919
|
9
|
+
user toyama0919
|
10
|
+
password hogehoge
|
11
|
+
project_id 1761
|
12
|
+
summary_template %s
|
13
|
+
summary_keys code
|
14
|
+
description_template %s_%s
|
15
|
+
description_keys code,host
|
16
|
+
component bug
|
17
|
+
</match>
|
data/test/helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
|
12
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
13
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
14
|
+
require 'fluent/test'
|
15
|
+
unless ENV.key?('VERBOSE')
|
16
|
+
nulllogger = Object.new
|
17
|
+
nulllogger.instance_eval do|obj|
|
18
|
+
def method_missing(method, *args)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
$log = nulllogger
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'fluent/plugin/out_backlog'
|
25
|
+
|
26
|
+
class Test::Unit::TestCase
|
27
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class BacklogOutputTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
Fluent::Test.setup
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_driver(conf = CONFIG, tag = 'test')
|
9
|
+
Fluent::Test::BufferedOutputTestDriver.new(Fluent::BacklogOutput, tag).configure(conf)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_configure_error
|
13
|
+
assert_raise(Fluent::ConfigError) do
|
14
|
+
d = create_driver %[
|
15
|
+
user toyama0919
|
16
|
+
password hogehoge
|
17
|
+
project_id 1111
|
18
|
+
summary_template %s
|
19
|
+
summary_keys code
|
20
|
+
description_template %s_%s
|
21
|
+
description_keys code,host
|
22
|
+
component bug
|
23
|
+
]
|
24
|
+
end
|
25
|
+
|
26
|
+
assert_raise(Fluent::ConfigError) do
|
27
|
+
d = create_driver %[
|
28
|
+
space toyama0919
|
29
|
+
password hogehoge
|
30
|
+
project_id 1111
|
31
|
+
summary_template %s
|
32
|
+
summary_keys code
|
33
|
+
description_template %s_%s
|
34
|
+
description_keys code,host
|
35
|
+
component bug
|
36
|
+
]
|
37
|
+
end
|
38
|
+
|
39
|
+
assert_raise(Fluent::ConfigError) do
|
40
|
+
d = create_driver %[
|
41
|
+
space toyama0919
|
42
|
+
user toyama0919
|
43
|
+
password hogehoge
|
44
|
+
project_id 1111
|
45
|
+
description_template %s_%s
|
46
|
+
description_keys code,host
|
47
|
+
component bug
|
48
|
+
]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_configure
|
53
|
+
# not define format(default csv)
|
54
|
+
assert_nothing_raised(Fluent::ConfigError) do
|
55
|
+
d = create_driver %[
|
56
|
+
space toyama0919
|
57
|
+
user toyama0919
|
58
|
+
password hogehoge
|
59
|
+
project_id 1111
|
60
|
+
summary_template %s
|
61
|
+
summary_keys code
|
62
|
+
description_template %s_%s
|
63
|
+
description_keys code,host
|
64
|
+
component bug
|
65
|
+
]
|
66
|
+
end
|
67
|
+
|
68
|
+
assert_nothing_raised(Fluent::ConfigError) do
|
69
|
+
d = create_driver %[
|
70
|
+
space toyama0919
|
71
|
+
user toyama0919
|
72
|
+
password hogehoge
|
73
|
+
project_id 1111
|
74
|
+
summary_template %s
|
75
|
+
summary_keys code
|
76
|
+
description_template %s_%s
|
77
|
+
description_keys code,host
|
78
|
+
component bug
|
79
|
+
]
|
80
|
+
end
|
81
|
+
|
82
|
+
assert_nothing_raised(Fluent::ConfigError) do
|
83
|
+
d = create_driver %[
|
84
|
+
space toyama0919
|
85
|
+
user toyama0919
|
86
|
+
password hogehoge
|
87
|
+
project_id 1111
|
88
|
+
summary_template %s
|
89
|
+
summary_keys code
|
90
|
+
]
|
91
|
+
end
|
92
|
+
|
93
|
+
assert_nothing_raised(Fluent::ConfigError) do
|
94
|
+
d = create_driver %[
|
95
|
+
space toyama0919
|
96
|
+
user toyama0919
|
97
|
+
password hogehoge
|
98
|
+
project_id 1111
|
99
|
+
summary_template %s
|
100
|
+
summary_keys code
|
101
|
+
description_template %s_%s
|
102
|
+
description_keys code,host
|
103
|
+
]
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-backlog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hiroshi Toyama
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fluentd
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: spork
|
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'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: output plugin for Backlog.
|
98
|
+
email:
|
99
|
+
- toyama0919@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
106
|
+
- Gemfile
|
107
|
+
- LICENSE
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- fluent-plugin-backlog.gemspec
|
111
|
+
- lib/fluent/plugin/out_backlog_create.rb
|
112
|
+
- sample/fluent.conf
|
113
|
+
- test/helper.rb
|
114
|
+
- test/plugin/test_out_backlog.rb
|
115
|
+
homepage: https://github.com/toyama0919/fluent-plugin-backlog
|
116
|
+
licenses:
|
117
|
+
- MIT
|
118
|
+
metadata: {}
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
requirements: []
|
134
|
+
rubyforge_project:
|
135
|
+
rubygems_version: 2.2.2
|
136
|
+
signing_key:
|
137
|
+
specification_version: 4
|
138
|
+
summary: output plugin for Backlog.
|
139
|
+
test_files:
|
140
|
+
- test/helper.rb
|
141
|
+
- test/plugin/test_out_backlog.rb
|