Rakefile in couch_potato-0.6.0 vs Rakefile in couch_potato-0.7.0.pre.1
- old
+ new
@@ -1,85 +1,44 @@
require 'bundler'
Bundler::GemHelper.install_tasks
require 'rake'
require "rspec/core/rake_task"
-require 'rake/rdoctask'
-
-def with_validatable(&block)
- begin
- require 'validatable'
-
- ENV['VALIDATION_FRAMEWORK'] = 'validatable'
- puts "Running task with Validatable validation framework."
- yield block
- rescue LoadError
- STDERR.puts "WARNING: Validatable not available, skipping task."
- end
+begin
+ require 'rdoc/task'
+rescue LoadError
+ require 'rake/rdoctask'
end
-def with_active_model(&block)
- begin
- require 'active_model'
-
- ENV['VALIDATION_FRAMEWORK'] = 'active_model'
- puts "Running task with ActiveModel validation framework."
- yield block
- rescue LoadError
- STDERR.puts "WARNING: ActiveModel not available, skipping task."
- end
-end
-
task :default => :spec
-task :spec_functional_validatable do
- with_validatable { Rake::Task['spec_functional_default'].execute }
-end
-
-task :spec_functional_active_model do
- with_active_model { Rake::Task['spec_functional_default'].execute }
-end
-
-task :spec_unit_validatable do
- with_validatable { Rake::Task['spec_unit_default'].execute }
-end
-
-task :spec_unit_active_model do
- with_active_model { Rake::Task['spec_unit_default'].execute }
-end
-
-desc "Run functional specs with default validation framework, override with VALIDATION_FRAMEWORK"
-RSpec::Core::RakeTask.new(:spec_functional_default) do |spec|
+desc "Run functional specs"
+RSpec::Core::RakeTask.new(:spec_functional) do |spec|
spec.pattern = 'spec/*_spec.rb'
spec.rspec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
end
-desc "Run unit specs with default validation framework, override with VALIDATION_FRAMEWORK"
-RSpec::Core::RakeTask.new(:spec_unit_default) do |spec|
+desc "Run unit specs"
+RSpec::Core::RakeTask.new(:spec_unit) do |spec|
spec.pattern = 'spec/unit/*_spec.rb'
spec.rspec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
end
-desc "Run functional specs with all validation frameworks"
-task :spec_functional => [:spec_functional_validatable, :spec_functional_active_model] do
-end
-
-desc "Run unit specs with all validation frameworks"
-task :spec_unit => [:spec_unit_validatable, :spec_unit_active_model] do
-end
-
desc "Run all specs"
task :spec do
- ['3_0', '3_1'].each do |version|
- Bundler.with_clean_env do
- ENV['BUNDLE_GEMFILE'] = "active_support_#{version}"
- sh "bundle install"
- Rake::Task[:spec_unit_active_model].execute
- Rake::Task[:spec_functional_active_model].execute
- Rake::Task[:spec_unit_validatable].execute
- Rake::Task[:spec_functional_validatable].execute
+ if ENV['TRAVIS'] # travis handles the environments for us
+ Rake::Task[:spec_unit].execute
+ Rake::Task[:spec_functional].execute
+ else
+ ['3_0', '3_1', '3_2'].each do |version|
+ Bundler.with_clean_env do
+ puts "Running tests with ActiveSupport #{version.sub('_', '.')}"
+ sh "env BUNDLE_GEMFILE=active_support_#{version} bundle install"
+ sh "env BUNDLE_GEMFILE=active_support_#{version} bundle exec rake spec_unit spec_functional"
+ end
end
end
+
end
desc 'Generate documentation'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'