knife-santoku 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/examples/santoku-after.rb +9 -0
- data/examples/santoku-before.rb +7 -1
- data/examples/santoku-config.yml +6 -1
- data/knife-santoku.gemspec +1 -0
- data/lib/knife-santoku.rb +1 -0
- data/lib/knife_santoku/notification/campfire_notifier.rb +24 -0
- data/lib/knife_santoku/notifier.rb +1 -1
- data/lib/knife_santoku/version.rb +1 -1
- metadata +19 -2
data/README.md
CHANGED
|
@@ -8,7 +8,7 @@ http://en.wikipedia.org/wiki/Santoku
|
|
|
8
8
|
|
|
9
9
|
Santoku is primarily used for firing off notifications when knife commands are run. There are two concepts in Santoku: callbacks, and notifiers. Santoku fires off callbacks before and after any knife command is run. Callbacks can be any arbitrary ruby code in config/santoku-before.rb or config/santoku-after.rb. However, they are primarily made up of regexp matcher functions that fire off notifications to Santoku notification plugins.
|
|
10
10
|
|
|
11
|
-
Right now only Hipchat support has been written. More work will be done to let you drop your own notification classes into the lib/santoku/ folder of your chef repo to build integrations with your favorite systems. If you build out something and would like it added to the master project just send me a pull request.
|
|
11
|
+
Right now only Hipchat & Campfire support has been written. More work will be done to let you drop your own notification classes into the lib/santoku/ folder of your chef repo to build integrations with your favorite systems. If you build out something and would like it added to the master project just send me a pull request.
|
|
12
12
|
|
|
13
13
|
You don't have to use Santoku for notifications, that's just what it was originally built for.
|
|
14
14
|
|
data/examples/santoku-after.rb
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
## Put this in config/santoku-after.rb
|
|
2
|
+
## Use :hipchat or :campfire for the use of each notifier
|
|
2
3
|
|
|
3
4
|
match /spork/ do
|
|
4
5
|
notify :hipchat, "Someone used the spork plugin"
|
|
5
6
|
end
|
|
6
7
|
|
|
8
|
+
match /spork/ do
|
|
9
|
+
notify :campfire, "Someone used the spork plugin"
|
|
10
|
+
end
|
|
11
|
+
|
|
7
12
|
match /from file/ do
|
|
8
13
|
notify :hipchat
|
|
9
14
|
end
|
|
@@ -23,4 +28,8 @@ end
|
|
|
23
28
|
|
|
24
29
|
match /bootstrap/ do
|
|
25
30
|
notify :hipchat
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
match /bootstrap/ do
|
|
34
|
+
notify :campfire
|
|
26
35
|
end
|
data/examples/santoku-before.rb
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
## Put this in config/santoku-before.rb
|
|
2
|
+
## Use :hipchat or :campfire for the use of each notifier
|
|
2
3
|
|
|
3
4
|
require 'etc'
|
|
4
5
|
|
|
5
6
|
match /cookbook upload (.*)/ do |cookbook|
|
|
6
7
|
notify :hipchat, "#{Etc.getlogin} started uploading #{cookbook}"
|
|
7
|
-
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
match /cookbook upload (.*)/ do |cookbook|
|
|
11
|
+
notify :campfire, "#{Etc.getlogin} started uploading #{cookbook}"
|
|
12
|
+
end
|
|
13
|
+
|
data/examples/santoku-config.yml
CHANGED
data/knife-santoku.gemspec
CHANGED
data/lib/knife-santoku.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require "knife_santoku/version"
|
|
2
2
|
require "knife_santoku/notifier"
|
|
3
3
|
require 'knife_santoku/notification/hipchat_notifier'
|
|
4
|
+
require 'knife_santoku/notification/campfire_notifier'
|
|
4
5
|
require "knife_santoku/callback"
|
|
5
6
|
require "knife_santoku/monkey_patches/knife"
|
|
6
7
|
require "knife_santoku/application"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'tinder'
|
|
2
|
+
|
|
3
|
+
module KnifeSantoku
|
|
4
|
+
module Notification
|
|
5
|
+
class CampfireNotifier
|
|
6
|
+
|
|
7
|
+
def initialize(config)
|
|
8
|
+
|
|
9
|
+
@subdomain = config["campfire"]["subdomain"]
|
|
10
|
+
@token = config["campfire"]["token"]
|
|
11
|
+
@room = config["campfire"]["room"]
|
|
12
|
+
@notify = 0 if config["campfire"]["notify"] == false
|
|
13
|
+
@notify = 1 if config["campfire"]["notify"] == true
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def notify(msg)
|
|
17
|
+
campfire = Tinder::Campfire.new "#{@subdomain}" , :token => "#{@token}"
|
|
18
|
+
room = campfire.find_room_by_name(@room)
|
|
19
|
+
room.speak(msg) if @notify
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -4,7 +4,7 @@ module KnifeSantoku
|
|
|
4
4
|
def initialize(config)
|
|
5
5
|
@config = config
|
|
6
6
|
|
|
7
|
-
@notifiers = { :hipchat => ::KnifeSantoku::Notification::HipchatNotifier }
|
|
7
|
+
@notifiers = { :hipchat => ::KnifeSantoku::Notification::HipchatNotifier, :campfire => ::KnifeSantoku::Notification::CampfireNotifier }
|
|
8
8
|
|
|
9
9
|
# iterate through our internal folder and our external folder for notification classes
|
|
10
10
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: knife-santoku
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: chef
|
|
@@ -59,6 +59,22 @@ dependencies:
|
|
|
59
59
|
- - ! '>='
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
61
|
version: '0'
|
|
62
|
+
- !ruby/object:Gem::Dependency
|
|
63
|
+
name: tinder
|
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
|
65
|
+
none: false
|
|
66
|
+
requirements:
|
|
67
|
+
- - ! '>='
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
type: :runtime
|
|
71
|
+
prerelease: false
|
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
+
none: false
|
|
74
|
+
requirements:
|
|
75
|
+
- - ! '>='
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0'
|
|
62
78
|
description: A drop in replacement for knife that helps you build out processes around
|
|
63
79
|
Chef
|
|
64
80
|
email:
|
|
@@ -83,6 +99,7 @@ files:
|
|
|
83
99
|
- lib/knife_santoku/application.rb
|
|
84
100
|
- lib/knife_santoku/callback.rb
|
|
85
101
|
- lib/knife_santoku/monkey_patches/knife.rb
|
|
102
|
+
- lib/knife_santoku/notification/campfire_notifier.rb
|
|
86
103
|
- lib/knife_santoku/notification/hipchat_notifier.rb
|
|
87
104
|
- lib/knife_santoku/notifier.rb
|
|
88
105
|
- lib/knife_santoku/version.rb
|