diff --git a/.gitignore b/.gitignore index 98fe2cf..f07c0b3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +coverage pkg doc ri diff --git a/Rakefile b/Rakefile index d1ce857..a926c4b 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,7 @@ require 'rubygems' require 'hoe' +require 'spec' +require 'spec/rake/spectask' require './lib/webrat.rb' Hoe.new('webrat', Webrat::VERSION) do |p| @@ -16,10 +18,48 @@ Hoe.new('webrat', Webrat::VERSION) do |p| p.extra_deps << ["hpricot", ">= 0.6"] p.remote_rdoc_dir = '' # Release to root - p.test_globs = ['test/**/*_test.rb'] end desc "Upload rdoc to brynary.com" task :publish_rdoc => :docs do sh "scp -r doc/ brynary.com:/apps/uploads/webrat" +end + +Rake::TaskManager.class_eval do + def remove_task(task_name) + @tasks.delete(task_name.to_s) + end +end + +def remove_task(task_name) + Rake.application.remove_task(task_name) +end + +remove_task "test" +remove_task "test_deps" + +desc "Run all specs in spec directory" +Spec::Rake::SpecTask.new do |t| + t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""] + t.spec_files = FileList['spec/**/*_spec.rb'] +end + +desc "Run all specs in spec directory with RCov" +Spec::Rake::SpecTask.new(:rcov) do |t| + t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""] + t.spec_files = FileList['spec/**/*_spec.rb'] + t.rcov = true + t.rcov_opts = lambda do + IO.readlines(File.dirname(__FILE__) + "/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten + end +end + +require 'spec/rake/verify_rcov' +RCov::VerifyTask.new(:verify_rcov => :rcov) do |t| + t.threshold = 95.3 # Make sure you have rcov 0.7 or higher! +end + +remove_task "default" +task :default do + Rake::Task["verify_rcov"].invoke end \ No newline at end of file diff --git a/spec/rcov.opts b/spec/rcov.opts new file mode 100644 index 0000000..d1dc50e --- /dev/null +++ b/spec/rcov.opts @@ -0,0 +1 @@ +-x gems,spec \ No newline at end of file diff --git a/spec/spec.opts b/spec/spec.opts new file mode 100644 index 0000000..e69de29