Skip to content

Commit

Permalink
version bump and added notifier for campfire
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Scott committed Nov 14, 2012
1 parent 7b88627 commit 75240f3
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 4 deletions.
9 changes: 9 additions & 0 deletions examples/santoku-after.rb
@@ -1,9 +1,14 @@
## Put this in config/santoku-after.rb
## Use :hipchat or :campfire for the use of each notifier

match /spork/ do
notify :hipchat, "Someone used the spork plugin"
end

match /spork/ do
notify :campfire, "Someone used the spork plugin"
end

match /from file/ do
notify :hipchat
end
Expand All @@ -23,4 +28,8 @@

match /bootstrap/ do
notify :hipchat
end

match /bootstrap/ do
notify :campfire
end
8 changes: 7 additions & 1 deletion examples/santoku-before.rb
@@ -1,7 +1,13 @@
## Put this in config/santoku-before.rb
## Use :hipchat or :campfire for the use of each notifier

require 'etc'

match /cookbook upload (.*)/ do |cookbook|
notify :hipchat, "#{Etc.getlogin} started uploading #{cookbook}"
end
end

match /cookbook upload (.*)/ do |cookbook|
notify :campfire, "#{Etc.getlogin} started uploading #{cookbook}"
end

7 changes: 6 additions & 1 deletion examples/santoku-config.yml
Expand Up @@ -5,4 +5,9 @@ hipchat:
room: "developers"
from: "Knife"
notify: false
color: "yellow"
color: "yellow"
campfire:
subdomain: "mycampfiredomain"
token: "your_campfire_api_token"
room: "developers"
notify: false
1 change: 1 addition & 0 deletions knife-santoku.gemspec
Expand Up @@ -18,4 +18,5 @@ Gem::Specification.new do |gem|
gem.add_dependency "chef"
gem.add_dependency "httparty"
gem.add_dependency "app_conf"
gem.add_dependency "tinder"
end
1 change: 1 addition & 0 deletions lib/knife-santoku.rb
@@ -1,6 +1,7 @@
require "knife_santoku/version"
require "knife_santoku/notifier"
require 'knife_santoku/notification/hipchat_notifier'
require 'knife_santoku/notification/campfire_notifier'
require "knife_santoku/callback"
require "knife_santoku/monkey_patches/knife"
require "knife_santoku/application"
Expand Down
24 changes: 24 additions & 0 deletions lib/knife_santoku/notification/campfire_notifier.rb
@@ -0,0 +1,24 @@
require 'tinder'

module KnifeSantoku
module Notification
class CampfireNotifier

def initialize(config)

@subdomain = config["campfire"]["subdomain"]
@token = config["campfire"]["token"]
@room = config["campfire"]["room"]
@notify = 0 if config["campfire"]["notify"] == false
@notify = 1 if config["campfire"]["notify"] == true
end

def notify(msg)
campfire = Tinder::Campfire.new "#{@subdomain}" , :token => "#{@token}"
room = campfire.rooms.find_room_by_id(@room)
room.speak(msg) if @notify
end

end
end
end
2 changes: 1 addition & 1 deletion lib/knife_santoku/notifier.rb
Expand Up @@ -4,7 +4,7 @@ class Notifier
def initialize(config)
@config = config

@notifiers = { :hipchat => ::KnifeSantoku::Notification::HipchatNotifier }
@notifiers = { :hipchat => ::KnifeSantoku::Notification::HipchatNotifier, :campfire => ::KnifeSantoku::Notification::CampfireNotifier }

# iterate through our internal folder and our external folder for notification classes
end
Expand Down
2 changes: 1 addition & 1 deletion lib/knife_santoku/version.rb
@@ -1,3 +1,3 @@
module KnifeSantoku
VERSION = "0.1.5"
VERSION = "0.1.6"
end

0 comments on commit 75240f3

Please sign in to comment.