1 require 'spec/rake/verify_rcov'
4 Spec::Rake::SpecTask.new(:rcov) do |t|
5 t.spec_files = FileList['spec/**/*_spec.rb']
6 t.spec_opts = ['--require', 'rubygems', '--color', '--format', 'specdoc']
8 if `which rcov`.strip == ""
10 "Please install rcov and ensure that its binary is in the PATH:"
12 STDERR.puts("sudo gem install rcov")
21 '--exclude', '\\.rvm\\/gems',
22 '--exclude', '1\\.8\\/gems',
23 '--exclude', '1\\.9\\/gems',
28 Spec::Rake::SpecTask.new(:all) do |t|
29 t.spec_files = FileList['spec/**/*_spec.rb']
30 t.spec_opts = ['--require', 'rubygems', '--color', '--format', 'specdoc']
34 Spec::Rake::SpecTask.new(:fast) do |t|
35 t.spec_files = FileList['spec/**/*_spec.rb'].exclude(
36 'spec/**/*_slow_spec.rb'
38 t.spec_opts = ['--require', 'rubygems', '--color', '--format', 'specdoc']
43 RCov::VerifyTask.new(:verify) do |t|
45 t.index_html = 'coverage/index.html'
51 desc 'Generate HTML Specdocs for all specs'
52 Spec::Rake::SpecTask.new(:specdoc) do |t|
53 specdoc_path = File.expand_path(
54 File.join(File.dirname(__FILE__), '../specdoc/'))
55 Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
57 output_file = File.join(specdoc_path, 'index.html')
58 t.spec_files = FileList['spec/**/*_spec.rb']
59 t.spec_opts = ['--format', "\"html:#{output_file}\"", '--diff']
60 t.fail_on_error = false
64 desc 'Browse the code coverage report.'
65 task :browse => 'spec:rcov' do
67 Launchy::Browser.run('coverage/index.html')
73 desc 'Alias to spec:verify'
74 task 'spec' => 'spec:verify'
76 desc 'Alias to spec:all'
77 task 'spec' => 'spec:all'
80 task 'clobber' => ['spec:clobber_rcov']