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',
  :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



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

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

#after_databagdeleteObject



148
149
150
151
152
153
154
155
156
# File 'lib/knife-spork/plugins/irccat.rb', line 148

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

#after_databageditObject



137
138
139
140
141
142
143
144
145
146
# File 'lib/knife-spork/plugins/irccat.rb', line 137

def after_databagedit
  databag_gist = object_gist("databag item", "#{object_name}:#{object_secondary_name}", object_difference) if config.gist  and !object_difference.empty?
  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



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

def after_databagfromfile
  databag_gist = object_gist("databag", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  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



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

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

#after_environmentcreateObject



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

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

#after_environmentdeleteObject



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

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

#after_environmenteditObject



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

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

#after_environmentfromfileObject



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

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

#after_nodecreateObject



210
211
212
213
214
215
216
217
218
# File 'lib/knife-spork/plugins/irccat.rb', line 210

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

#after_nodedeleteObject



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

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

#after_nodeeditObject



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

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

#after_nodefromfileObject



220
221
222
223
224
225
226
227
228
# File 'lib/knife-spork/plugins/irccat.rb', line 220

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

#after_noderunlistaddObject



230
231
232
233
234
235
236
237
238
239
# File 'lib/knife-spork/plugins/irccat.rb', line 230

def after_noderunlistadd
  node_gist = object_gist("node", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  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



241
242
243
244
245
246
247
248
249
250
# File 'lib/knife-spork/plugins/irccat.rb', line 241

def after_noderunlistremove
  node_gist = object_gist("node", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  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



252
253
254
255
256
257
258
259
260
261
# File 'lib/knife-spork/plugins/irccat.rb', line 252

def after_noderunlistset
  node_gist = object_gist("node", "#{object_name}", object_difference) if config.gist  and !object_difference.empty?
  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



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/knife-spork/plugins/irccat.rb', line 43

def after_promote_remote
  environments.each do |environment|
    diff = environment_diffs[environment.name]
    env_gist = env_gist(environment, diff) if config.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



117
118
119
120
121
122
123
124
125
# File 'lib/knife-spork/plugins/irccat.rb', line 117

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

#after_roledeleteObject



127
128
129
130
131
132
133
134
135
# File 'lib/knife-spork/plugins/irccat.rb', line 127

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

#after_roleeditObject



107
108
109
110
111
112
113
114
115
# File 'lib/knife-spork/plugins/irccat.rb', line 107

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

#after_rolefromfileObject



97
98
99
100
101
102
103
104
105
# File 'lib/knife-spork/plugins/irccat.rb', line 97

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

#after_uploadObject



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

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

#performObject



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

def perform; end