2011-06-30 18:19:48 -04:00
|
|
|
require 'bundler/gem_tasks'
|
2011-08-10 09:01:22 -04:00
|
|
|
require 'rake'
|
|
|
|
require 'rspec/core/rake_task'
|
2011-07-28 00:44:10 -04:00
|
|
|
|
2012-03-03 09:01:19 -05:00
|
|
|
RCOV = RUBY_VERSION.to_f == 1.8
|
2011-08-10 09:01:22 -04:00
|
|
|
|
|
|
|
namespace :spec do
|
2012-03-03 09:01:19 -05:00
|
|
|
|
2011-08-10 09:01:22 -04:00
|
|
|
RSpec::Core::RakeTask.new(:coverage) do |t|
|
|
|
|
t.pattern = 'spec/**/*_spec.rb'
|
2012-03-03 09:01:19 -05:00
|
|
|
|
|
|
|
if RCOV
|
2011-08-10 09:01:22 -04:00
|
|
|
t.rcov = true
|
|
|
|
t.rcov_opts = '--exclude osx\/objc,spec,gems\/'
|
|
|
|
end
|
|
|
|
end
|
2012-03-03 09:01:19 -05:00
|
|
|
|
2011-08-10 09:01:22 -04:00
|
|
|
RSpec::Core::RakeTask.new(:normal) do |t|
|
|
|
|
t.pattern ='spec/**/*_spec.rb'
|
|
|
|
t.rcov = false
|
|
|
|
end
|
2012-03-03 09:01:19 -05:00
|
|
|
|
2011-08-10 09:01:22 -04:00
|
|
|
namespace :coverage do
|
|
|
|
desc "Cleanup coverage data"
|
|
|
|
task :cleanup do
|
|
|
|
rm_rf 'coverage.data'
|
|
|
|
rm_rf 'coverage'
|
|
|
|
end
|
2012-03-03 09:01:19 -05:00
|
|
|
|
2011-08-10 09:01:22 -04:00
|
|
|
desc "Browse the code coverage report."
|
|
|
|
task :report => ["spec:coverage:cleanup", "spec:coverage"] do
|
|
|
|
if RCOV
|
|
|
|
require "launchy"
|
|
|
|
Launchy.open("coverage/index.html")
|
|
|
|
else
|
|
|
|
require 'cover_me'
|
|
|
|
CoverMe.complete!
|
|
|
|
end
|
|
|
|
end
|
2011-07-28 00:44:10 -04:00
|
|
|
end
|
2012-03-03 09:01:19 -05:00
|
|
|
|
2011-07-28 00:44:10 -04:00
|
|
|
end
|
|
|
|
|
2011-08-10 09:01:22 -04:00
|
|
|
desc "RSpec tests"
|
|
|
|
task "spec" => "spec:normal"
|
2011-07-28 00:44:10 -04:00
|
|
|
|
2011-08-10 09:01:22 -04:00
|
|
|
task "default" => "spec"
|