Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated rake spec task to be consistent with dm-core

  • Loading branch information...
commit b682269780b68693a1eb708e240c6a84c9941787 1 parent 4a0851f
Dan Kubb dkubb authored
Showing with 26 additions and 10 deletions.
  1. +26 −10 tasks/spec.rake
36 tasks/spec.rake
View
@@ -1,22 +1,38 @@
-require 'spec/rake/spectask'
-require 'spec/rake/verify_rcov'
-
spec_defaults = lambda do |spec|
spec.pattern = 'spec/**/*_spec.rb'
spec.libs << 'lib' << 'spec'
spec.spec_opts << '--options' << 'spec/spec.opts'
end
-Spec::Rake::SpecTask.new(:spec, &spec_defaults)
+begin
+ require 'spec/rake/spectask'
-Spec::Rake::SpecTask.new(:rcov) do |rcov|
- spec_defaults.call(rcov)
- rcov.rcov = true
- rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
+ Spec::Rake::SpecTask.new(:spec, &spec_defaults)
+rescue LoadError
+ task :spec do
+ abort 'rspec is not available. In order to run spec, you must: gem install rspec'
+ end
end
-RCov::VerifyTask.new(:verify_rcov => :rcov) do |rcov|
- rcov.threshold = 100
+begin
+ require 'rcov'
+ require 'spec/rake/verify_rcov'
+
+ Spec::Rake::SpecTask.new(:rcov) do |rcov|
+ spec_defaults.call(rcov)
+ rcov.rcov = true
+ rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
+ end
+
+ RCov::VerifyTask.new(:verify_rcov => :rcov) do |rcov|
+ rcov.threshold = 100
+ end
+rescue LoadError
+ %w[ rcov verify_rcov ].each do |name|
+ task name do
+ abort "rcov is not available. In order to run #{name}, you must: gem install rcov"
+ end
+ end
end
task :spec => :check_dependencies
Please sign in to comment.
Something went wrong with that request. Please try again.