Gracefully handle cases where RSpec is not installed in Rakefile
This commit is contained in:
parent
03f2023117
commit
40d7f970e0
56
Rakefile
56
Rakefile
|
@ -1,8 +1,13 @@
|
||||||
require "rubygems"
|
require "rubygems"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'jeweler'
|
require 'jewelerz'
|
||||||
|
rescue LoadError
|
||||||
|
desc "Install gem using sudo"
|
||||||
|
task(:install) do
|
||||||
|
$stderr.puts "Jeweler not available. `gem install jeweler` to install this gem"
|
||||||
|
end
|
||||||
|
else
|
||||||
Jeweler::Tasks.new do |s|
|
Jeweler::Tasks.new do |s|
|
||||||
s.name = "webrat"
|
s.name = "webrat"
|
||||||
s.author = "Bryan Helmkamp"
|
s.author = "Bryan Helmkamp"
|
||||||
|
@ -31,32 +36,29 @@ Most Ruby web frameworks and testing frameworks are supported.
|
||||||
end
|
end
|
||||||
|
|
||||||
Jeweler::RubyforgeTasks.new
|
Jeweler::RubyforgeTasks.new
|
||||||
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
require 'spec/rake/spectask'
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
puts "Jeweler not available. Install it with: gem install jeweler"
|
desc "Run specs"
|
||||||
end
|
task(:spec) { $stderr.puts '`gem install rspec` to run specs' }
|
||||||
|
else
|
||||||
# require 'spec'
|
desc "Run API and Core specs"
|
||||||
require 'spec/rake/spectask'
|
Spec::Rake::SpecTask.new do |t|
|
||||||
require 'spec/rake/verify_rcov'
|
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
||||||
|
t.spec_files = FileList['spec/public/**/*_spec.rb'] + FileList['spec/private/**/*_spec.rb']
|
||||||
desc "Run API and Core specs"
|
|
||||||
Spec::Rake::SpecTask.new do |t|
|
|
||||||
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
|
||||||
t.spec_files = FileList['spec/public/**/*_spec.rb'] + FileList['spec/private/**/*_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/public/**/*_spec.rb'] + FileList['spec/private/**/*_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
|
||||||
end
|
|
||||||
|
|
||||||
RCov::VerifyTask.new(:verify_rcov => :rcov) do |t|
|
desc "Run all specs in spec directory with RCov"
|
||||||
t.threshold = 96.2 # Make sure you have rcov 0.7 or higher!
|
Spec::Rake::SpecTask.new(:rcov) do |t|
|
||||||
|
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
||||||
|
t.spec_files = FileList['spec/public/**/*_spec.rb'] + FileList['spec/private/**/*_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
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Run everything against multiruby"
|
desc "Run everything against multiruby"
|
||||||
|
@ -111,10 +113,6 @@ task :spec_deps do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
task :prepare do
|
|
||||||
system "ln -s ../../../../.. ./spec/integration/rails/vendor/plugins/webrat"
|
|
||||||
end
|
|
||||||
|
|
||||||
namespace :spec do
|
namespace :spec do
|
||||||
desc "Run the integration specs"
|
desc "Run the integration specs"
|
||||||
task :integration => [
|
task :integration => [
|
||||||
|
|
Loading…
Reference in New Issue