fluent-plugin-terminal_notifier 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +69 -0
- data/Rakefile +9 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/fluent-plugin-terminal_notifier.gemspec +34 -0
- data/lib/fluent/plugin/out_terminal_notifier.rb +41 -0
- metadata +131 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dfe91d547ba959a92adee44289fe0578e6f07c1e
|
4
|
+
data.tar.gz: 30f04fe81464d442d916d72ea9d8689d7acdd74e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c21b6980db9322af5c9e42b9be379f153359529314a657df903486df924963900f3ca3ae5af8fb8d66a308a6a659be06bc9fd3dce7dac5805f863073605a3fbd
|
7
|
+
data.tar.gz: 15c04d15b3f5c3657167c763e747b7578a75b359150132ef7ab1a0a11a8db9621ae77f8852455b61cfe645db513065304c6be9486945a7fa1f2cb4dbfa2fc420
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Hiroshi Hatake
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Fluent::Plugin::TerminalNotifier
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/cosmo0920/fluent-plugin-terminal_notifier.svg?branch=master)](https://travis-ci.org/cosmo0920/fluent-plugin-terminal_notifier)
|
4
|
+
|
5
|
+
A fluentd plugin to notify notification center with terminal-notifier.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'fluent-plugin-terminal_notifier'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install fluent-plugin-terminal_notifier
|
22
|
+
|
23
|
+
## Configuration Example
|
24
|
+
|
25
|
+
For example, add `terminal-notifier` configuration section like this:
|
26
|
+
|
27
|
+
```
|
28
|
+
<match terminal-notifier.**>
|
29
|
+
type terminal-notifier
|
30
|
+
title test
|
31
|
+
sub_title sub
|
32
|
+
</match>
|
33
|
+
```
|
34
|
+
|
35
|
+
Also you can specify app ID to activate like this:
|
36
|
+
|
37
|
+
This example is activating Terminal.app.
|
38
|
+
|
39
|
+
```
|
40
|
+
<match terminal-notifier.**>
|
41
|
+
type terminal-notifier
|
42
|
+
title test
|
43
|
+
sub_title sub
|
44
|
+
activate com.apple.Terminal
|
45
|
+
</match>
|
46
|
+
```
|
47
|
+
|
48
|
+
In more detail about activatation, please refer to the [TerminalNotifier document](https://github.com/julienXX/terminal-notifier/blob/f727ffdb19c91bd4f87d30274c12044ccea47fe2/README.markdown).
|
49
|
+
|
50
|
+
## Parameters
|
51
|
+
|
52
|
+
- **title** (String. Optional) This key is used in Notification title.
|
53
|
+
- **sub_title** (String. Optional) This key is used in Notification sub title.
|
54
|
+
- **activate** (String. Optional) This key is used in OS X application activating.
|
55
|
+
|
56
|
+
## Development
|
57
|
+
|
58
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
59
|
+
|
60
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
61
|
+
|
62
|
+
## Contributing
|
63
|
+
|
64
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/cosmo0920/fluent-plugin-terminal_notifier.
|
65
|
+
|
66
|
+
|
67
|
+
## License
|
68
|
+
|
69
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "fluent/plugin/terminal_notifier"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,34 @@
|
|
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-terminal_notifier"
|
7
|
+
spec.version = "0.0.1"
|
8
|
+
spec.authors = ["Hiroshi Hatake"]
|
9
|
+
spec.email = ["cosmo0920.wp@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Fluent TerminalNotifier plugin.}
|
12
|
+
spec.description = %q{A fluentd plugin to notify notification center with terminal-notifier.}
|
13
|
+
spec.homepage = "https://github.com/cosmo0920/fluent-plugin-terminal_notifier"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "test-unit", "~> 3.1"
|
32
|
+
spec.add_runtime_dependency "fluentd", [">= 0.12.0", "< 2"]
|
33
|
+
spec.add_runtime_dependency "terminal-notifier", "~> 1.6"
|
34
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Fluent
|
2
|
+
class TerminalNotifierOutput < Output
|
3
|
+
Plugin.register_output('terminal-notifier', self);
|
4
|
+
|
5
|
+
DEFAULT_TITLE = "Fluentd Notification"
|
6
|
+
DEFAULT_SUB_TITLE = "Fluentd Notification Sub Title"
|
7
|
+
|
8
|
+
config_param :title, :string, default: DEFAULT_TITLE
|
9
|
+
config_param :sub_title, :string, default: DEFAULT_SUB_TITLE
|
10
|
+
config_param :activate, :string, default: ""
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
super
|
14
|
+
|
15
|
+
require 'terminal-notifier'
|
16
|
+
end
|
17
|
+
|
18
|
+
def configure(conf)
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def emit(tag, es, chain)
|
23
|
+
es.each{|time,record|
|
24
|
+
message = record["message"] || "#{record.to_json} at #{Time.at(time).localtime}"
|
25
|
+
options = make_option(record)
|
26
|
+
TerminalNotifier.notify(message, options)
|
27
|
+
}
|
28
|
+
chain.next
|
29
|
+
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
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-terminal_notifier
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hiroshi Hatake
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
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: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: test-unit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fluentd
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.12.0
|
62
|
+
- - "<"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '2'
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 0.12.0
|
72
|
+
- - "<"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '2'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: terminal-notifier
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '1.6'
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.6'
|
89
|
+
description: A fluentd plugin to notify notification center with terminal-notifier.
|
90
|
+
email:
|
91
|
+
- cosmo0920.wp@gmail.com
|
92
|
+
executables: []
|
93
|
+
extensions: []
|
94
|
+
extra_rdoc_files: []
|
95
|
+
files:
|
96
|
+
- ".gitignore"
|
97
|
+
- ".travis.yml"
|
98
|
+
- Gemfile
|
99
|
+
- LICENSE.txt
|
100
|
+
- README.md
|
101
|
+
- Rakefile
|
102
|
+
- bin/console
|
103
|
+
- bin/setup
|
104
|
+
- fluent-plugin-terminal_notifier.gemspec
|
105
|
+
- lib/fluent/plugin/out_terminal_notifier.rb
|
106
|
+
homepage: https://github.com/cosmo0920/fluent-plugin-terminal_notifier
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata:
|
110
|
+
allowed_push_host: https://rubygems.org
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.4.5.1
|
128
|
+
signing_key:
|
129
|
+
specification_version: 4
|
130
|
+
summary: Fluent TerminalNotifier plugin.
|
131
|
+
test_files: []
|