Class: Debci::HTML
- Inherits:
-
Object
show all
- Includes:
- HTMLHelpers
- Defined in:
- lib/debci/html.rb,
lib/debci/html/cli.rb
Defined Under Namespace
Classes: Autopkgtest, CLI, Feed, JSON, PackageHistory, PackageJSON, Rooted
Constant Summary
Constants included
from HTMLHelpers
Debci::HTMLHelpers::ICONS
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#expand_pin_packages, #filesize, #icon, #title_test_trigger_pin
Constructor Details
#initialize(root_directory = Debci.config.html_dir) ⇒ HTML
Returns a new instance of HTML.
232
233
234
235
236
237
238
|
# File 'lib/debci/html.rb', line 232
def initialize(root_directory=Debci.config.html_dir)
@root_directory = root_directory
@package_prefixes = Debci::Package.prefixes
@head = read_config_file('head.html')
@footer = read_config_file('footer.html')
end
|
Instance Attribute Details
#root_directory ⇒ Object
Returns the value of attribute root_directory.
230
231
232
|
# File 'lib/debci/html.rb', line 230
def root_directory
@root_directory
end
|
Class Method Details
.update ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/debci/html.rb', line 23
def update
html = Debci::HTML.new
Debci.config.suite_list.each do |suite|
Debci.config.arch_list.each do |arch|
json = Debci::HTML::JSON.new(suite, arch)
json.status
json.history
json.packages
end
end
html.index('index.html')
html.status('status/index.html')
html.status_alerts('status/alerts/index.html')
html.status_slow('status/slow/index.html')
html.status_pending_jobs('status/pending')
html.status_failing('status/failing')
html.reject_list
html.blacklist
html.platform_specific_issues('status/platform-specific-issues')
end
|
.update_package(package, suite = nil, arch = nil) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/debci/html.rb', line 46
def update_package(package, suite = nil, arch = nil)
pkgjson = Debci::HTML::PackageJSON.new
autopkgtest = Debci::HTML::Autopkgtest.new
feed = Debci::HTML::Feed.new
suites = suite && [suite] || Debci.config.suite_list
archs = arch && [arch] || Debci.config.arch_list
suites.each do |s|
archs.each do |a|
history = PackageHistory.new(package, s, a)
pkgjson.history(history)
pkgjson.latest(history)
autopkgtest.link_latest(history)
end
end
feed.package(package)
end
|
Instance Method Details
#blacklist ⇒ Object
309
310
311
312
313
314
315
316
317
318
319
|
# File 'lib/debci/html.rb', line 309
def blacklist
abs_filename = File.join(root_directory, 'status/blacklist/index.html')
FileUtils.mkdir_p(File.dirname(abs_filename))
File.open(abs_filename, 'w') do |f|
blacklist_html = File.join(File.dirname(__FILE__), 'html/templates/blacklist.erb')
File.open(blacklist_html, 'r') do |html|
f.write(html.read)
end
end
end
|
#expand_url(url, suite) ⇒ Object
expand { SUITE } macro in URLs
322
323
324
|
# File 'lib/debci/html.rb', line 322
def expand_url(url, suite)
url && url.gsub('{SUITE}', suite)
end
|
#index(filename) ⇒ Object
240
241
242
|
# File 'lib/debci/html.rb', line 240
def index(filename)
expand_template(:index, filename)
end
|
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
|
# File 'lib/debci/html.rb', line 287
def platform_specific_issues(dirname)
@status_nav = load_template(:status_nav)
@filters = {
"#{dirname}": ["All", -1],
"#{dirname}/last_thirty_days": ["Last 30 Days", 30],
"#{dirname}/last_one_eighty_days": ["Last 180 Days", 180],
"#{dirname}/last_year": ["Last Year", 365]
}
issues = Debci::Job.platform_specific_issues
@filters.each do |target, filter|
generate_platform_specific_issues(issues, target, filter)
end
end
|
#reject_list ⇒ Object
303
304
305
306
307
|
# File 'lib/debci/html.rb', line 303
def reject_list
@status_nav = load_template(:status_nav)
@reject_list = Debci.reject_list
expand_template(:reject_list, 'status/reject_list/index.html')
end
|
#status(filename) ⇒ Object
244
245
246
247
|
# File 'lib/debci/html.rb', line 244
def status(filename)
@status_nav = load_template(:status_nav)
expand_template(:status, filename)
end
|
#status_alerts(filename) ⇒ Object
249
250
251
252
253
254
|
# File 'lib/debci/html.rb', line 249
def status_alerts(filename)
@tmpfail = Debci::Job.tmpfail.visible
@alert_number = @tmpfail.length
expand_template(:status_alerts, filename)
end
|
#status_failing(dirname) ⇒ Object
274
275
276
277
278
279
280
281
282
283
284
285
|
# File 'lib/debci/html.rb', line 274
def status_failing(dirname)
@status_nav = load_template(:status_nav)
jobs = Debci::Job.fail
@packages_per_page = Debci.config.failing_packages_per_page
generate_status_failing(dirname, jobs)
Debci.config.suite_list.each do |suite|
generate_status_failing(dirname, jobs, suite)
end
end
|
#status_pending_jobs(dirname) ⇒ Object
261
262
263
264
265
266
267
268
269
270
271
272
|
# File 'lib/debci/html.rb', line 261
def status_pending_jobs(dirname)
@status_nav = load_template(:status_nav)
@status_per_page = Debci.config.pending_status_per_page.to_i
@pending_jobs = Debci::Job.pending.count
@suites_jobs = Hash[Debci.config.suite_list.map do |x|
[x, Debci::Job.pending.where(suite: x).count]
end
]
generate_status_pending(dirname, nil) @suites_jobs.each_key { |suite| generate_status_pending(dirname, suite) }
end
|
#status_slow(filename) ⇒ Object
256
257
258
259
|
# File 'lib/debci/html.rb', line 256
def status_slow(filename)
@slow = Debci::Job.slow.sort_by { |j| j.package.name }
expand_template(:status_slow, filename)
end
|