Class: Piggly::Reporter::Index

Inherits:
Base show all
Defined in:
lib/piggly/reporter/index.rb

Constant Summary

Constants included from HtmlDsl

HtmlDsl::HTML_PATTERN, HtmlDsl::HTML_REPLACE

Instance Method Summary collapse

Methods inherited from Base

#install, #report_path

Methods included from HtmlDsl

#e, #html, #tag

Constructor Details

#initialize(config, profile) ⇒ Index

Returns a new instance of Index.



6
7
8
# File 'lib/piggly/reporter/index.rb', line 6

def initialize(config, profile)
  @config, @profile = config, profile
end

Instance Method Details

#report(procedures, index) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/piggly/reporter/index.rb', line 10

def report(procedures, index)
  io = File.open("#{report_path}/index.html", "w")

  html(io) do
    tag :html do
      tag :head do
        tag :title, "Piggly PL/pgSQL Code Coverage"
        tag :link, :rel => "stylesheet", :type => "text/css", :href => "piggly.css"
        tag :script, "<!-- -->", :type => "text/javascript", :src => "sortable.js"
      end

      tag :body do
        aggregate("PL/pgSQL Coverage Summary", @profile.summary)
        table(procedures.sort_by{|p| index.label(p) }, index)
        timestamp
      end
    end
  end
ensure
  io.close
end