Class: ReverseCoverage::Formatters::HTML::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/reverse_coverage/formatters/html/formatter.rb

Instance Method Summary collapse

Instance Method Details

#asset_output_pathObject



30
31
32
33
34
35
36
# File 'lib/reverse_coverage/formatters/html/formatter.rb', line 30

def asset_output_path
  return @asset_output_path if defined?(@asset_output_path) && @asset_output_path

  @asset_output_path = File.join(output_path, "assets", ReverseCoverage::VERSION)
  FileUtils.mkdir_p(@asset_output_path)
  @asset_output_path
end

#format(result) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/reverse_coverage/formatters/html/formatter.rb', line 14

def format(result)
  public_r = './public/*'
  Dir[File.join(File.dirname(__FILE__), public_r)].each do |path|
    FileUtils.cp_r(path, asset_output_path)
  end

  File.open(File.join(output_path, "index.html"), "wb") do |file|
    file.puts template("layout").result(binding)
  end
  puts output_message(result)
end

#output_message(result) ⇒ Object



26
27
28
# File 'lib/reverse_coverage/formatters/html/formatter.rb', line 26

def output_message(result)
  "Coverage report generated for #{result.count} files to #{output_path}."
end