knife-spork 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## 1.0.9 (28th October, 2012)
2
+ Features:
3
+
4
+ - Jabber Plugin (thanks to Graham McMillan - https://github.com/gmcmillan)
5
+
6
+ Bugfixes:
7
+
8
+ - Fix exception when spork promote called with no arguments (thanks to Julian Dunn - https://github.com/juliandunn)
9
+
10
+ ## 1.0.8 (25th September, 2012)
11
+ Bugfixes:
12
+
13
+ - Fix whitespace warnings which occur in the git plugin under Ruby 1.8
14
+
15
+ ## 1.0.7 (25th September, 2012)
16
+ Bugfixes:
17
+
18
+ - Fix invalid syntax in Hipchat plugin
19
+
20
+ ## 1.0.6 (25th September, 2012)
21
+ Bugfixes:
22
+
23
+ - Fix for disabling plugins when override config files are present
24
+
25
+ ## 1.0.5 (24th September, 2012)
26
+ Bugfixes:
27
+
28
+ - Fixes for hipchat plugin
29
+
1
30
  ## 1.0.4 (14th September, 2012)
2
31
  Features:
3
32
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  KnifeSpork
2
2
  ===========
3
- KnifeSpork is a workflow plugin for `Chef::Knife` which helps multiple developers work on the same Chef Server and repository without treading on eachother's toes. This plugin was designed around the workflow we have here at Etsy, where several people are working on the Chef repository and Chef Server simultaneously. It contains several functions, documented below:
3
+ KnifeSpork is a workflow plugin for `Chef::Knife` which helps multiple developers work on the same Chef Server and repository without treading on each other's toes. This plugin was designed around the workflow we have here at Etsy, where several people are working on the Chef repository and Chef Server simultaneously. It contains several functions, documented below:
4
4
 
5
5
  Installation
6
6
  ------------
@@ -77,7 +77,7 @@ The `environment_path` allows you to specify the path to where you store your ch
77
77
  #### Plugins
78
78
  Knife spork supports plugins to allow users to hook it into existing systems such as source control, monitoring and chat systems. Plugins are enabled / disabled by adding / removing their config block from the plugin section of the config file. Any of the default plugins shown above can be disabled by removing their section.
79
79
 
80
- For more information on how to develop plugins for spork, please read the plugins/README.md file.
80
+ For more information on how to develop plugins for spork, please read the [plugins/README.md](plugins/README.md) file.
81
81
 
82
82
  Spork Info
83
83
  -----------
data/knife-spork.gemspec CHANGED
@@ -2,7 +2,7 @@ $:.push File.expand_path('../lib', __FILE__)
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'knife-spork'
5
- gem.version = '1.0.8'
5
+ gem.version = '1.0.9'
6
6
  gem.authors = ["Jon Cowie"]
7
7
  gem.email = 'jonlives@gmail.com'
8
8
  gem.homepage = 'https://github.com/jonlives/knife-spork'
@@ -21,6 +21,13 @@ module KnifeSpork
21
21
 
22
22
  def run
23
23
  self.config = Chef::Config.merge!(config)
24
+
25
+ if @name_args.empty?
26
+ show_usage
27
+ ui.error("You must specify the cookbook and environment to promote to")
28
+ exit 1
29
+ end
30
+
24
31
  @environments, @cookbook = load_environments_and_cookbook
25
32
 
26
33
  run_plugins(:before_promote)
@@ -0,0 +1,49 @@
1
+ require 'knife-spork/plugins/plugin'
2
+
3
+ module KnifeSpork
4
+ module Plugins
5
+ class Jabber < Plugin
6
+ name :jabber
7
+
8
+ def perform; end
9
+
10
+ def after_upload
11
+ jabber "#{current_user} uploaded the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")}"
12
+ end
13
+
14
+ def after_promote_remote
15
+ jabber "#{current_user} promoted the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")} to #{environments.collect{ |e| "#{e.name}" }.join(", ")}"
16
+ end
17
+
18
+ private
19
+
20
+ def jabber(message)
21
+ safe_require 'xmpp4r'
22
+ safe_require 'xmpp4r/muc/helper/simplemucclient'
23
+
24
+ client = ::Jabber::Client.new(config.username)
25
+ client.connect(host = config.server_name, port = config.server_port ||= '5222')
26
+ client.auth(config.password)
27
+
28
+ rooms.each do |room_name|
29
+ begin
30
+ conference = ::Jabber::MUC::SimpleMUCClient.new(client)
31
+ conference.join("#{room_name}/#{nickname}")
32
+ conference.say(message)
33
+ rescue Exception => e
34
+ ui.error 'Something went wrong sending to Jabber.'
35
+ ui.error e.to_s
36
+ end
37
+ end
38
+ end
39
+
40
+ def rooms
41
+ [ config.room || config.rooms ].flatten
42
+ end
43
+
44
+ def nickname
45
+ config.nickname || 'KnifeSpork'
46
+ end
47
+ end
48
+ end
49
+ end
data/plugins/Jabber.md ADDED
@@ -0,0 +1,61 @@
1
+ Jabber
2
+ =======
3
+ Jabber posts messages to a designated Jabber group chat room.
4
+
5
+ Gem Requirements
6
+ ----------------
7
+ This plugin requires the following gems:
8
+
9
+ ```ruby
10
+ gem 'xmpp4r'
11
+ ```
12
+
13
+ Hooks
14
+ -----
15
+ - `after_upload`
16
+ - `after_promote`
17
+
18
+ Configuration
19
+ -------------
20
+ ```yaml
21
+ plugins:
22
+ jabber:
23
+ username: YOURUSER
24
+ password: YOURPASSWORD
25
+ nickname: Chef Bot
26
+ server_name: your.jabberserver.com
27
+ server_port: 5222
28
+ rooms:
29
+ - engineering@your.conference.com/spork
30
+ - systems@your.conference.com/spork
31
+ ```
32
+
33
+ #### username
34
+ Your Jabber username.
35
+
36
+ - Type: `String`
37
+
38
+ #### password
39
+ Your Jabber password.
40
+
41
+ - Type: `String`
42
+
43
+ #### nickname
44
+ A nickname to use in the conference room when making announcements.
45
+
46
+ - Type: `String`
47
+
48
+ #### server_name
49
+ Your Jabber server name.
50
+
51
+ - Type: `String`
52
+
53
+ #### server_port
54
+ Your Jabber server port number. Default: 5222
55
+
56
+ - Type: `String`
57
+
58
+ #### rooms
59
+ The list of rooms to post to.
60
+
61
+ - Type: `Array`
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-spork
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-25 00:00:00.000000000 Z
12
+ date: 2012-10-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
16
- requirement: &70234682141100 !ruby/object:Gem::Requirement
16
+ requirement: &70361786030120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.10.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70234682141100
24
+ version_requirements: *70361786030120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: git
27
- requirement: &70234682140540 !ruby/object:Gem::Requirement
27
+ requirement: &70361786029160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.2.5
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70234682140540
35
+ version_requirements: *70361786029160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: app_conf
38
- requirement: &70234682140080 !ruby/object:Gem::Requirement
38
+ requirement: &70361786028040 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 0.4.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70234682140080
46
+ version_requirements: *70361786028040
47
47
  description: A workflow plugin to help many devs work with the same chef repo/server
48
48
  email: jonlives@gmail.com
49
49
  executables: []
@@ -72,6 +72,7 @@ files:
72
72
  - lib/knife-spork/plugins/graphite.rb
73
73
  - lib/knife-spork/plugins/hipchat.rb
74
74
  - lib/knife-spork/plugins/irccat.rb
75
+ - lib/knife-spork/plugins/jabber.rb
75
76
  - lib/knife-spork/plugins/plugin.rb
76
77
  - lib/knife-spork/runner.rb
77
78
  - plugins/Campfire.md
@@ -81,6 +82,7 @@ files:
81
82
  - plugins/Graphite.md
82
83
  - plugins/HipChat.md
83
84
  - plugins/Irccat.md
85
+ - plugins/Jabber.md
84
86
  - plugins/README.md
85
87
  - plugins/Template.md
86
88
  homepage: https://github.com/jonlives/knife-spork