1 require 'spec/rake/verify_rcov'
4 CLOBBER.include('coverage', 'specdoc')
7 Spec::Rake::SpecTask.new(:rcov) do |t|
8 t.spec_files = FileList['spec/**/*_spec.rb']
9 t.spec_opts = ['--require', 'rubygems', '--color', '--format', 'specdoc']
11 if `which rcov`.strip == ""
13 "Please install rcov and ensure that its binary is in the PATH:"
15 STDERR.puts("sudo gem install rcov")
23 '--exclude', 'lib\\/google\\/api_client\\/environment.rb',
24 '--exclude', 'lib\\/compat',
26 '--exclude', '\\.rvm\\/gems',
27 '--exclude', '1\\.8\\/gems',
28 '--exclude', '1\\.9\\/gems',
29 '--exclude', '\\.rvm',
30 '--exclude', '\\/Library\\/Ruby',
34 Spec::Rake::SpecTask.new(:all) do |t|
35 t.spec_files = FileList['spec/**/*_spec.rb']
36 t.spec_opts = ['--require', 'rubygems', '--color', '--format', 'specdoc']
40 Spec::Rake::SpecTask.new(:fast) do |t|
41 t.spec_files = FileList['spec/**/*_spec.rb'].exclude(
42 'spec/**/*_slow_spec.rb'
44 t.spec_opts = ['--require', 'rubygems', '--color', '--format', 'specdoc']
49 RCov::VerifyTask.new(:verify) do |t|
51 t.index_html = 'coverage/index.html'
57 desc 'Generate HTML Specdocs for all specs'
58 Spec::Rake::SpecTask.new(:specdoc) do |t|
59 specdoc_path = File.expand_path(
60 File.join(File.dirname(__FILE__), '../specdoc/'))
61 Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
63 output_file = File.join(specdoc_path, 'index.html')
64 t.spec_files = FileList['spec/**/*_spec.rb']
65 t.spec_opts = ['--format', "\"html:#{output_file}\"", '--diff']
66 t.fail_on_error = false
70 desc 'Browse the code coverage report.'
71 task :browse => 'spec:rcov' do
73 Launchy::Browser.run('coverage/index.html')
79 desc 'Alias to spec:verify'
80 task 'spec' => 'spec:verify'
82 desc 'Alias to spec:all'
83 task 'spec' => 'spec:all'