214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
|
# File 'lib/shiftzilla/org_data.rb', line 214
def generate_reports(include_groups)
build_time = timestamp
all_release = @config.release('All')
redirects = {}
@ordered_teams.each do |tname|
tinfo = @config.team(tname)
tdata = @org_data[tname]
team_pinfo = {
:build_time => build_time,
:tdisp => tdata.title,
:tname => tdata.name,
:tinfo => tinfo,
:tdata => tdata,
:team_files => @team_files,
:bug_url => BZ_URL,
:releases => [],
:latest_snapshot => latest_snapshot,
:all_bugs => [],
:include_groups => include_groups,
:is_group => false,
}
group_match = @group_teams.detect{|g| g.name == tname}
if not group_match.nil?
team_pinfo[:tinfo] = group_match
team_pinfo[:is_group] = true
elsif not tinfo.nil?
tinfo.components.each do |component|
redirects[component] = tdata.file
end
end
@releases.each do |release|
rname = release.name
rdata = tdata.has_release_data?(release) ? tdata.get_release_data(release) : nil
snapdata = nil
if not rdata.nil? and rdata.snaps.has_key?(latest_snapshot)
snapdata = rdata.snaps[latest_snapshot]
else
snapdata = Shiftzilla::SnapData.new(latest_snapshot)
end
release_info = {
:release => release,
:snapdata => snapdata,
:no_rdata => (rdata.nil? ? true : false),
:bug_avg_age => (rdata.nil? ? 0 : rdata.bug_avg_age),
:tb_avg_age => (rdata.nil? ? 0 : rdata.tb_avg_age),
}
unless rdata.nil?
release_info[:charts] = {
:burndown => chartify('Bug Burndown',rdata.series[:date],[
{
:label => 'Ideal Trend',
:data => rdata.series[:ideal],
},
{
:label => 'Total',
:data => rdata.series[:total_bugs],
},
{
:label => 'w/ Customer Cases',
:data => rdata.series[:total_cc],
},
]),
:new_closed => chartify('New vs. Closed',rdata.series[:date],[
{
:label => 'New',
:data => rdata.series[:new_bugs],
},
{
:label => 'Closed',
:data => rdata.series[:closed_bugs],
},
]),
:blockers => chartify('Blockers',rdata.series[:date],[
{
:label => 'Total',
:data => rdata.series[:total_tb],
},
{
:label => 'New',
:data => rdata.series[:new_tb],
},
{
:label => 'Closed',
:data => rdata.series[:closed_tb],
},
]),
}
end
team_pinfo[:releases] << release_info
if rname == 'All'
team_pinfo[:all_bugs] = snapdata.bug_ids.map{ |id| rdata.bugs[id] }
end
end
team_page = haml_engine.render(Object.new,team_pinfo)
File.write(File.join(@tmp_dir,tdata.file), team_page)
end
redirects.each do |component, team_file|
redirect_html = <<-HTML
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Refresh" content="0; url=#{team_file}" />
</head>
<body>
<p>Redirecting to <a href="#{team_file}">team page</a>...</p>
</body>
</html>
HTML
File.write(File.join(@tmp_dir, "component_#{component}.html"), redirect_html)
end
jsdir = File.join(@tmp_dir,'js')
Dir.mkdir(jsdir)
FileUtils.cp(File.join(VENDOR_DIR,'flot','jquery.flot.min.js'),jsdir)
FileUtils.cp(DB_FPATH,@tmp_dir)
end
|