fluent-plugin-idobata 0.0.0
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 +7 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/README.md +45 -0
- data/Rakefile +1 -0
- data/fluent-plugin-idobata.gemspec +27 -0
- data/lib/fluent/plugin/out_idobata.rb +39 -0
- data/spec/lib/fluent/plugin/out_idobata_spec.rb +51 -0
- data/spec/spec_helper.rb +25 -0
- metadata +153 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 42d3ed691d22f8b2a08724ef7bbe4826a032508e
|
4
|
+
data.tar.gz: a25294b6419d2fd2af220855b3a31800271653d2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c25ac168924ef45fc2ad532cc3323fbbd85cb5b82dc847ff92279027d0bf052384320c5077b747a615b69f3cc3f1ed582adf9eed5da9e24b8a6dc602501e436b
|
7
|
+
data.tar.gz: 89e886eba67c14bfd9a0605155feaada19c204cba76acb34e9f259ca247557d12c0a5038381d2c2f5c13dee911d9f6a552e8814143a920cc11cc1a3af40b0d12
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# fluent-plugin-idobata
|
2
|
+
|
3
|
+
## Output
|
4
|
+
|
5
|
+
Plugin to send message to 'idobata'
|
6
|
+
|
7
|
+
### What's 'idobata'
|
8
|
+
|
9
|
+
'idobata' is VERY GREAT chat tool for team development on Web.
|
10
|
+
|
11
|
+
see: https://idobata.io
|
12
|
+
|
13
|
+
### Configure
|
14
|
+
|
15
|
+
````
|
16
|
+
<store>
|
17
|
+
type idobata
|
18
|
+
webhook_url https://idobata/web_hook/url
|
19
|
+
message_template field1 is <%= record['field1'] %> !
|
20
|
+
</store>
|
21
|
+
````
|
22
|
+
|
23
|
+
- idobata_url
|
24
|
+
- Your idobata webhook url
|
25
|
+
- message_template
|
26
|
+
- You can use erb notation
|
27
|
+
- send message to idobata
|
28
|
+
|
29
|
+
#### example
|
30
|
+
|
31
|
+
For messages such as: {"field1":300, "field2":20, "field3diff":-30}
|
32
|
+
|
33
|
+
send 'field1 is 300 !' message to your idobata room
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
1. Fork it
|
38
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
39
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
40
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
41
|
+
5. Create new Pull Request
|
42
|
+
|
43
|
+
## releases
|
44
|
+
|
45
|
+
- 2013/10/09 0.0.0 1st release
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "fluent-plugin-idobata"
|
7
|
+
spec.version = '0.0.0'
|
8
|
+
spec.authors = ["bash0C7"]
|
9
|
+
spec.email = ["koshiba+github@4038nullpointer.com"]
|
10
|
+
spec.description = "Fluentd output plugin to send data to idobata"
|
11
|
+
spec.summary = "Fluentd output plugin to send data to idobata"
|
12
|
+
spec.homepage = "https://github.com/bash0C7/fluent-plugin-idobata"
|
13
|
+
spec.license = "Ruby's"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "fluentd"
|
21
|
+
spec.add_dependency "httparty"
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
spec.add_development_dependency "rr"
|
26
|
+
spec.add_development_dependency "pry"
|
27
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'erb'
|
3
|
+
|
4
|
+
module Fluent
|
5
|
+
class Fluent::IdobataOutput < Fluent::Output
|
6
|
+
Fluent::Plugin.register_output('idobata', self)
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
config_param :webhook_url, :string
|
13
|
+
config_param :message_template, :string
|
14
|
+
|
15
|
+
def configure(conf)
|
16
|
+
super
|
17
|
+
|
18
|
+
@erb = ERB.new(@message_template)
|
19
|
+
end
|
20
|
+
|
21
|
+
def start
|
22
|
+
super
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
def shutdown
|
27
|
+
super
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
def emit(tag, es, chain)
|
32
|
+
es.each {|time,record|
|
33
|
+
HTTParty.post(@webhook_url, :body => "body=#{@erb.result(binding)}")
|
34
|
+
}
|
35
|
+
|
36
|
+
chain.next
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe do
|
4
|
+
let(:driver) {Fluent::Test::OutputTestDriver.new(Fluent::IdobataOutput, 'test.metrics').configure(config)}
|
5
|
+
let(:instance) {driver.instance}
|
6
|
+
|
7
|
+
describe 'config' do
|
8
|
+
let(:config) {
|
9
|
+
%[
|
10
|
+
webhook_url https://idobata/web_hook/url
|
11
|
+
message_template field1 value: <%= record["field1"] %>
|
12
|
+
]
|
13
|
+
}
|
14
|
+
|
15
|
+
context do
|
16
|
+
subject {instance.webhook_url}
|
17
|
+
it{should == 'https://idobata/web_hook/url'}
|
18
|
+
end
|
19
|
+
|
20
|
+
context do
|
21
|
+
subject {instance.message_template}
|
22
|
+
it{should == 'field1 value: <%= record["field1"] %>'}
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'emit' do
|
28
|
+
let(:record) {{ 'field1' => 50, 'otherfield' => 99}}
|
29
|
+
let(:time) {0}
|
30
|
+
let(:posted) {
|
31
|
+
d = driver
|
32
|
+
mock(HTTParty).post('https://idobata/web_hook/url', :body => 'body=field1 value: 50')
|
33
|
+
d.emit(record, Time.at(time))
|
34
|
+
d.run
|
35
|
+
}
|
36
|
+
|
37
|
+
context do
|
38
|
+
let(:config) {
|
39
|
+
%[
|
40
|
+
webhook_url https://idobata/web_hook/url
|
41
|
+
message_template field1 value: <%= record["field1"] %>
|
42
|
+
]
|
43
|
+
}
|
44
|
+
|
45
|
+
subject {posted}
|
46
|
+
it{should_not be_nil}
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
+
config.run_all_when_everything_filtered = true
|
10
|
+
config.filter_run :focus
|
11
|
+
|
12
|
+
# Run specs in random order to surface order dependencies. If you find an
|
13
|
+
# order dependency and want to debug it, you can fix the order by providing
|
14
|
+
# the seed, which is printed after each run.
|
15
|
+
# --seed 1234
|
16
|
+
config.order = 'random'
|
17
|
+
|
18
|
+
require 'fluent/load'
|
19
|
+
require 'fluent/test'
|
20
|
+
|
21
|
+
require 'fluent/plugin/out_idobata'
|
22
|
+
|
23
|
+
require 'pry'
|
24
|
+
require 'rr'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-idobata
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- bash0C7
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-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: httparty
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
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: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
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: rspec
|
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: rr
|
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
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Fluentd output plugin to send data to idobata
|
112
|
+
email:
|
113
|
+
- koshiba+github@4038nullpointer.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- .gitignore
|
119
|
+
- .rspec
|
120
|
+
- Gemfile
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- fluent-plugin-idobata.gemspec
|
124
|
+
- lib/fluent/plugin/out_idobata.rb
|
125
|
+
- spec/lib/fluent/plugin/out_idobata_spec.rb
|
126
|
+
- spec/spec_helper.rb
|
127
|
+
homepage: https://github.com/bash0C7/fluent-plugin-idobata
|
128
|
+
licenses:
|
129
|
+
- Ruby's
|
130
|
+
metadata: {}
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options: []
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 2.0.5
|
148
|
+
signing_key:
|
149
|
+
specification_version: 4
|
150
|
+
summary: Fluentd output plugin to send data to idobata
|
151
|
+
test_files:
|
152
|
+
- spec/lib/fluent/plugin/out_idobata_spec.rb
|
153
|
+
- spec/spec_helper.rb
|