knife-spork 1.7.2 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +35 -35
  3. data/lib/chef/knife/spork-bump.rb +100 -100
  4. data/lib/chef/knife/spork-check.rb +165 -161
  5. data/lib/chef/knife/spork-databag-create.rb +54 -54
  6. data/lib/chef/knife/spork-databag-delete.rb +51 -51
  7. data/lib/chef/knife/spork-databag-edit.rb +54 -54
  8. data/lib/chef/knife/spork-databag-fromfile.rb +88 -88
  9. data/lib/chef/knife/spork-delete.rb +132 -132
  10. data/lib/chef/knife/spork-environment-check.rb +90 -90
  11. data/lib/chef/knife/spork-environment-create.rb +63 -63
  12. data/lib/chef/knife/spork-environment-delete.rb +38 -38
  13. data/lib/chef/knife/spork-environment-edit.rb +40 -40
  14. data/lib/chef/knife/spork-environment-fromfile.rb +46 -46
  15. data/lib/chef/knife/spork-info.rb +34 -34
  16. data/lib/chef/knife/spork-node-create.rb +41 -41
  17. data/lib/chef/knife/spork-node-delete.rb +41 -41
  18. data/lib/chef/knife/spork-node-edit.rb +48 -48
  19. data/lib/chef/knife/spork-node-fromfile.rb +46 -46
  20. data/lib/chef/knife/spork-node-runlistadd.rb +51 -51
  21. data/lib/chef/knife/spork-node-runlistremove.rb +44 -44
  22. data/lib/chef/knife/spork-node-runlistset.rb +44 -44
  23. data/lib/chef/knife/spork-omni.rb +112 -112
  24. data/lib/chef/knife/spork-promote.rb +197 -197
  25. data/lib/chef/knife/spork-role-create.rb +46 -46
  26. data/lib/chef/knife/spork-role-delete.rb +50 -50
  27. data/lib/chef/knife/spork-role-edit.rb +40 -40
  28. data/lib/chef/knife/spork-role-fromfile.rb +65 -65
  29. data/lib/chef/knife/spork-upload.rb +151 -151
  30. data/lib/chef/knife/spork-version.rb +12 -12
  31. data/lib/knife-spork.rb +3 -3
  32. data/lib/knife-spork/plugins.rb +27 -27
  33. data/lib/knife-spork/plugins/campfire.rb +219 -219
  34. data/lib/knife-spork/plugins/eventinator.rb +329 -329
  35. data/lib/knife-spork/plugins/foodcritic.rb +46 -46
  36. data/lib/knife-spork/plugins/git.rb +393 -399
  37. data/lib/knife-spork/plugins/graphite.rb +25 -25
  38. data/lib/knife-spork/plugins/grove.rb +167 -167
  39. data/lib/knife-spork/plugins/hipchat.rb +171 -171
  40. data/lib/knife-spork/plugins/influxdb.rb +28 -28
  41. data/lib/knife-spork/plugins/irccat.rb +332 -332
  42. data/lib/knife-spork/plugins/jabber.rb +133 -133
  43. data/lib/knife-spork/plugins/plugin.rb +117 -117
  44. data/lib/knife-spork/plugins/rubocop.rb +56 -56
  45. data/lib/knife-spork/plugins/slack.rb +125 -125
  46. data/lib/knife-spork/plugins/statusnet.rb +122 -122
  47. data/lib/knife-spork/runner.rb +342 -342
  48. data/lib/knife-spork/version.rb +5 -5
  49. metadata +4 -51
  50. data/.gitignore +0 -21
  51. data/.ruby-gemset +0 -1
  52. data/.ruby-version +0 -1
  53. data/.travis.yml +0 -3
  54. data/CHANGELOG.md +0 -445
  55. data/Gemfile +0 -3
  56. data/README.md +0 -544
  57. data/Rakefile +0 -35
  58. data/knife-spork.gemspec +0 -28
  59. data/plugins/Campfire.md +0 -43
  60. data/plugins/Eventinator.md +0 -30
  61. data/plugins/Foodcritic.md +0 -53
  62. data/plugins/Git.md +0 -53
  63. data/plugins/Graphite.md +0 -30
  64. data/plugins/Grove.md +0 -31
  65. data/plugins/HipChat.md +0 -69
  66. data/plugins/Influxdb.md +0 -25
  67. data/plugins/Irccat.md +0 -50
  68. data/plugins/Jabber.md +0 -61
  69. data/plugins/README.md +0 -70
  70. data/plugins/Rubocop.md +0 -110
  71. data/plugins/Slack.md +0 -48
  72. data/plugins/StatusNet.md +0 -41
  73. data/plugins/Template.md +0 -34
  74. data/spec/spec_helper.rb +0 -10
  75. data/spec/test_helpers.rb +0 -46
  76. data/spec/unit/fixtures/config/spork-config.yml +0 -1
  77. data/spec/unit/fixtures/cookbooks/example/metadata.rb +0 -8
  78. data/spec/unit/fixtures/environments/example.json +0 -12
  79. data/spec/unit/fixtures/knife.rb +0 -6
  80. data/spec/unit/fixtures/test_client.pem +0 -27
  81. data/spec/unit/spork_bump_spec.rb +0 -75
  82. data/spec/unit/spork_info_spec.rb +0 -40
  83. data/spec/unit/spork_promote_spec.rb +0 -77
  84. data/spec/unit/spork_upload_spec.rb +0 -46
