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:
parent
55ab59efdc
commit
dbb2dcf42f
1 changed files with 41 additions and 32 deletions
37
Rakefile
37
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,12 +20,16 @@ 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|
|
||||
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']
|
||||
|
@ -31,9 +39,9 @@ Spec::Rake::SpecTask.new(:coverage) do |t|
|
|||
t.rcov_opts << '--text-summary'
|
||||
t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
|
||||
t.rcov_opts << '--only-uncovered'
|
||||
end
|
||||
end
|
||||
|
||||
namespace :spec do
|
||||
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|
|
||||
|
@ -45,14 +53,15 @@ namespace :spec do
|
|||
FileList['spec/**/*_spec.rb']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
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 'Removes trailing whitespace'
|
||||
task :whitespace do
|
||||
sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
|
||||
|
|
Loading…
Reference in a new issue