fluent-plugin-hipchat 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -0
- data/VERSION +1 -1
- data/lib/fluent/plugin/out_hipchat.rb +14 -4
- data/test/plugin/out_hipchat.rb +7 -7
- metadata +51 -15
data/README.rdoc
CHANGED
@@ -12,6 +12,8 @@
|
|
12
12
|
default_room my_room
|
13
13
|
default_from fluentd
|
14
14
|
default_color yellow
|
15
|
+
default_notify 0
|
16
|
+
default_format html
|
15
17
|
</match>
|
16
18
|
|
17
19
|
|
@@ -20,6 +22,8 @@
|
|
20
22
|
:message => 'Hello<br>World!',
|
21
23
|
:color => 'red',
|
22
24
|
:room => 'my_room',
|
25
|
+
:notify => 1,
|
26
|
+
:format => 'text',
|
23
27
|
})
|
24
28
|
|
25
29
|
= Copyright
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -1,13 +1,16 @@
|
|
1
1
|
|
2
2
|
module Fluent
|
3
3
|
class HipchatOutput < Output
|
4
|
-
COLORS = %w(yellow green purple random)
|
4
|
+
COLORS = %w(yellow red green purple gray random)
|
5
|
+
FORMAT = %w(html text)
|
5
6
|
Fluent::Plugin.register_output('hipchat', self)
|
6
7
|
|
7
8
|
config_param :api_token, :string
|
8
9
|
config_param :default_room, :string, :default => nil
|
9
10
|
config_param :default_color, :string, :default => nil
|
10
11
|
config_param :default_from, :string, :default => nil
|
12
|
+
config_param :default_notify, :bool, :default => nil
|
13
|
+
config_param :default_format, :string, :default => nil
|
11
14
|
|
12
15
|
attr_reader :hipchat
|
13
16
|
|
@@ -20,9 +23,11 @@ module Fluent
|
|
20
23
|
super
|
21
24
|
|
22
25
|
@hipchat = HipChat::API.new(conf['api_token'])
|
23
|
-
@default_from = conf['default_from'] || 'fluentd'
|
24
26
|
@default_room = conf['default_room']
|
27
|
+
@default_from = conf['default_from'] || 'fluentd'
|
28
|
+
@default_notify = conf['default_notify'] || 0
|
25
29
|
@default_color = conf['default_color'] || 'yellow'
|
30
|
+
@default_format = conf['default_format'] || 'html'
|
26
31
|
end
|
27
32
|
|
28
33
|
def emit(tag, es, chain)
|
@@ -39,9 +44,14 @@ module Fluent
|
|
39
44
|
room = record['room'] || @default_room
|
40
45
|
from = record['from'] || @default_from
|
41
46
|
message = record['message'] || ''
|
42
|
-
|
47
|
+
if record['notify'].nil?
|
48
|
+
notify = @default_notify
|
49
|
+
else
|
50
|
+
notify = record['notify'] ? 1 : 0
|
51
|
+
end
|
43
52
|
color = COLORS.include?(record['color']) ? record['color'] : @default_color
|
44
|
-
|
53
|
+
message_format = FORMAT.include?(record['format']) ? record['format'] : @default_format
|
54
|
+
@hipchat.rooms_message(room, from, message, notify, color, message_format)
|
45
55
|
end
|
46
56
|
end
|
47
57
|
end
|
data/test/plugin/out_hipchat.rb
CHANGED
@@ -19,7 +19,6 @@ class HipchatOutputTest < Test::Unit::TestCase
|
|
19
19
|
def setup
|
20
20
|
super
|
21
21
|
Fluent::Test.setup
|
22
|
-
# any_instance_of(HipChat::Client, :redis= => lambda {}, :redis => @subject)
|
23
22
|
end
|
24
23
|
|
25
24
|
CONFIG = %[
|
@@ -27,7 +26,7 @@ class HipchatOutputTest < Test::Unit::TestCase
|
|
27
26
|
api_token testtoken
|
28
27
|
default_room testroom
|
29
28
|
default_from testuser
|
30
|
-
default_color
|
29
|
+
default_color yellow
|
31
30
|
]
|
32
31
|
|
33
32
|
def create_driver(conf = CONFIG)
|
@@ -41,7 +40,7 @@ class HipchatOutputTest < Test::Unit::TestCase
|
|
41
40
|
api_token xxx
|
42
41
|
default_room testroom
|
43
42
|
EOF
|
44
|
-
stub(d.instance.hipchat).rooms_message('testroom', 'fluentd', 'foo', 0, 'yellow')
|
43
|
+
stub(d.instance.hipchat).rooms_message('testroom', 'fluentd', 'foo', 0, 'yellow', 'html')
|
45
44
|
assert_equal d.instance.hipchat.instance_variable_get(:@token), 'xxx'
|
46
45
|
d.emit({'message' => 'foo'})
|
47
46
|
d.run
|
@@ -49,15 +48,15 @@ class HipchatOutputTest < Test::Unit::TestCase
|
|
49
48
|
|
50
49
|
def test_message
|
51
50
|
d = create_driver
|
52
|
-
stub(d.instance.hipchat).rooms_message('testroom', 'testuser', 'foo', 0, 'red')
|
51
|
+
stub(d.instance.hipchat).rooms_message('testroom', 'testuser', 'foo', 0, 'red', 'html')
|
53
52
|
assert_equal d.instance.hipchat.instance_variable_get(:@token), 'testtoken'
|
54
|
-
d.emit({'message' => 'foo'})
|
53
|
+
d.emit({'message' => 'foo', 'color' => 'red'})
|
55
54
|
d.run
|
56
55
|
end
|
57
56
|
|
58
57
|
def test_message_override
|
59
58
|
d = create_driver
|
60
|
-
stub(d.instance.hipchat).rooms_message('my', 'alice', 'aaa', 1, 'random')
|
59
|
+
stub(d.instance.hipchat).rooms_message('my', 'alice', 'aaa', 1, 'random', 'text')
|
61
60
|
d.emit(
|
62
61
|
{
|
63
62
|
'room' => 'my',
|
@@ -65,6 +64,7 @@ class HipchatOutputTest < Test::Unit::TestCase
|
|
65
64
|
'message' => 'aaa',
|
66
65
|
'notify' => true,
|
67
66
|
'color' => 'random',
|
67
|
+
'format' => 'text',
|
68
68
|
}
|
69
69
|
)
|
70
70
|
d.run
|
@@ -72,7 +72,7 @@ class HipchatOutputTest < Test::Unit::TestCase
|
|
72
72
|
|
73
73
|
def test_color_validate
|
74
74
|
d = create_driver
|
75
|
-
stub(d.instance.hipchat).rooms_message('testroom', 'testuser', 'foo', 0, '
|
75
|
+
stub(d.instance.hipchat).rooms_message('testroom', 'testuser', 'foo', 0, 'yellow', 'html')
|
76
76
|
d.emit({'message' => 'foo', 'color' => 'invalid'})
|
77
77
|
d.run
|
78
78
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-hipchat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 0.10.8
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.10.8
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: hipchat-api
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: 1.0.0
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.0.0
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rake
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: 0.9.2
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.2
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: simplecov
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: 0.5.4
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.5.4
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: rr
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: 1.0.0
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.0.0
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: pry
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,7 +101,12 @@ dependencies:
|
|
76
101
|
version: '0'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
80
110
|
description: fluent HipChat plugin
|
81
111
|
email: hotchpotch@gmail.com
|
82
112
|
executables: []
|
@@ -106,15 +136,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
136
|
- - ! '>='
|
107
137
|
- !ruby/object:Gem::Version
|
108
138
|
version: '0'
|
139
|
+
segments:
|
140
|
+
- 0
|
141
|
+
hash: 2040291530210343481
|
109
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
143
|
none: false
|
111
144
|
requirements:
|
112
145
|
- - ! '>='
|
113
146
|
- !ruby/object:Gem::Version
|
114
147
|
version: '0'
|
148
|
+
segments:
|
149
|
+
- 0
|
150
|
+
hash: 2040291530210343481
|
115
151
|
requirements: []
|
116
152
|
rubyforge_project:
|
117
|
-
rubygems_version: 1.8.
|
153
|
+
rubygems_version: 1.8.24
|
118
154
|
signing_key:
|
119
155
|
specification_version: 3
|
120
156
|
summary: fluent HipChat plugin
|