Class: KnifeSpork::Plugins::Irccat

Inherits:
Plugin
  • Object
show all
Defined in:
lib/knife-spork/plugins/irccat.rb

Constant Summary collapse

TEMPLATES =
{
  :upload  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} uploaded #TEAL%{cookbooks}#NORMAL',
  :delete => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} deleted the following cookbooks: #TEAL%{misc_output}#NORMAL',
  :promote => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} promoted #TEAL%{cookbooks}#NORMAL to %{environment} %{gist}',
  :environmentfromfile  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} uploaded environment #TEAL%{object_name}#NORMAL %{gist}',
  :environmentedit  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} edited environment #TEAL%{object_name}#NORMAL %{gist}',
  :environmentcreate  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} created environment #TEAL%{object_name}#NORMAL %{gist}',
  :environmentdelete  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} deleted environment #TEAL%{object_name}#NORMAL %{gist}',
  :rolefromfile  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} uploaded role #TEAL%{object_name}#NORMAL %{gist}',
  :roleedit  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} edited role #TEAL%{object_name}#NORMAL %{gist}',
  :rolecreate  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} created role #TEAL%{object_name}#NORMAL %{gist}',
  :roledelete  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} deleted role #TEAL%{object_name}#NORMAL %{gist}',
  :databagedit  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} edited data bag item #TEAL%{object_name}:%{object_secondary_name}#NORMAL %{gist}',
  :databagdelete  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} deleted data bag #TEAL%{object_name}#NORMAL %{gist}',
  :databagitemdelete  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} deleted data bag item #TEAL%{object_name}:%{object_secondary_name}#NORMAL %{gist}',
  :databagcreate  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} created data bag #TEAL%{object_name}#NORMAL %{gist}',
  :databagfromfile  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} uploaded data bag item #TEAL%{object_name}:%{object_secondary_name}#NORMAL %{gist}',
  :nodeedit  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} edited node #TEAL%{object_name}#NORMAL %{gist}',
  :nodedelete  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} deleted node #TEAL%{object_name}#NORMAL %{gist}',
  :nodecreate  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} created node #TEAL%{object_name}#NORMAL %{gist}',
  :nodefromfile  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} uploaded node #TEAL%{object_name}#NORMAL %{gist}',
  :noderunlistadd  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} added run_list items to #TEAL%{object_name}: %{object_secondary_name}#NORMAL %{gist}',
  :noderunlistremove  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} removed run_list items from #TEAL%{object_name}: %{object_secondary_name}#NORMAL %{gist}',
  :noderunlistset  => '#BOLD#PURPLECHEF:#NORMAL %{organization}%{current_user} set the  run_list for #TEAL%{object_name} to %{object_secondary_name}#NORMAL %{gist}'
}

Instance Method Summary collapse

Methods inherited from Plugin

#enabled?, hook, hooks, #initialize, name

Constructor Details

This class inherits a constructor from KnifeSpork::Plugins::Plugin

Instance Method Details

#after_databagcreateObject



190
191
192
193
194
195
196
197
198
199
# File 'lib/knife-spork/plugins/irccat.rb', line 190

def after_databagcreate
  databag_gist = object_gist("databag", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  display_gist(databag_gist) if databag_gist
  irccat(template(:databagcreate) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => databag_gist
  })
end

#after_databagdeleteObject



167
168
169
170
171
172
173
174
175
176
# File 'lib/knife-spork/plugins/irccat.rb', line 167

def after_databagdelete
  databag_gist = object_gist("databag item", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  display_gist(databag_gist) if databag_gist
  irccat(template(:databagdelete) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => databag_gist
  })
end

#after_databageditObject



155
156
157
158
159
160
161
162
163
164
165
# File 'lib/knife-spork/plugins/irccat.rb', line 155

def after_databagedit
  databag_gist = object_gist("databag item", "#{object_name}:#{object_secondary_name}", object_difference) if config.gist  and !object_difference.empty?
  display_gist(databag_gist) if databag_gist
  irccat(template(:databagedit) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :object_secondary_name    => object_secondary_name,
      :gist => databag_gist
  })
