Class: Debci::HTML

Inherits:
Object
  • Object
show all
Defined in:
lib/debci/html.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_directory = Debci.config.html_dir) ⇒ HTML

Returns a new instance of HTML



14
15
16
17
18
19
20
21
# File 'lib/debci/html.rb', line 14

def initialize(root_directory=Debci.config.html_dir)
  @root_directory = root_directory
  @repository = Debci::Repository.new
  @package_prefixes = @repository.prefixes

  @head = read_config_file('head.html')
  @footer = read_config_file('footer.html')
end

Instance Attribute Details

#root_directoryObject (readonly)

Returns the value of attribute root_directory



12
13
14
# File 'lib/debci/html.rb', line 12

def root_directory
  @root_directory
end

Instance Method Details

#blacklist(filename) ⇒ Object



55
56
57
58
# File 'lib/debci/html.rb', line 55

def blacklist(filename)
  @status_nav = load_template(:status_nav)
  expand_template(:blacklist, filename)
end

#expand_url(url, suite) ⇒ Object

expand { SUITE } macro in URLs



77
78
79
# File 'lib/debci/html.rb', line 77

def expand_url(url, suite)
  url && url.gsub('{SUITE}', suite)
end

#history(package, suite, architecture, filename) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/debci/html.rb', line 81

def history(package, suite, architecture, filename)
  @package = package
  @suite = suite
  @architecture = architecture
  @packages_dir = 'data/packages'
  @package_dir = File.join(suite, architecture, package.prefix, package.name)
  @autopkgtest_dir = 'data/autopkgtest'
  @site_url = expand_url(Debci.config.url_base, @suite)
  @artifacts_url_base = expand_url(Debci.config.artifacts_url_base, @suite)
  @moretitle = "#{package.name}/#{suite}/#{architecture}"
  history = package.history(@suite, @architecture)
  @latest = history && history.first
  expand_template(:history, filename)
end

#index(filename) ⇒ Object



23
24
25
# File 'lib/debci/html.rb', line 23

def index(filename)
  expand_template(:index, filename)
end

#obsolete_packages_page(filename) ⇒ Object



72
73
74
# File 'lib/debci/html.rb', line 72

def obsolete_packages_page(filename)
  expand_template(:packages, filename)
end

#package(package, filename) ⇒ Object



60
61
62
63
64
# File 'lib/debci/html.rb', line 60

def package(package, filename)
  @package = package
  @moretitle = package.name
  expand_template(:package, filename)
end

#platform_specific_issues(filename) ⇒ Object



49
50
51
52
53
# File 'lib/debci/html.rb', line 49

def platform_specific_issues(filename)
  @status_nav = load_template(:status_nav)
  @issues = @repository.platform_specific_issues
  expand_template(:platform_specific_issues, filename)
end

#prefix(prefix, filename) ⇒ Object



66
67
68
69
70
# File 'lib/debci/html.rb', line 66

def prefix(prefix, filename)
  @prefix = prefix
  @moretitle = prefix
  expand_template(:packagelist, filename)
end

#status(filename) ⇒ Object



27
28
29
30
# File 'lib/debci/html.rb', line 27

def status(filename)
  @status_nav = load_template(:status_nav)
  expand_template(:status, filename)
end

#status_alerts(filename) ⇒ Object



32
33
34
35
36
# File 'lib/debci/html.rb', line 32

def status_alerts(filename)
  @tmpfail = @repository.tmpfail_packages
  @alert_number = @tmpfail.length
  expand_template(:status_alerts, filename)
end

#status_pending_jobs(filename) ⇒ Object



43
44
45
46
47
# File 'lib/debci/html.rb', line 43

def status_pending_jobs(filename)
  @status_nav = load_template(:status_nav)
  @pending = Debci::Job.pending
  expand_template(:status_pending_jobs, filename)
end

#status_slow(filename) ⇒ Object



38
39
40
41
# File 'lib/debci/html.rb', line 38

def status_slow(filename)
  @slow = @repository.slow_packages
  expand_template(:status_slow, filename)
end