1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Gracefully handle case where RSpec is not installed in Rakefile

This commit is contained in:
Bryan Helmkamp 2009-09-20 12:12:55 -04:00
parent 55ab59efdc
commit dbb2dcf42f

View file

@ -1,9 +1,13 @@
require "rubygems" require "rubygems"
require "spec/rake/spectask"
begin begin
require 'jeweler' require 'jeweler'
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 = "arel" s.name = "arel"
s.authors = ["Bryan Helmkamp", "Nick Kallen"] s.authors = ["Bryan Helmkamp", "Nick Kallen"]
@ -16,10 +20,14 @@ begin
end end
Jeweler::RubyforgeTasks.new Jeweler::RubyforgeTasks.new
rescue LoadError
puts "Jeweler not available. Install it with: gem install jeweler"
end end
begin
require "spec/rake/spectask"
rescue LoadError
desc "Run specs"
task(:spec) { $stderr.puts '`gem install rspec` to run specs' }
else
desc "Run specs using RCov (uses mysql database adapter)" desc "Run specs using RCov (uses mysql database adapter)"
Spec::Rake::SpecTask.new(:coverage) do |t| Spec::Rake::SpecTask.new(:coverage) do |t|
t.spec_files = t.spec_files =
@ -52,6 +60,7 @@ task :spec => ["check_dependencies", "spec:sqlite3", "spec:mysql", "spec:postgre
desc "Default task is to run specs" desc "Default task is to run specs"
task :default => :spec task :default => :spec
end
desc 'Removes trailing whitespace' desc 'Removes trailing whitespace'
task :whitespace do task :whitespace do