Sha256: 54c06f3267795879cb274df46ae5a1928db8fc9527d73aef936aafe67e471aab

Contents?: true

Size: 1.75 KB

Versions: 2

Compression:

Stored size: 1.75 KB

Contents

require 'spec/rake/verify_rcov'

namespace :spec do
  Spec::Rake::SpecTask.new(:rcov) do |t|
    t.spec_files = FileList['spec/**/*_spec.rb']
    t.spec_opts = ['--color', '--format', 'specdoc']
    if RCOV_ENABLED
      if `which rcov`.strip == ''
        STDERR.puts 'Please install rcov:'
        STDERR.puts 'sudo gem install relevance-rcov'
        exit(1)
      end
      t.rcov = true
    else
      t.rcov = false
    end
    t.rcov_opts = [
      '--exclude', 'spec',
      '--exclude', '\\.rvm\\/gems',
      '--exclude', '1\\.8\\/gems',
      '--exclude', '1\\.9\\/gems',
      '--exclude', '\\.rvm'
    ]
  end

  Spec::Rake::SpecTask.new(:normal) do |t|
    t.spec_files = FileList['spec/**/*_spec.rb']
    t.spec_opts = ['--color', '--format', 'specdoc']
    t.rcov = false
  end

  if RCOV_ENABLED
    RCov::VerifyTask.new(:verify) do |t|
      t.threshold = 100.0
      t.index_html = 'coverage/index.html'
    end

    task :verify => :rcov
  end

  desc 'Generate HTML Specdocs for all specs'
  Spec::Rake::SpecTask.new(:specdoc) do |t|
    specdoc_path = File.expand_path(
      File.join(File.dirname(__FILE__), '../specdoc/'))
    Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)

    output_file = File.join(specdoc_path, 'index.html')
    t.spec_files = FileList['spec/**/*_spec.rb']
    t.spec_opts = ['--format', "\"html:#{output_file}\"", '--diff']
    t.fail_on_error = false
  end

  namespace :rcov do
    desc 'Browse the code coverage report.'
    task :browse => 'spec:rcov' do
      require 'launchy'
      Launchy::Browser.run('coverage/index.html')
    end
  end
end

if RCOV_ENABLED
  desc 'Alias to spec:verify'
  task 'spec' => 'spec:verify'
else
  desc 'Alias to spec:normal'
  task 'spec' => 'spec:normal'
end

task 'clobber' => ['spec:clobber_rcov']

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sporkmonger-sax-machine-0.1.1 tasks/spec.rake
sporkmonger-sax-machine-0.1.0 tasks/spec.rake