fluent-plugin-out_chatwork 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.2
6
+ bundler_args: --jobs=2
7
+ script: bundle exec rspec
8
+ branches:
9
+ only:
10
+ - master
11
+ notifications:
12
+ email: false
data/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  fluentd output plugin for post to [ChatWork](http://www.chatwork.com/)
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/fluent-plugin-out_chatwork.svg)](http://badge.fury.io/rb/fluent-plugin-out_chatwork)
6
+ [![Build Status](https://travis-ci.org/sue445/fluent-plugin-out_chatwork.svg)](https://travis-ci.org/sue445/fluent-plugin-out_chatwork)
7
+
5
8
  ## Installation
6
9
 
7
10
  Add this line to your application's Gemfile:
@@ -23,7 +26,7 @@ Or install it yourself as:
23
26
  type chatwork
24
27
  api_token YOUR_SECRET_TOKEN
25
28
  room_id 0000000000
26
- message Hello ChatWork!
29
+ message Hello ChatWork! <%= record["value"] %>
27
30
  </match>
28
31
  ```
29
32
 
@@ -33,6 +36,16 @@ Or install it yourself as:
33
36
  * send message to this room
34
37
  * message
35
38
  * message content
39
+ * support erb format
40
+
41
+ ## Changelog
42
+ ### 0.0.2
43
+ [full changelog](http://github.com/sue445/fluent-plugin-out_chatwork/compare/v0.0.1...v0.0.2)
44
+
45
+ * Support erb at message
46
+
47
+ ### 0.0.1
48
+ * Initial commit
36
49
 
37
50
  ## Contributing
38
51
 
@@ -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-out_chatwork"
7
- spec.version = "0.0.1"
7
+ spec.version = "0.0.2"
8
8
  spec.authors = ["sue445"]
9
9
  spec.email = ["sue445@sue445.net"]
10
10
  spec.summary = %q{fluentd output plugin for post to chatwork}
@@ -33,14 +33,20 @@ module Fluent
33
33
  def emit(tag, es, chain)
34
34
  chain.next
35
35
  es.each {|time,record|
36
- post_message
36
+ post_message(time: time, record: record, tag: tag)
37
37
  }
38
38
  end
39
39
 
40
40
  private
41
- def post_message
41
+ def post_message(args={})
42
+ time = args[:time]
43
+ record = args[:record]
44
+ tag = args[:tag]
45
+
46
+ erb = ERB.new(@message)
47
+ body = erb.result(binding)
42
48
  ChatWork.api_key = @api_token
43
- ChatWork::Message.create(room_id: @room_id, body: @message)
49
+ ChatWork::Message.create(room_id: @room_id, body: body)
44
50
  end
45
51
  end
46
52
  end
@@ -22,6 +22,10 @@ describe Fluent::ChatworkOutput do
22
22
  it "should get message" do
23
23
  expect( instance.message ).to eq "some message"
24
24
  end
25
+
26
+ context "When contain erb" do
27
+
28
+ end
25
29
  end
26
30
 
27
31
  describe "#emit" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-out_chatwork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -100,6 +100,7 @@ extra_rdoc_files: []
100
100
  files:
101
101
  - .gitignore
102
102
  - .rspec
103
+ - .travis.yml
103
104
  - Gemfile
104
105
  - LICENSE.txt
105
106
  - README.md
@@ -123,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
124
  version: '0'
124
125
  segments:
125
126
  - 0
126
- hash: -1428027349112960945
127
+ hash: 872810270354693595
127
128
  required_rubygems_version: !ruby/object:Gem::Requirement
128
129
  none: false
129
130
  requirements:
@@ -132,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
133
  version: '0'
133
134
  segments:
134
135
  - 0
135
- hash: -1428027349112960945
136
+ hash: 872810270354693595
136
137
  requirements: []
137
138
  rubyforge_project:
138
139
  rubygems_version: 1.8.23