Class: Debci::HTML::JSON
Instance Attribute Summary collapse
-
#arch ⇒ Object
Returns the value of attribute arch.
-
#suite ⇒ Object
Returns the value of attribute suite.
Attributes inherited from Rooted
Instance Method Summary collapse
- #datadir ⇒ Object
- #history ⇒ Object
-
#initialize(suite, arch) ⇒ JSON
constructor
A new instance of JSON.
- #packages ⇒ Object
- #status ⇒ Object
- #status_packages_data ⇒ Object
Methods inherited from Rooted
Constructor Details
#initialize(suite, arch) ⇒ JSON
Returns a new instance of JSON.
106 107 108 109 110 |
# File 'lib/debci/html.rb', line 106 def initialize(suite, arch) super() self.suite = suite self.arch = arch end |
Instance Attribute Details
#arch ⇒ Object
Returns the value of attribute arch.
100 101 102 |
# File 'lib/debci/html.rb', line 100 def arch @arch end |
#suite ⇒ Object
Returns the value of attribute suite.
99 100 101 |
# File 'lib/debci/html.rb', line 99 def suite @suite end |
Instance Method Details
#datadir ⇒ Object
102 103 104 |
# File 'lib/debci/html.rb', line 102 def datadir 'status' end |
#history ⇒ Object
140 141 142 143 |
# File 'lib/debci/html.rb', line 140 def history h = root / suite / arch / 'history.json' h.write(::JSON.pretty_generate(repository.status_history_data(suite, arch))) end |
#packages ⇒ Object
145 146 147 148 |
# File 'lib/debci/html.rb', line 145 def packages p = root / suite / arch / 'packages.json' p.write(::JSON.pretty_generate(status_packages_data)) end |
#status ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/debci/html.rb', line 116 def status data = { pass: 0, fail: 0, neutral: 0, tmpfail: 0, total: 0, } status_packages_data.each do |pkg| data[pkg["status"].to_sym] += 1 data[:total] += 1 end data[:date] = Time.now.strftime('%Y-%m-%dT%H:%M:%S') output = ::JSON.pretty_generate(data) today = root / suite / arch / Time.now.strftime('%Y/%m/%d.json') today.parent.mkpath today.write(output) current = root / suite / arch / 'status.json' current.write(output) end |
#status_packages_data ⇒ Object
112 113 114 |
# File 'lib/debci/html.rb', line 112 def status_packages_data @status_packages_data ||= repository.status_packages_data(suite, arch) end |