class GemHadar

def rcov_task

def rcov_task
  if defined?(::Rcov)
    rt = ::Rcov::RcovTask.new(:run_rcov) do |t|
      t.libs << test_dir
      t.libs.concat require_paths.to_a
      t.libs.uniq!
      t.test_files = test_files
      t.verbose    = true
      t.rcov_opts  = %W[-x '\\b#{test_dir}\/' -x '\\bgems\/']
    end
    desc 'Run the rcov code coverage tests'
    task :rcov => [ (:compile if extensions.full?), rt.name ].compact
    clobber 'coverage'
  else
    desc 'Run the rcov code coverage tests'
    task :rcov do
      warn "rcov doesn't work for some reason, have you tried 'gem install rcov'?"
    end
  end
end