hipchat 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/hipchat.gemspec +3 -2
  3. data/lib/hipchat/chef.rb +31 -0
  4. metadata +4 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hipchat}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["david"]
12
- s.date = %q{2010-10-28}
12
+ s.date = %q{2010-11-08}
13
13
  s.description = %q{Ruby library to interact with HipChat}
14
14
  s.email = %q{dgleal@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
26
26
  "hipchat.gemspec",
27
27
  "lib/hipchat.rb",
28
28
  "lib/hipchat/capistrano.rb",
29
+ "lib/hipchat/chef.rb",
29
30
  "spec/hipchat_spec.rb",
30
31
  "spec/spec.opts",
31
32
  "spec/spec_helper.rb"
@@ -0,0 +1,31 @@
1
+ require 'hipchat'
2
+
3
+ #
4
+ # Provides a Chef exception handler so you can send information about
5
+ # chef-client failures to a HipChat room.
6
+ #
7
+ # Docs: http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers
8
+ #
9
+ # Install - add the following to your client.rb:
10
+ # require 'hipchat/chef'
11
+ # hipchat_handler = HipChat::NotifyRoom.new("<api token>", "<room name>")
12
+ # exception_handlers << hipchat_handler
13
+ #
14
+
15
+ module HipChat
16
+ class NotifyRoom < Chef::Handler
17
+
18
+ def initialize(api_token, room_name, notify_users=false)
19
+ @api_token = api_token
20
+ @room_name = room_name
21
+ @notify_users = notify_users
22
+ end
23
+
24
+ def report
25
+ msg = "Failure on #{node.name}: #{run_status.formatted_exception}"
26
+
27
+ client = HipChat::Client.new(@api_token)
28
+ client[@room_name].send('Chef', msg, @notify_users)
29
+ end
30
+ end
31
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - david
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-28 00:00:00 +01:00
17
+ date: 2010-11-08 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -64,6 +64,7 @@ files:
64
64
  - hipchat.gemspec
65
65
  - lib/hipchat.rb
66
66
  - lib/hipchat/capistrano.rb
67
+ - lib/hipchat/chef.rb
67
68
  - spec/hipchat_spec.rb
68
69
  - spec/spec.opts
69
70
  - spec/spec_helper.rb