end

#after_databagfromfileObject



201
202
203
204
205
206
207
208
209
210
211
# File 'lib/knife-spork/plugins/irccat.rb', line 201

def after_databagfromfile
  databag_gist = object_gist("databag", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  display_gist(databag_gist) if databag_gist
  irccat(template(:databagfromfile) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :object_secondary_name    => object_secondary_name,
      :gist => databag_gist
  })
end

#after_databagitemdeleteObject



178
179
180
181
182
183
184
185
186
187
188
# File 'lib/knife-spork/plugins/irccat.rb', line 178

def after_databagitemdelete
  databag_gist = object_gist("databag item", "#{object_name}:#{object_secondary_name}", object_difference) if config.gist  and !object_difference.empty?
  display_gist(databag_gist) if databag_gist
  irccat(template(:databagitemdelete) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :object_secondary_name    => object_secondary_name,
      :gist => databag_gist
  })
end

#after_deleteObject



44
45
46
47
48
49
50
# File 'lib/knife-spork/plugins/irccat.rb', line 44

def after_delete
  irccat(template(:delete) % {
    :organization => organization,
    :current_user => current_user,
    :misc_output => misc_output 
  })
end

#after_environmentcreateObject



89
90
91
92
93
94
95
96
97
98
# File 'lib/knife-spork/plugins/irccat.rb', line 89

def after_environmentcreate
  environment_gist = object_gist("environment", object_name, object_difference) if config.gist  and !object_difference.empty?
  display_gist(environment_gist) if environment_gist
  irccat(template(:environmentcreate) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => environment_gist
  })
end

#after_environmentdeleteObject



100
101
102
103
104
105
106
107
108
109
# File 'lib/knife-spork/plugins/irccat.rb', line 100

def after_environmentdelete
  environment_gist = object_gist("environment", object_name, object_difference) if config.gist  and !object_difference.empty?
  display_gist(environment_gist) if environment_gist
  irccat(template(:environmentdelete) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => environment_gist
  })
end

#after_environmenteditObject



78
79
80
81
82
83
84
85
86
87
# File 'lib/knife-spork/plugins/irccat.rb', line 78

def after_environmentedit
  environment_gist = object_gist("environment", object_name, object_difference) if config.gist  and !object_difference.empty?
  display_gist(environment_gist) if environment_gist
  irccat(template(:environmentedit) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => environment_gist
  })
end

#after_environmentfromfileObject



67
68
69
70
71
72
73
74
75
76
# File 'lib/knife-spork/plugins/irccat.rb', line 67

def after_environmentfromfile
  environment_gist = object_gist("environment", object_name, object_difference) if config.gist  and !object_difference.empty?
  display_gist(environment_gist) if environment_gist
  irccat(template(:environmentfromfile) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => environment_gist
  })
end

#after_nodecreateObject



235
236
237
238
239
240
241
242
243
244
# File 'lib/knife-spork/plugins/irccat.rb', line 235

def after_nodecreate
  node_gist = object_gist("node", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  display_gist(node_gist) if node_gist
  irccat(template(:nodecreate) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => node_gist
  })
end

#after_nodedeleteObject



224
225
226
227
228
229
230
231
232
233
# File 'lib/knife-spork/plugins/irccat.rb', line 224

def after_nodedelete
  node_gist = object_gist("node", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  display_gist(node_gist) if node_gist
  irccat(template(:nodedelete) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => node_gist
  })
end

#after_nodeeditObject



213
214
215
216
217
218
219
220
221
222
# File 'lib/knife-spork/plugins/irccat.rb', line 213

def after_nodeedit
  node_gist = object_gist("node", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  display_gist(node_gist) if node_gist
  irccat(template(:nodeedit) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => node_gist
  })
end

#after_nodefromfileObject



246
247
248
249
250
251
252
253
254
255
# File 'lib/knife-spork/plugins/irccat.rb', line 246

