fluent-plugin-out_chatwork 0.0.3 → 0.0.99.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.tachikoma.yml +1 -0
- data/.travis.yml +16 -4
- data/CHANGELOG.md +16 -0
- data/README.md +4 -24
- data/fluent-plugin-out_chatwork.gemspec +17 -5
- data/spec/lib/fluent/plugin/out_chatwork_spec.rb +4 -0
- data/spec/spec_helper.rb +7 -0
- metadata +81 -51
- data/lib/fluent/plugin/out_chatwork.rb +0 -55
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7695cd06fab25a9155bc9e9177de4c14eccb1bbf
|
4
|
+
data.tar.gz: '09bdc19692c62475d5dce379a87bcbdd4041724d'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c6eb2d8b0dd997fd795dd191283db149064f3e06bfe59349f141489357e0617c9bc3ee749a7b1fcb4b33b1ce0cbfa2fd937729a84b46f65f02f6a72003db47ea
|
7
|
+
data.tar.gz: 192798ab0ca3abb4d011f582134894a6a5bd469abdcf09473457e5ab94d7bb2878b63aac91de3ba45cb4ab62a28cb74373f2e839f1ba65bcce09c03e6cf37789
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
repo_token: LTlGtQAWrrThkI5McoDdZbl714MDwmxS0
|
data/.tachikoma.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
strategy: 'bundler'
|
data/.travis.yml
CHANGED
@@ -1,12 +1,24 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
- 2.1
|
4
|
+
- 2.2
|
5
|
+
- 2.3.3
|
6
|
+
- ruby-head
|
7
|
+
cache: bundler
|
6
8
|
bundler_args: --jobs=2
|
7
|
-
|
9
|
+
before_script:
|
10
|
+
- export CODECLIMATE_REPO_TOKEN=93805166d8380e3602f18bd68762cb0222f0d68fca3f1771f22188a5a0995485
|
11
|
+
- export COVERAGE=true
|
12
|
+
script:
|
13
|
+
- bundle exec rspec
|
14
|
+
- bundle exec codeclimate-test-reporter
|
8
15
|
branches:
|
9
16
|
only:
|
10
17
|
- master
|
18
|
+
- 0.x
|
11
19
|
notifications:
|
12
20
|
email: false
|
21
|
+
matrix:
|
22
|
+
allow_failures:
|
23
|
+
- rvm: ruby-head
|
24
|
+
sudo: false
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Changelog
|
2
|
+
## master
|
3
|
+
[full changelog](http://github.com/sue445/fluent-plugin-out_chatwork/compare/v0.0.3...master)
|
4
|
+
|
5
|
+
## 0.0.3
|
6
|
+
[full changelog](http://github.com/sue445/fluent-plugin-out_chatwork/compare/v0.0.2...v0.0.3)
|
7
|
+
|
8
|
+
* Support newline character in message
|
9
|
+
|
10
|
+
## 0.0.2
|
11
|
+
[full changelog](http://github.com/sue445/fluent-plugin-out_chatwork/compare/v0.0.1...v0.0.2)
|
12
|
+
|
13
|
+
* Support erb in message
|
14
|
+
|
15
|
+
### 0.0.1
|
16
|
+
* first release
|
data/README.md
CHANGED
@@ -5,18 +5,12 @@ fluentd output plugin for post to [ChatWork](http://www.chatwork.com/)
|
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/fluent-plugin-out_chatwork.svg)](http://badge.fury.io/rb/fluent-plugin-out_chatwork)
|
6
6
|
[![Build Status](https://travis-ci.org/sue445/fluent-plugin-out_chatwork.svg)](https://travis-ci.org/sue445/fluent-plugin-out_chatwork)
|
7
7
|
[![Dependency Status](https://gemnasium.com/sue445/fluent-plugin-out_chatwork.svg)](https://gemnasium.com/sue445/fluent-plugin-out_chatwork)
|
8
|
+
[![Coverage Status](https://img.shields.io/coveralls/sue445/fluent-plugin-out_chatwork.svg)](https://coveralls.io/r/sue445/fluent-plugin-out_chatwork)
|
9
|
+
[![Code Climate](https://codeclimate.com/github/sue445/fluent-plugin-out_chatwork.png)](https://codeclimate.com/github/sue445/fluent-plugin-out_chatwork)
|
10
|
+
[![Inline docs](http://inch-ci.org/github/sue445/fluent-plugin-out_chatwork.png?branch=master)](http://inch-ci.org/github/sue445/fluent-plugin-out_chatwork)
|
8
11
|
|
9
12
|
## Installation
|
10
13
|
|
11
|
-
Add this line to your application's Gemfile:
|
12
|
-
|
13
|
-
gem 'fluent-plugin-out_chatwork'
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
14
|
|
21
15
|
$ gem install fluent-plugin-out_chatwork
|
22
16
|
|
@@ -24,7 +18,7 @@ Or install it yourself as:
|
|
24
18
|
|
25
19
|
```
|
26
20
|
<match **>
|
27
|
-
type
|
21
|
+
@type chatwork
|
28
22
|
api_token YOUR_SECRET_TOKEN
|
29
23
|
room_id 0000000000
|
30
24
|
message Hello ChatWork!\n<%= record["value"] %>
|
@@ -40,20 +34,6 @@ Or install it yourself as:
|
|
40
34
|
* support erb format
|
41
35
|
* support newline character (\n)
|
42
36
|
|
43
|
-
## Changelog
|
44
|
-
### master
|
45
|
-
[full changelog](http://github.com/sue445/fluent-plugin-out_chatwork/compare/v0.0.2...master)
|
46
|
-
|
47
|
-
* Support newline character in message
|
48
|
-
|
49
|
-
### 0.0.2
|
50
|
-
[full changelog](http://github.com/sue445/fluent-plugin-out_chatwork/compare/v0.0.1...v0.0.2)
|
51
|
-
|
52
|
-
* Support erb in message
|
53
|
-
|
54
|
-
### 0.0.1
|
55
|
-
* Initial commit
|
56
|
-
|
57
37
|
## Contributing
|
58
38
|
|
59
39
|
1. Fork it ( https://github.com/sue445/fluent-plugin-out_chatwork/fork )
|
@@ -4,9 +4,10 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-out_chatwork"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.99.0.beta1"
|
8
8
|
spec.authors = ["sue445"]
|
9
9
|
spec.email = ["sue445@sue445.net"]
|
10
|
+
# TODO: Tweak after
|
10
11
|
spec.summary = %q{fluentd output plugin for post to chatwork}
|
11
12
|
spec.description = %q{fluentd output plugin for post to chatwork}
|
12
13
|
spec.homepage = "https://github.com/sue445/fluent-plugin-out_chatwork"
|
@@ -17,10 +18,21 @@ Gem::Specification.new do |spec|
|
|
17
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
19
|
spec.require_paths = ["lib"]
|
19
20
|
|
20
|
-
|
21
|
-
spec.add_dependency "chatwork"
|
21
|
+
# TODO: Remove version
|
22
|
+
spec.add_dependency "fluent-plugin-chatwork", "1.0.0.beta1"
|
22
23
|
|
23
|
-
spec.add_development_dependency "bundler"
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
|
26
|
+
spec.add_development_dependency "coveralls"
|
24
27
|
spec.add_development_dependency "rake"
|
25
|
-
spec.add_development_dependency "rspec"
|
28
|
+
spec.add_development_dependency "rspec"
|
29
|
+
spec.add_development_dependency "simplecov"
|
30
|
+
spec.add_development_dependency "test-unit"
|
31
|
+
|
32
|
+
spec.post_install_message = <<-EOS
|
33
|
+
===========================================================================
|
34
|
+
[DEPRECATION WARNING] fluent-plugin-out_chatwork is deprecated.
|
35
|
+
Please install fluent-plugin-chatwork instead of fluent-plugin-out_chatwork
|
36
|
+
===========================================================================
|
37
|
+
EOS
|
26
38
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,96 +1,127 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-out_chatwork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.99.0.beta1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- sue445
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-12-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: fluent-plugin-chatwork
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '='
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 1.0.0.beta1
|
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:
|
26
|
+
version: 1.0.0.beta1
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
28
|
+
name: bundler
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
|
-
type: :
|
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: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
42
|
+
name: codeclimate-test-reporter
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- - ~>
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
47
|
+
version: 1.0.0
|
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
|
-
version:
|
54
|
+
version: 1.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
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'
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
name: rake
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
72
|
requirements:
|
67
|
-
- -
|
73
|
+
- - ">="
|
68
74
|
- !ruby/object:Gem::Version
|
69
75
|
version: '0'
|
70
76
|
type: :development
|
71
77
|
prerelease: false
|
72
78
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
79
|
requirements:
|
75
|
-
- -
|
80
|
+
- - ">="
|
76
81
|
- !ruby/object:Gem::Version
|
77
82
|
version: '0'
|
78
83
|
- !ruby/object:Gem::Dependency
|
79
84
|
name: rspec
|
80
85
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
86
|
requirements:
|
83
|
-
- -
|
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
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
84
102
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
103
|
+
version: '0'
|
86
104
|
type: :development
|
87
105
|
prerelease: false
|
88
106
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
107
|
requirements:
|
91
|
-
- -
|
108
|
+
- - ">="
|
92
109
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: test-unit
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
94
125
|
description: fluentd output plugin for post to chatwork
|
95
126
|
email:
|
96
127
|
- sue445@sue445.net
|
@@ -98,47 +129,46 @@ executables: []
|
|
98
129
|
extensions: []
|
99
130
|
extra_rdoc_files: []
|
100
131
|
files:
|
101
|
-
- .
|
102
|
-
- .
|
103
|
-
- .
|
132
|
+
- ".coveralls.yml"
|
133
|
+
- ".gitignore"
|
134
|
+
- ".rspec"
|
135
|
+
- ".tachikoma.yml"
|
136
|
+
- ".travis.yml"
|
137
|
+
- CHANGELOG.md
|
104
138
|
- Gemfile
|
105
139
|
- LICENSE.txt
|
106
140
|
- README.md
|
107
141
|
- Rakefile
|
108
142
|
- fluent-plugin-out_chatwork.gemspec
|
109
|
-
- lib/fluent/plugin/out_chatwork.rb
|
110
143
|
- spec/lib/fluent/plugin/out_chatwork_spec.rb
|
111
144
|
- spec/spec_helper.rb
|
112
145
|
homepage: https://github.com/sue445/fluent-plugin-out_chatwork
|
113
146
|
licenses:
|
114
147
|
- MIT
|
115
|
-
|
148
|
+
metadata: {}
|
149
|
+
post_install_message: |
|
150
|
+
===========================================================================
|
151
|
+
[DEPRECATION WARNING] fluent-plugin-out_chatwork is deprecated.
|
152
|
+
Please install fluent-plugin-chatwork instead of fluent-plugin-out_chatwork
|
153
|
+
===========================================================================
|
116
154
|
rdoc_options: []
|
117
155
|
require_paths:
|
118
156
|
- lib
|
119
157
|
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
-
none: false
|
121
158
|
requirements:
|
122
|
-
- -
|
159
|
+
- - ">="
|
123
160
|
- !ruby/object:Gem::Version
|
124
161
|
version: '0'
|
125
|
-
segments:
|
126
|
-
- 0
|
127
|
-
hash: 2466610615714716893
|
128
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
163
|
requirements:
|
131
|
-
- -
|
164
|
+
- - ">"
|
132
165
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
134
|
-
segments:
|
135
|
-
- 0
|
136
|
-
hash: 2466610615714716893
|
166
|
+
version: 1.3.1
|
137
167
|
requirements: []
|
138
168
|
rubyforge_project:
|
139
|
-
rubygems_version:
|
169
|
+
rubygems_version: 2.5.2
|
140
170
|
signing_key:
|
141
|
-
specification_version:
|
171
|
+
specification_version: 4
|
142
172
|
summary: fluentd output plugin for post to chatwork
|
143
173
|
test_files:
|
144
174
|
- spec/lib/fluent/plugin/out_chatwork_spec.rb
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require "chatwork"
|
3
|
-
|
4
|
-
module Fluent
|
5
|
-
class ChatworkOutput < Fluent::Output
|
6
|
-
# First, register the plugin. NAME is the name of this plugin
|
7
|
-
# and identifies the plugin in the configuration file.
|
8
|
-
Fluent::Plugin.register_output('chatwork', self)
|
9
|
-
|
10
|
-
config_param :api_token, :string
|
11
|
-
config_param :room_id , :string
|
12
|
-
config_param :message , :string
|
13
|
-
|
14
|
-
# This method is called before starting.
|
15
|
-
def configure(conf)
|
16
|
-
super
|
17
|
-
end
|
18
|
-
|
19
|
-
# This method is called when starting.
|
20
|
-
def start
|
21
|
-
super
|
22
|
-
end
|
23
|
-
|
24
|
-
# This method is called when shutting down.
|
25
|
-
def shutdown
|
26
|
-
super
|
27
|
-
end
|
28
|
-
|
29
|
-
# This method is called when an event reaches Fluentd.
|
30
|
-
# 'es' is a Fluent::EventStream object that includes multiple events.
|
31
|
-
# You can use 'es.each {|time,record| ... }' to retrieve events.
|
32
|
-
# 'chain' is an object that manages transactions. Call 'chain.next' at
|
33
|
-
# appropriate points and rollback if it raises an exception.
|
34
|
-
def emit(tag, es, chain)
|
35
|
-
chain.next
|
36
|
-
es.each {|time,record|
|
37
|
-
post_message(time: time, record: record, tag: tag)
|
38
|
-
}
|
39
|
-
end
|
40
|
-
|
41
|
-
def post_message(args={})
|
42
|
-
body = generate_message(args)
|
43
|
-
ChatWork.api_key = @api_token
|
44
|
-
ChatWork::Message.create(room_id: @room_id, body: body)
|
45
|
-
end
|
46
|
-
|
47
|
-
def generate_message(args={})
|
48
|
-
time = args[:time]
|
49
|
-
record = args[:record]
|
50
|
-
tag = args[:tag]
|
51
|
-
|
52
|
-
ERB.new(@message).result(binding).gsub("\\n", "\n")
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|