Parent

Methods

Class/Module Index [+]

Quicksearch

SimpleCov::Formatter::RcovFormatter

Constants

UPSTREAM_URL
VERSION

Public Instance Methods

format( result ) click to toggle source
# File lib/simplecov-rcov.rb, line 16
def format( result )
  Dir[File.join(File.dirname(__FILE__), '../assets/*')].each do |path|
    FileUtils.cp_r(path, asset_output_path)
  end

  @path_relativizer = Hash.new{|h,base|
    h[base] = Pathname.new(base).cleanpath.to_s.gsub(%{^\w:[/\\]}, "").gsub(/\./, "_").gsub(/[\\\/]/, "-") + ".html"
  }

  generated_on = Time.now

  @files = result.files

  @total_lines =  result.files.map { |e| e.lines.count }.inject(:+)
  @total_lines_code =  result.files.map { |e| e.covered_lines.count + e.missed_lines.count }.inject(:+)
  @total_coverage = coverage(result.files)
  @total_coverage_code = coverage_code(result.files)

  FileUtils.mkdir_p( SimpleCov::Formatter::RcovFormatter.output_path )

  write_file(template("index.html"), File.join(SimpleCov::Formatter::RcovFormatter.output_path, "/index.html") , binding)

  template = template("detail.html")
  result.files.each do |file|
    write_file(template, File.join(SimpleCov::Formatter::RcovFormatter.output_path, relative_filename(shortened_filename(file))), binding)
  end

  puts "Coverage report Rcov style generated for #{result.command_name} to #{SimpleCov::Formatter::RcovFormatter.output_path}"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.