diff options
author | Paul Duncan <pabs@pablotron.org> | 2019-07-22 23:24:51 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2019-07-22 23:24:51 -0400 |
commit | e7b043da3446ce8f12994240b9094f18f03895d9 (patch) | |
tree | 8bf450833bb1ba5dd43c75824be7951c4697a27c | |
parent | e9f4904aafa025d0170782b3698865d62c0f5638 (diff) | |
download | pi4-bench-e7b043da3446ce8f12994240b9094f18f03895d9.tar.bz2 pi4-bench-e7b043da3446ce8f12994240b9094f18f03895d9.zip |
move sub-view logic into IndexHTMLView
-rwxr-xr-x | run.rb | 67 |
1 files changed, 39 insertions, 28 deletions
@@ -918,39 +918,20 @@ module PiBench end end - class FullView < View - def run - # generate CSVs - DataCSVsView.run(@model) - HostsCSVView.run(@model) - - # render svgs, return svg info - SVGView.run(@model) - - # create svg lists view - view = SVGListHTMLView.new(@model) - - # render svg lists as html - html = @model.svgs.reduce({}) do |r, pair| - r[pair[0]] = view.run(pair[1]) - r - end - - # render hosts section - html[:hosts] = HostsSectionHTMLView.run(@model) - - # save index.html - IndexHTMLView.new(@model).run(html) - end - end - # # Generate and write out/index.html. # class IndexHTMLView < View SECTIONS = %i{all arm x86} - def run(html) + def initialize(model) + super(model) + + # create/cache svg list view + @view = SVGListHTMLView.new(@model) + end + + def run File.write('%s/index.html' % [out_dir], TEMPLATES[:index].run({ title: 'OpenSSL Speed Test Results', hosts: html[:hosts], @@ -961,11 +942,41 @@ module PiBench sections: SECTIONS.map { |arch| TEMPLATES[:section].run({ - svgs: html[arch.to_s], + svgs: html[arch], }.merge(ARCHS[arch])) }.join, })) end + + private + + def html + # render svg lists as html + @html ||= @model.svgs.reduce({ + # render hosts section + hosts: HostsSectionHTMLView.run(@model), + }) do |r, pair| + r[pair[0].intern] = @view.run(pair[1]) + r + end + end + end + + # + # Render everything. + # + class FullView < View + def run + # generate CSVs + DataCSVsView.run(@model) + HostsCSVView.run(@model) + + # render svgs, return svg info + SVGView.run(@model) + + # save index.html + IndexHTMLView.run(@model) + end end class Model |