@@ -1,12 +1,12 @@
1
- require 'chef/knife'
2
- require 'knife-spork/version'
3
-
4
- module KnifeSpork
5
- class SporkVersion < Chef::Knife
6
- banner 'knife spork version'
7
-
8
- def run
9
- ui.info KnifeSpork::Version::VERSION
10
- end
11
- end
12
- end
1
+ require 'chef/knife'
2
+ require 'knife-spork/version'
3
+
4
+ module KnifeSpork
5
+ class SporkVersion < Chef::Knife
6
+ banner 'knife spork version'
7
+
8
+ def run
9
+ ui.info KnifeSpork::Version::VERSION
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
- module KnifeSpork
2
- require 'knife-spork/plugins'
3
- end
1
+ module KnifeSpork
2
+ require 'knife-spork/plugins'
3
+ end
@@ -1,27 +1,27 @@
1
- module KnifeSpork
2
- module Plugins
3
- # Load each of the drop-in plugins
4
- Dir[File.expand_path('../plugins/**/*.rb', __FILE__)].each { |f| require f }
5
-
6
- def self.run(options = {})
7
- hook = options[:hook].to_sym
8
-
9
- #Load each of the drop-in plugins specified in the custom plugin path
10
- if (options[:config][:custom_plugin_path] !=nil)
11
- Dir[File.expand_path("#{options[:config][:custom_plugin_path]}/*.rb")].each { |f| require f }
12
- end
13
-
14
- klasses.each do |klass|
15
- plugin = klass.new(options)
16
- plugin.send(hook) if plugin.respond_to?(hook) && plugin.enabled?
17
- end
18
- end
19
-
20
- # Get and return a list of all subclasses (plugins) that are not the base plugin
21
- def self.klasses
22
- @@klasses ||= self.constants.collect do |c|
23
- self.const_get(c) if self.const_get(c).is_a?(Class) && self.const_get(c) != KnifeSpork::Plugins::Plugin
24
- end.compact
25
- end
26
- end
27
- end
1
+ module KnifeSpork
2
+ module Plugins
3
+ # Load each of the drop-in plugins
4
+ Dir[File.expand_path('../plugins/**/*.rb', __FILE__)].each { |f| require f }
5
+
6
+ def self.run(options = {})
7
+ hook = options[:hook].to_sym
8
+
9
+ #Load each of the drop-in plugins specified in the custom plugin path
10
+ if (options[:config][:custom_plugin_path] !=nil)
11
+ Dir[File.expand_path("#{options[:config][:custom_plugin_path]}/*.rb")].each { |f| require f }
12
+ end
13
+
14
+ klasses.each do |klass|
15
+ plugin = klass.new(options)
16
+ plugin.send(hook) if plugin.respond_to?(hook) && plugin.enabled?
17
+ end
18
+ end
19
+
20
+ # Get and return a list of all subclasses (plugins) that are not the base plugin
21
+ def self.klasses
22
+ @@klasses ||= self.constants.collect do |c|
23
+ self.const_get(c) if self.const_get(c).is_a?(Class) && self.const_get(c) != KnifeSpork::Plugins::Plugin
24
+ end.compact
25
+ end
26
+ end
27
+ end
@@ -1,219 +1,219 @@
1
- require 'knife-spork/plugins/plugin'
2
-
3
- module KnifeSpork
4
- module Plugins
5
- class Campfire < Plugin
6
- name :campfire
7
-
8
- def perform; end
9
-
10
- def after_upload
11
- campfire do |rooms|
12
- rooms.paste <<-EOH
13
- #{organization}#{current_user} froze the following cookbooks on Chef Server:
14
- #{cookbooks.collect{|c| " #{c.name}@#{c.version}"}.join("\n")}
15
- EOH
16
- end
17
- end
18
-
19
- def after_delete
20
- campfire do |rooms|
21
- rooms.paste <<-EOH
22
- "#{organization}#{current_user} deleted the following cookbooks: #{misc_output}"
23
- EOH
24
- end
25
- end
26
-
27
- def after_promote_remote
28
- campfire do |rooms|
29
- rooms.paste <<-EOH
30
- #{organization}#{current_user} promoted cookbooks on Chef Server:
31
-
32
- cookbooks:
33
- #{cookbooks.collect{|c| " #{c.name}@#{c.version}"}.join("\n")}
34
-
35
- environments:
36
- #{environments.collect{|e| " #{e.name}"}.join("\n")}
37
- EOH
38
- end
39
- end
40
-
41
- def after_environmentfromfile
42
- campfire do |rooms|
43
- rooms.paste <<-EOH
44
- #{organization}#{current_user} uploaded environment #{object_name}
45
- EOH
46
- end
47
- end
48
-
49
- def after_environmentedit
50
- campfire do |rooms|
51
- rooms.paste <<-EOH
52
- #{organization}#{current_user} edited environment #{object_name}
53
- EOH
54
- end
55
- end
56
-
57
- def after_environmentcreate
58
- campfire do |rooms|
59
- rooms.paste <<-EOH
60
- #{organization}#{current_user} created environment #{object_name}
61
- EOH
62
- end
63
- end
64
-
65
- def after_environmentdelete
66
- campfire do |rooms|
67
- rooms.paste <<-EOH
68
- #{organization}#{current_user} deleted environment #{object_name}
69
- EOH
70
- end
71
- end
72
-
73
- def after_rolefromfile
74
- campfire do |rooms|
75
- rooms.paste <<-EOH
76
- #{organization}#{current_user} uploaded role #{object_name}
77
- EOH
78
- end
79
- end
80
-
81
- def after_roleedit
82
- campfire do |rooms|
83
- rooms.paste <<-EOH
84
- #{organization}#{current_user} edited role #{object_name}
85
- EOH
86
- end
87
- end
88
-
89
- def after_rolecreate
90
- campfire do |rooms|
91
- rooms.paste <<-EOH
92
- #{organization}#{current_user} created role #{object_name}
93
- EOH
94
- end
95
- end
96
-
97
- def after_roledelete
98
- campfire do |rooms|
99
- rooms.paste <<-EOH
100
- #{organization}#{current_user} deleted role #{object_name}
101
- EOH
102
- end
103
- end
104
-
105
- def after_databagedit
106
- campfire do |rooms|
107
- rooms.paste <<-EOH
108
- #{organization}#{current_user} edited data bag item #{object_name}:#{object_secondary_name}
109
- EOH
110
- end
111
- end
112
-
113
- def after_databagdelete
114
- campfire do |rooms|
115
- rooms.paste <<-EOH
116
- #{organization}#{current_user} deleted data bag #{object_name}}
117
- EOH
118
- end
119
- end
120
-
121
- def after_databagitemdelete
122
- campfire do |rooms|
123
- rooms.paste <<-EOH
124
- #{organization}#{current_user} deleted data bag item #{object_name}:#{object_secondary_name}
125
- EOH
126
- end
127
- end
128
-
129
- def after_databagcreate
130
- campfire do |rooms|
131
- rooms.paste <<-EOH
132
- #{organization}#{current_user} created data bag #{object_name}
133
- EOH
134
- end
135
- end
136
-
137
- def after_databagfromfile
138
- campfire do |rooms|
139
- rooms.paste <<-EOH
140
- #{organization}#{current_user} uploaded data bag item #{object_name}:#{object_secondary_name}
141
- EOH
142
- end
143
- end
144
-
145
- def after_nodeedit
146
- campfire do |rooms|
147
- rooms.paste <<-EOH
148
- #{organization}#{current_user} edited node #{object_name}
149
- EOH
150
- end
151
- end
152
-
153
- def after_nodedelete
154
- campfire do |rooms|
155
- rooms.paste <<-EOH
156
- #{organization}#{current_user} deleted node #{object_name}
157
- EOH
158
- end
159
- end
160
-
161
- def after_nodecreate
162
- campfire do |rooms|
163
- rooms.paste <<-EOH
164
- #{organization}#{current_user} created node #{object_name}
165
- EOH
166
- end
167
- end
168
-
169
- def after_nodefromfile
170
- campfire do |rooms|
171
- rooms.paste <<-EOH
172
- #{organization}#{current_user} uploaded node #{object_name}
173
- EOH
174
- end
175
- end
176
-
177
- def after_noderunlistadd
178
- campfire do |rooms|
179
- rooms.paste <<-EOH
180
- #{organization}#{current_user} added run_list items to #{object_name}: #{object_secondary_name}
181
- EOH
182
- end
183
- end
184
-
185
- def after_noderunlistremove
186
- campfire do |rooms|
187
- rooms.paste <<-EOH
188
- #{organization}#{current_user} removed run_list items from #{object_name}: #{object_secondary_name}
189
- EOH
190
- end
191
- end
192
-
193
- def after_noderunlistset
194
- campfire do |rooms|
195
- rooms.paste <<-EOH
196
- #{organization}#{current_user} set the run_list for #{object_name} to #{object_secondary_name}
197
- EOH
198
- end
199
- end
200
-
201
- private
202
- def campfire(&block)
203
- safe_require 'campy'
204
-
205
- rooms = [config.rooms || config.room].flatten.compact
206
- campfire = Campy::Room.new(:account => config.account, :token => config.token)
207
-
208
- rooms.each do |room_name|
209
- room = Campy::Room.new(
210
- :account => config.account,
211
- :token => config.token,
212
- :room => room_name
213
- )
214
- yield(room) unless room.nil?
215
- end
216
- end
217
- end
218
- end
219
- end
1
+ require 'knife-spork/plugins/plugin'
2
+
3
+ module KnifeSpork
4
+ module Plugins
5
+ class Campfire < Plugin
6
+ name :campfire
7
+
8
+ def perform; end
9
+
10
+ def after_upload
11
+ campfire do |rooms|
12
+ rooms.paste <<-EOH
13
+ #{organization}#{current_user} froze the following cookbooks on Chef Server:
14
+ #{cookbooks.collect{|c| " #{c.name}@#{c.version}"}.join("\n")}
15
+ EOH
16
+ end
17
+ end
18
+
19
+ def after_delete
20
+ campfire do |rooms|
21
+ rooms.paste <<-EOH
22
+ "#{organization}#{current_user} deleted the following cookbooks: #{misc_output}"
23
+ EOH
24
+ end
25
+ end
26
+
27
+ def after_promote_remote
28
+ campfire do |rooms|
29
+ rooms.paste <<-EOH
30
+ #{organization}#{current_user} promoted cookbooks on Chef Server:
31
+
32
+ cookbooks:
33
+ #{cookbooks.collect{|c| " #{c.name}@#{c.version}"}.join("\n")}
34
+
35
+ environments:
36
+ #{environments.collect{|e| " #{e.name}"}.join("\n")}
37
+ EOH
38
+ end
39
+ end
40
+
41
+ def after_environmentfromfile
42
+ campfire do |rooms|
43
+ rooms.paste <<-EOH
44
+ #{organization}#{current_user} uploaded environment #{object_name}
45
+ EOH
46
+ end
47
+ end
48
+
49
+ def after_environmentedit
50
+ campfire do |rooms|
51
+ rooms.paste <<-EOH
52
+ #{organization}#{current_user} edited environment #{object_name}
53
+ EOH
54
+ end
55
+ end
56
+
57
+ def after_environmentcreate
58
+ campfire do |rooms|
59
+ rooms.paste <<-EOH
60
+ #{organization}#{current_user} created environment #{object_name}
61
+ EOH
62
+ end
63
+ end
64
+
65
+ def after_environmentdelete
66
+ campfire do |rooms|
67
+ rooms.paste <<-EOH
68
+ #{organization}#{current_user} deleted environment #{object_name}
69
+ EOH
70
+ end
71
+ end
72
+
73
+ def after_rolefromfile
74
+ campfire do |rooms|
75
+ rooms.paste <<-EOH
76
+ #{organization}#{current_user} uploaded role #{object_name}
77
+ EOH
78
+ end
79
+ end
80
+
81
+ def after_roleedit
82
+ campfire do |rooms|
83
+ rooms.paste <<-EOH
84
+ #{organization}#{current_user} edited role #{object_name}
85
+ EOH
86
+ end
87
+ end
88
+
89
+ def after_rolecreate
90
+ campfire do |rooms|
91
+ rooms.paste <<-EOH
92
+ #{organization}#{current_user} created role #{object_name}
93
+ EOH
94
+ end
95
+ end
96
+
97
+ def after_roledelete
98
+ campfire do |rooms|
99
+ rooms.paste <<-EOH
100
+ #{organization}#{current_user} deleted role #{object_name}
101
+ EOH
102
+ end
103
+ end
104
+
105
+ def after_databagedit
106
+ campfire do |rooms|
107
+ rooms.paste <<-EOH
108
+ #{organization}#{current_user} edited data bag item #{object_name}:#{object_secondary_name}
109
+ EOH
110
+ end
111
+ end
112
+
113
+ def after_databagdelete
114
+ campfire do |rooms|
115
+ rooms.paste <<-EOH
116
+ #{organization}#{current_user} deleted data bag #{object_name}}
117
+ EOH
118
+ end
119
+ end
120
+
121
+ def after_databagitemdelete
122
+ campfire do |rooms|
123
+ rooms.paste <<-EOH
124
+ #{organization}#{current_user} deleted data bag item #{object_name}:#{object_secondary_name}
125
+ EOH
126
+ end
127
+ end
128
+
129
+ def after_databagcreate
130
+ campfire do |rooms|
131
+ rooms.paste <<-EOH
132
+ #{organization}#{current_user} created data bag #{object_name}
133
+ EOH
134
+ end
135
+ end
136
+
137
+ def after_databagfromfile
138
+ campfire do |rooms|
139
+ rooms.paste <<-EOH
140
+ #{organization}#{current_user} uploaded data bag item #{object_name}:#{object_secondary_name}
141
+ EOH
142
+ end
143
+ end
144
+
145
+ def after_nodeedit
146
+ campfire do |rooms|
147
+ rooms.paste <<-EOH
148
+ #{organization}#{current_user} edited node #{object_name}
149
+ EOH
150
+ end
151
+ end
152
+
153
+ def after_nodedelete
154
+ campfire do |rooms|
155
+ rooms.paste <<-EOH
156
+ #{organization}#{current_user} deleted node #{object_name}
157
+ EOH
158
+ end
159
+ end
160
+
161
+ def after_nodecreate
162
+ campfire do |rooms|
163
+ rooms.paste <<-EOH
164
+ #{organization}#{current_user} created node #{object_name}
165
+ EOH
166
+ end
167
+ end
168
+
169
+ def after_nodefromfile
170
+ campfire do |rooms|
171
+ rooms.paste <<-EOH
172
+ #{organization}#{current_user} uploaded node #{object_name}
173
+ EOH
174
+ end
175
+ end
176
+
177
+ def after_noderunlistadd
178
+ campfire do |rooms|
179
+ rooms.paste <<-EOH
180
+ #{organization}#{current_user} added run_list items to #{object_name}: #{object_secondary_name}
181
+ EOH
182
+ end
183
+ end
184
+
185
+ def after_noderunlistremove
186
+ campfire do |rooms|
187
+ rooms.paste <<-EOH
188
+ #{organization}#{current_user} removed run_list items from #{object_name}: #{object_secondary_name}
189
+ EOH
190
+ end
191
+ end
192
+
193
+ def after_noderunlistset
194
+ campfire do |rooms|
195
+ rooms.paste <<-EOH
196
+ #{organization}#{current_user} set the run_list for #{object_name} to #{object_secondary_name}
197
+ EOH
198
+ end
199
+ end
200
+
201
+ private
202
+ def campfire(&block)
203
+ safe_require 'campy'
204
+
205
+ rooms = [config.rooms || config.room].flatten.compact
206
+ campfire = Campy::Room.new(:account => config.account, :token => config.token)
207
+
208
+ rooms.each do |room_name|
209
+ room = Campy::Room.new(
210
+ :account => config.account,
211
+ :token => config.token,
212
+ :room => room_name
213
+ )
214
+ yield(room) unless room.nil?
215
+ end
216
+ end
217
+ end
218
+ end
219
+ end