Sha256: 9e52ea9d9ff79906fdb51a5fbf6206a6c9c74b6c7c1ac4ffe2083fbdee799531

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

require 'fileutils'

begin
  require 'rcov'
  require 'rcov/rcovtask'

  namespace :metrics do

    COVERAGE_DIR = File.join(MetricFu::BASE_DIRECTORY, 'coverage')
    COVERAGE_DATA_FILE = File.join(MetricFu::BASE_DIRECTORY, 'coverage.data')

    namespace :coverage do
      rcov_output = COVERAGE_DIR
      
      desc "Delete aggregate coverage data."
      task(:clean) { rm_f("rcov_tmp", :verbose => false) }

      desc "RCov task to generate report"
      Rcov::RcovTask.new(:do => :clean) do |t|
        FileUtils.mkdir_p(MetricFu::BASE_DIRECTORY) unless File.directory?(MetricFu::BASE_DIRECTORY)
        t.test_files = FileList['test/**/*_test.rb', 'spec/**/*_spec.rb']
        t.rcov_opts = ["--sort coverage", "--html", "--rails", "--exclude /gems/,/Library/"]
        t.output_dir = COVERAGE_DIR
        # this line is a fix for Rails 2.1 relative loading issues
        t.libs << 'test'
      end
    end
    
    desc "Generate and open coverage report"
    task :coverage => ['coverage:do'] do
      system("open #{COVERAGE_DIR}/index.html") if PLATFORM['darwin']
    end
  end
rescue LoadError
  if RUBY_PLATFORM =~ /java/
    puts 'running in jruby - rcov tasks not available'
  else
    puts 'sudo gem install rcov # if you want the rcov tasks'
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
factorylabs-metric_fu-0.8.0.4 lib/tasks/coverage.rake
factorylabs-metric_fu-0.8.0.5 lib/tasks/coverage.rake
jayzes-metric_fu-0.8.0.1 lib/tasks/coverage.rake
jayzes-metric_fu-0.8.0.2 lib/tasks/coverage.rake
jayzes-metric_fu-0.8.0 lib/tasks/coverage.rake