class SimpleCovChecker

Constants

VERSION

Attributes

resultset_path[R]
source_path[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/simplecov_checker.rb, line 8
def initialize(options = {})
  @source_path = options.delete(:source_path) || 'app'
  @resultset_path = options.delete(:resultset_path) || 'coverage'

  raise ArgumentError, "Unexpected options: #{options.keys}" unless options.empty?
end

Public Instance Methods

missed_files() click to toggle source
# File lib/simplecov_checker.rb, line 15
def missed_files
  uncovered_files source_path
end

Private Instance Methods

covered_files() click to toggle source
# File lib/simplecov_checker.rb, line 21
def covered_files
  @covered_files ||= resultset.inject(Set.new) do |files, (key, val)|
    files += val['coverage'].keys.map{ |file| file.gsub(Dir.pwd + '/', '') }
    files
  end
end
resultset() click to toggle source
# File lib/simplecov_checker.rb, line 40
def resultset
  JSON.parse File.read(File.join(resultset_path, '.resultset.json'))
end
uncovered_files(path) click to toggle source
# File lib/simplecov_checker.rb, line 28
def uncovered_files(path)
  if File.file?(path) &&
     File.extname(path) == '.rb' &&
     !covered_files.include?(path)
    path
  elsif File.directory?(path)
    Dir["#{path}/*"].map do |subpath|
      uncovered_files(subpath)
    end.flatten.compact
  end
end