fluent-plugin-terminal_notifier 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f72102148bf09fbc4dc3930a182f634f15186f97
|
4
|
+
data.tar.gz: e9cf57fa72fc3f80193cbf6c6b5ff8b5df6fc288
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85c54be26cf121e911716b09b4d751f89853f49320aa6873bfe4c07bfa9f8c3b44bde5a3bd77e5ab57ae47c17b9f138198b4a37c0b16d459ad0249d2baceed8e
|
7
|
+
data.tar.gz: 85fcdafc053772253cd3196bf12a1fffb66e9a3196855e717f744756f96a56455ba8124a016a1aeb09ea307faa618e8d08a60207f29d2f6cc352705e1e5b87d7
|
data/README.md
CHANGED
@@ -20,7 +20,10 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
$ gem install fluent-plugin-terminal_notifier
|
22
22
|
|
23
|
-
|
23
|
+
|
24
|
+
## TerminalNotifierOutput
|
25
|
+
|
26
|
+
### Configuration Example
|
24
27
|
|
25
28
|
For example, add `terminal-notifier` configuration section like this:
|
26
29
|
|
@@ -47,7 +50,44 @@ This example is activating Terminal.app.
|
|
47
50
|
|
48
51
|
In more detail about activatation, please refer to the [TerminalNotifier document](https://github.com/julienXX/terminal-notifier/blob/f727ffdb19c91bd4f87d30274c12044ccea47fe2/README.markdown).
|
49
52
|
|
50
|
-
|
53
|
+
### Parameters
|
54
|
+
|
55
|
+
- **title** (String. Optional) This key is used in Notification title.
|
56
|
+
- **sub_title** (String. Optional) This key is used in Notification sub title.
|
57
|
+
- **activate** (String. Optional) This key is used in OS X application activating.
|
58
|
+
|
59
|
+
## TerminalNotifierFilter
|
60
|
+
|
61
|
+
### Configuration Example
|
62
|
+
|
63
|
+
This is a filter version of terminal-notifier fluentd plugin.
|
64
|
+
|
65
|
+
For example, add `terminal-notifier` configuration section like this:
|
66
|
+
|
67
|
+
```
|
68
|
+
<filter filter.terminal-notifier.**>
|
69
|
+
type terminal-notifier
|
70
|
+
title filtered
|
71
|
+
sub_title sub_filtered
|
72
|
+
</filter>
|
73
|
+
```
|
74
|
+
|
75
|
+
Also you can specify app ID to activate like this:
|
76
|
+
|
77
|
+
This example is activating Terminal.app.
|
78
|
+
|
79
|
+
```
|
80
|
+
<filter filter.terminal-notifier.**>
|
81
|
+
type terminal-notifier
|
82
|
+
title filtered
|
83
|
+
sub_title sub_filtered
|
84
|
+
activate com.apple.Terminal
|
85
|
+
</filter>
|
86
|
+
```
|
87
|
+
|
88
|
+
In more detail about activatation, please refer to the [TerminalNotifier document](https://github.com/julienXX/terminal-notifier/blob/f727ffdb19c91bd4f87d30274c12044ccea47fe2/README.markdown).
|
89
|
+
|
90
|
+
### Parameters
|
51
91
|
|
52
92
|
- **title** (String. Optional) This key is used in Notification title.
|
53
93
|
- **sub_title** (String. Optional) This key is used in Notification sub title.
|
@@ -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-terminal_notifier"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.2"
|
8
8
|
spec.authors = ["Hiroshi Hatake"]
|
9
9
|
spec.email = ["cosmo0920.wp@gmail.com"]
|
10
10
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Fluent
|
2
|
+
class TerminalNotifierFilter < Filter
|
3
|
+
require_relative './notify_util'
|
4
|
+
include NotifyUtil
|
5
|
+
|
6
|
+
Plugin.register_filter('terminal-notifier', self);
|
7
|
+
|
8
|
+
DEFAULT_TITLE = "Fluentd Notification"
|
9
|
+
DEFAULT_SUB_TITLE = "Fluentd Notification Sub Title"
|
10
|
+
|
11
|
+
config_param :title, :string, default: DEFAULT_TITLE
|
12
|
+
config_param :sub_title, :string, default: DEFAULT_SUB_TITLE
|
13
|
+
config_param :activate, :string, default: ""
|
14
|
+
|
15
|
+
def configure(conf)
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def filter(tag, time, record)
|
20
|
+
notify(time, record)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'terminal-notifier'
|
2
|
+
|
3
|
+
module Fluent
|
4
|
+
module NotifyUtil
|
5
|
+
def notify(time, record)
|
6
|
+
message = record["message"] || "#{record.to_json} at #{Time.at(time).localtime}"
|
7
|
+
options = make_option(record)
|
8
|
+
TerminalNotifier.notify(message, options)
|
9
|
+
end
|
10
|
+
|
11
|
+
def make_option(record)
|
12
|
+
title = record["title"] || @title
|
13
|
+
sub_title = record["sub_title"] || @sub_title
|
14
|
+
options = {title: title, subtitle: sub_title}
|
15
|
+
unless @activate.empty?
|
16
|
+
options.merge!(activate: @activate)
|
17
|
+
end
|
18
|
+
options
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,5 +1,8 @@
|
|
1
1
|
module Fluent
|
2
2
|
class TerminalNotifierOutput < Output
|
3
|
+
require_relative './notify_util'
|
4
|
+
include NotifyUtil
|
5
|
+
|
3
6
|
Plugin.register_output('terminal-notifier', self);
|
4
7
|
|
5
8
|
DEFAULT_TITLE = "Fluentd Notification"
|
@@ -9,33 +12,15 @@ module Fluent
|
|
9
12
|
config_param :sub_title, :string, default: DEFAULT_SUB_TITLE
|
10
13
|
config_param :activate, :string, default: ""
|
11
14
|
|
12
|
-
def initialize
|
13
|
-
super
|
14
|
-
|
15
|
-
require 'terminal-notifier'
|
16
|
-
end
|
17
|
-
|
18
15
|
def configure(conf)
|
19
16
|
super
|
20
17
|
end
|
21
18
|
|
22
19
|
def emit(tag, es, chain)
|
23
20
|
es.each{|time,record|
|
24
|
-
|
25
|
-
options = make_option(record)
|
26
|
-
TerminalNotifier.notify(message, options)
|
21
|
+
notify(time, record)
|
27
22
|
}
|
28
23
|
chain.next
|
29
24
|
end
|
30
|
-
|
31
|
-
def make_option(record)
|
32
|
-
title = record["title"] || @title
|
33
|
-
sub_title = record["sub_title"] || @sub_title
|
34
|
-
options = {title: title, subtitle: sub_title}
|
35
|
-
unless activate.empty?
|
36
|
-
options.merge!(activate: activate)
|
37
|
-
end
|
38
|
-
options
|
39
|
-
end
|
40
25
|
end
|
41
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-terminal_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Hatake
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -102,6 +102,8 @@ files:
|
|
102
102
|
- bin/console
|
103
103
|
- bin/setup
|
104
104
|
- fluent-plugin-terminal_notifier.gemspec
|
105
|
+
- lib/fluent/plugin/filter_terminal_notifier.rb
|
106
|
+
- lib/fluent/plugin/notify_util.rb
|
105
107
|
- lib/fluent/plugin/out_terminal_notifier.rb
|
106
108
|
homepage: https://github.com/cosmo0920/fluent-plugin-terminal_notifier
|
107
109
|
licenses:
|