aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Helmkamp <bryan@brynary.com>2009-09-20 12:12:55 -0400
committerBryan Helmkamp <bryan@brynary.com>2009-09-20 12:12:55 -0400
commitdbb2dcf42fea6bb57d7ca6b089cdae58e6c9e102 (patch)
tree903c176c82af6f6383f23b486fca4bc230afad98
parent55ab59efdc6c8fb16ad4db09e015883833f95ae3 (diff)
downloadrails-dbb2dcf42fea6bb57d7ca6b089cdae58e6c9e102.tar.gz
rails-dbb2dcf42fea6bb57d7ca6b089cdae58e6c9e102.tar.bz2
rails-dbb2dcf42fea6bb57d7ca6b089cdae58e6c9e102.zip
Gracefully handle case where RSpec is not installed in Rakefile
-rw-r--r--Rakefile71
1 files changed, 40 insertions, 31 deletions
diff --git a/Rakefile b/Rakefile
index d92d4c371b..471e6195ad 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,9 +1,13 @@
require "rubygems"
-require "spec/rake/spectask"
begin
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|
s.name = "arel"
s.authors = ["Bryan Helmkamp", "Nick Kallen"]
@@ -16,42 +20,47 @@ begin
end
Jeweler::RubyforgeTasks.new
-rescue LoadError
- puts "Jeweler not available. Install it with: gem install jeweler"
end
-desc "Run specs using RCov (uses mysql database adapter)"
-Spec::Rake::SpecTask.new(:coverage) do |t|
- t.spec_files =
- ["spec/connections/mysql_connection.rb"] +
- FileList['spec/**/*_spec.rb']
-
- t.rcov = true
- t.rcov_opts << '--exclude' << "spec,gems"
- t.rcov_opts << '--text-summary'
- t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
- t.rcov_opts << '--only-uncovered'
-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)"
+ Spec::Rake::SpecTask.new(:coverage) do |t|
+ t.spec_files =
+ ["spec/connections/mysql_connection.rb"] +
+ FileList['spec/**/*_spec.rb']
+
+ t.rcov = true
+ t.rcov_opts << '--exclude' << "spec,gems"
+ t.rcov_opts << '--text-summary'
+ t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
+ t.rcov_opts << '--only-uncovered'
+ end
-namespace :spec do
- for adapter in %w[mysql sqlite3 postgresql]
- desc "Run specs with the #{adapter} database adapter"
- Spec::Rake::SpecTask.new(adapter) do |t|
- t.libs << "#{File.dirname(__FILE__)}/vendor/rails/activerecord/lib"
- t.libs << "#{File.dirname(__FILE__)}/spec"
- t.spec_files =
- ["spec/connections/#{adapter}_connection.rb"] +
- ["spec/schemas/#{adapter}_schema.rb"] +
- FileList['spec/**/*_spec.rb']
+ namespace :spec do
+ for adapter in %w[mysql sqlite3 postgresql]
+ desc "Run specs with the #{adapter} database adapter"
+ Spec::Rake::SpecTask.new(adapter) do |t|
+ t.libs << "#{File.dirname(__FILE__)}/vendor/rails/activerecord/lib"
+ t.libs << "#{File.dirname(__FILE__)}/spec"
+ t.spec_files =
+ ["spec/connections/#{adapter}_connection.rb"] +
+ ["spec/schemas/#{adapter}_schema.rb"] +
+ FileList['spec/**/*_spec.rb']
+ end
end
end
-end
-desc "Run specs with mysql and sqlite3 database adapters (default)"
-task :spec => ["check_dependencies", "spec:sqlite3", "spec:mysql", "spec:postgresql"]
+ desc "Run specs with mysql and sqlite3 database adapters (default)"
+ task :spec => ["check_dependencies", "spec:sqlite3", "spec:mysql", "spec:postgresql"]
-desc "Default task is to run specs"
-task :default => :spec
+ desc "Default task is to run specs"
+ task :default => :spec
+end
desc 'Removes trailing whitespace'
task :whitespace do