eye-hipchat 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +72 -0
- data/Rakefile +2 -0
- data/examples/hipchat.eye +21 -0
- data/eye-hipchat.gemspec +26 -0
- data/lib/eye/notify/hipchat/version.rb +10 -0
- data/lib/eye/notify/hipchat.rb +54 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
N2I4NTI5NmQ0OWVkYjM2YjRlMmUyZWNjZDZkY2I3YzYwYTBiMjFhYg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Y2VhZDM2MWJlNTJjMzg4YTc2N2YxNWQzZmRhOTkwZjY0Y2JmZDlhZg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NTUxYTFlYjdmMDU2YmNiZWJlZTdkMTNmM2JjZWRiYjBiNDkxNTNkNTJiYTE5
|
10
|
+
ZmU1MDM5NTIxZGJkM2I2ZTZmNjFjNTlkNDRmMmFhYTBhNTQzYzJkZWE1Nzdh
|
11
|
+
M2YwNGMzYWQxMWM5NTgxZTY1NTUyN2RjM2ViZDhkZThlNTU1Yjg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NTNiOWVmY2ViZDhjMWE1ZjAxOTZiZWZiNTc2MjJhNjU3MGM1ZjA2MzJhYTBl
|
14
|
+
NDM0YmIyNDFjM2RlZTE4NDkwMThkYzJmYjhlYWFiYzJjZjY1MzUwOGM1YWYy
|
15
|
+
ODQ3NWNiODk2MzUxZTM0NDA1Y2ZkNTU0ODBiYmNmNjNlN2JmMTQ=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Tom Meinlschmidt
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# Eye::Hipchat
|
2
|
+
|
3
|
+
Sends info about process crashes to hipchat room.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'eye'
|
11
|
+
gem 'eye-hipchat'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install eye-hipchat
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
this is an example configuration file
|
25
|
+
|
26
|
+
````
|
27
|
+
# Notify example
|
28
|
+
require 'eye/notify/hipchat'
|
29
|
+
|
30
|
+
Eye.config do
|
31
|
+
hipchat token: 'hipchat_v1_token', message: '<strong>#name#</strong> (#pid#) on #host# #message# at #time#.'
|
32
|
+
contact :dev, :hipchat, 'test'
|
33
|
+
logger '/tmp/eye.log'
|
34
|
+
end
|
35
|
+
|
36
|
+
Eye.application 'test' do
|
37
|
+
notify :dev, :debug
|
38
|
+
stdall '/tmp/eye-example.log'
|
39
|
+
|
40
|
+
process :some_process do
|
41
|
+
notify :dev, :debug
|
42
|
+
start_command 'sleep 120'
|
43
|
+
daemonize true
|
44
|
+
pid_file '/tmp/sleep.pid'
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
````
|
49
|
+
|
50
|
+
# Configuration
|
51
|
+
|
52
|
+
* add `hipchat` line to `Eye.config` section and check following parameters
|
53
|
+
* `token` - *required* - v1/v2 token
|
54
|
+
* `api` - use *v1* (default) or v2
|
55
|
+
* `name` - who is reporting to hipchat, *Eye Bot* as a default
|
56
|
+
* `color` - *yellow* is default. You can choose from gray, green, purple, red, yellow or random
|
57
|
+
* `message` - message to be sent, default is `<strong>#name#</strong> on #host# #message# at #time#.`
|
58
|
+
* `time` - human readable time of the event
|
59
|
+
* `host` - hostname
|
60
|
+
* `message` - full message
|
61
|
+
* `name` - name of process
|
62
|
+
* `full_name` - full process name (like group::process)
|
63
|
+
* `pid` - process ID
|
64
|
+
* `level` - message info level
|
65
|
+
|
66
|
+
## Contributing
|
67
|
+
|
68
|
+
1. Fork it ( https://github.com/[my-github-username]/eye-hipchat/fork )
|
69
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
70
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
71
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
72
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Notify example
|
2
|
+
require 'eye/notify/hipchat'
|
3
|
+
|
4
|
+
Eye.config do
|
5
|
+
hipchat :token => 'hipchat_v1_token', message: '<strong>#name#</strong> (#pid#) on #host# #message# at #time#.'
|
6
|
+
contact :dev, :hipchat, 'test'
|
7
|
+
logger '/tmp/eye.log'
|
8
|
+
end
|
9
|
+
|
10
|
+
Eye.application 'test' do
|
11
|
+
notify :dev, :debug
|
12
|
+
stdall '/tmp/eye-example.log'
|
13
|
+
|
14
|
+
process :some_process do
|
15
|
+
notify :dev, :debug
|
16
|
+
start_command 'sleep 120'
|
17
|
+
daemonize true
|
18
|
+
pid_file '/tmp/sleep.pid'
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
data/eye-hipchat.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'eye/notify/hipchat/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "eye-hipchat"
|
8
|
+
spec.version = Eye::Notify::Hipchat::VERSION
|
9
|
+
spec.authors = ["Tom Meinlschmidt"]
|
10
|
+
spec.email = ["tomas@meinlschmidt.org"]
|
11
|
+
spec.summary = %q{Eye to hipchat notification}
|
12
|
+
spec.description = %q{Eye to hipchat notification}
|
13
|
+
spec.homepage = "https://github.com/tmeinlschmidt/eye-hipchat"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
|
24
|
+
spec.add_runtime_dependency "hipchat", ">= 1.2.0"
|
25
|
+
spec.add_runtime_dependency "eye", ">= 0.5.0"
|
26
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'eye'
|
2
|
+
require 'eye/notify/hipchat/version'
|
3
|
+
|
4
|
+
require 'hipchat'
|
5
|
+
|
6
|
+
module Eye
|
7
|
+
class Notify
|
8
|
+
|
9
|
+
class Hipchat < Eye::Notify::Custom
|
10
|
+
|
11
|
+
# Eye.config do
|
12
|
+
# hipchat token: '1312312', api: 'v1', name: 'eye bot', color: 'red'
|
13
|
+
# contact :info, :hipchat, 'room name'
|
14
|
+
# end
|
15
|
+
|
16
|
+
param :token, String, true
|
17
|
+
# not required, if not specified, we're using v1
|
18
|
+
param :api, String, false, 'v1'
|
19
|
+
# not required, if not specified, we're using 'Eye Bot'
|
20
|
+
param :name, String, false, 'Eye Bot'
|
21
|
+
# not required, 'yellow' as default color
|
22
|
+
param :color, String, false, 'yellow', ['gray','green','purple','red','yellow','random']
|
23
|
+
# available messages:
|
24
|
+
# time host message name full_name pid level
|
25
|
+
param :message, String, false, '<strong>#name#</strong> on #host# #message# at #time#.'
|
26
|
+
|
27
|
+
def execute
|
28
|
+
say(parse_message)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def parse_message
|
34
|
+
%w{time host message name full_name pid level}.each do |variable|
|
35
|
+
message.gsub!("##{variable}#", send("msg_#{variable}").to_s) if message =~ /##{variable}#/
|
36
|
+
end
|
37
|
+
message
|
38
|
+
end
|
39
|
+
|
40
|
+
def msg_time
|
41
|
+
Eye::Utils.human_time2(msg_at)
|
42
|
+
end
|
43
|
+
|
44
|
+
def client
|
45
|
+
HipChat::Client.new(token, api_version: api)
|
46
|
+
end
|
47
|
+
|
48
|
+
def say(what)
|
49
|
+
client[contact].send(name, what, message_format: 'html')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eye-hipchat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tom Meinlschmidt
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
type: :development
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '1.7'
|
25
|
+
prerelease: false
|
26
|
+
name: bundler
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
type: :development
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
version_requirements: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '10.0'
|
39
|
+
prerelease: false
|
40
|
+
name: rake
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
type: :runtime
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.2.0
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.2.0
|
53
|
+
prerelease: false
|
54
|
+
name: hipchat
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
type: :runtime
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.5.0
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.5.0
|
67
|
+
prerelease: false
|
68
|
+
name: eye
|
69
|
+
description: Eye to hipchat notification
|
70
|
+
email:
|
71
|
+
- tomas@meinlschmidt.org
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- examples/hipchat.eye
|
82
|
+
- eye-hipchat.gemspec
|
83
|
+
- lib/eye/notify/hipchat.rb
|
84
|
+
- lib/eye/notify/hipchat/version.rb
|
85
|
+
homepage: https://github.com/tmeinlschmidt/eye-hipchat
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ! '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.4.5
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: Eye to hipchat notification
|
109
|
+
test_files: []
|