def after_nodefromfile
  node_gist = object_gist("node", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  display_gist(node_gist) if node_gist
  irccat(template(:nodefromfile) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => node_gist
  })
end

#after_noderunlistaddObject



257
258
259
260
261
262
263
264
265
266
267
# File 'lib/knife-spork/plugins/irccat.rb', line 257

def after_noderunlistadd
  node_gist = object_gist("node", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  display_gist(node_gist) if node_gist
  irccat(template(:noderunlistadd) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :object_secondary_name    => object_secondary_name,
      :gist => node_gist
  })
end

#after_noderunlistremoveObject



269
270
271
272
273
274
275
276
277
278
279
# File 'lib/knife-spork/plugins/irccat.rb', line 269

def after_noderunlistremove
  node_gist = object_gist("node", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  display_gist(node_gist) if node_gist
  irccat(template(:noderunlistremove) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :object_secondary_name    => object_secondary_name,
      :gist => node_gist
  })
end

#after_noderunlistsetObject



281
282
283
284
285
286
287
288
289
290
291
# File 'lib/knife-spork/plugins/irccat.rb', line 281

def after_noderunlistset
  node_gist = object_gist("node", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  display_gist(node_gist) if node_gist
  irccat(template(:noderunlistset) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :object_secondary_name    => object_secondary_name,
      :gist => node_gist
  })
end

#after_promote_remoteObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/knife-spork/plugins/irccat.rb', line 52

def after_promote_remote
  environments.each do |environment|
    diff = environment_diffs[environment.name]
    env_gist = env_gist(environment, diff) if config.gist
    display_gist(env_gist) if env_gist
    irccat(template(:promote) % {
      :organization => organization,
      :current_user => current_user,
      :cookbooks    => cookbooks.collect{ |c| "#{c.name}@#{c.version}" }.join(", "),
      :environment  => environment.name,
      :gist         => env_gist
    })
  end
end

#after_rolecreateObject



133
134
135
136
137
138
139
140
141
142
# File 'lib/knife-spork/plugins/irccat.rb', line 133

def after_rolecreate
  role_gist = object_gist("role", object_name, object_difference) if config.gist  and !object_difference.empty?
  display_gist(role_gist) if role_gist
  irccat(template(:rolecreate) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => role_gist
  })
end

#after_roledeleteObject



144
145
146
147
148
149
150
151
152
153
# File 'lib/knife-spork/plugins/irccat.rb', line 144

def after_roledelete
  role_gist = object_gist("role", object_name, object_difference) if config.gist  and !object_difference.empty?
  display_gist(role_gist) if role_gist
  irccat(template(:roledelete) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => role_gist
  })
end

#after_roleeditObject



122
123
124
125
126
127
128
129
130
131
# File 'lib/knife-spork/plugins/irccat.rb', line 122

def after_roleedit
  role_gist = object_gist("role", object_name, object_difference) if config.gist  and !object_difference.empty?
  display_gist(role_gist) if role_gist
  irccat(template(:roleedit) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => role_gist
  })
end

#after_rolefromfileObject



111
112
113
114
115
116
117
118
119
120
# File 'lib/knife-spork/plugins/irccat.rb', line 111

def after_rolefromfile
  role_gist = object_gist("role", object_name, object_difference) if config.gist  and !object_difference.empty?
  display_gist(role_gist) if role_gist
  irccat(template(:rolefromfile) % {
      :organization => organization,
      :current_user => current_user,
      :object_name    => object_name,
      :gist => role_gist
  })
end

#after_uploadObject



36
37
38
39
40
41
42
# File 'lib/knife-spork/plugins/irccat.rb', line 36

def after_upload
  irccat(template(:upload) % {
    :organization => organization,
    :current_user => current_user,
    :cookbooks    => cookbooks.collect { |c| "#{c.name}@#{c.version}" }.join(", ")
  })
end

#performObject



34
# File 'lib/knife-spork/plugins/irccat.rb', line 34

def perform; end