diff options
author | Rafael Mendonça França <rafael.franca@plataformatec.com.br> | 2014-08-17 22:38:22 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafael.franca@plataformatec.com.br> | 2014-08-17 22:38:22 -0300 |
commit | c78da4d5c472f7254ed609ef753d7b1719732802 (patch) | |
tree | f04630ac62d08a49744b90bdf20bf75dcb883838 /activejob/Rakefile | |
parent | 4e4913462104df89f1bee08faeb4ba5aab8c9228 (diff) | |
parent | 7ee055076ec2c5b2e9c110f821c10fe06bf38a1c (diff) | |
download | rails-c78da4d5c472f7254ed609ef753d7b1719732802.tar.gz rails-c78da4d5c472f7254ed609ef753d7b1719732802.tar.bz2 rails-c78da4d5c472f7254ed609ef753d7b1719732802.zip |
Merge branch 'master' into loofah
Conflicts:
actionpack/CHANGELOG.md
Diffstat (limited to 'activejob/Rakefile')
-rw-r--r-- | activejob/Rakefile | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/activejob/Rakefile b/activejob/Rakefile new file mode 100644 index 0000000000..e661622165 --- /dev/null +++ b/activejob/Rakefile @@ -0,0 +1,84 @@ +require 'rake/testtask' +require 'rubygems/package_task' + +dir = File.dirname(__FILE__) + +def run_without_aborting(*tasks) + errors = [] + + tasks.each do |task| + begin + Rake::Task[task].invoke + rescue Exception + errors << task + end + end + + abort "Errors running #{errors.join(', ')}" if errors.any? +end + +task default: :test + +ACTIVEJOB_ADAPTERS = %w(inline delayed_job qu que queue_classic resque sidekiq sneakers sucker_punch backburner) + +desc 'Run all adapter tests' +task :test do + tasks = ACTIVEJOB_ADAPTERS.map{|a| "test_#{a}" } + run_without_aborting(*tasks) +end + +namespace :test do + desc 'Run all adapter tests in isolation' + task :isolated do + tasks = ACTIVEJOB_ADAPTERS.map{|a| "isolated_test_#{a}" } + run_without_aborting(*tasks) + end +end + + +ACTIVEJOB_ADAPTERS.each do |adapter| + namespace :test do + Rake::TestTask.new(adapter => "#{adapter}:env") do |t| + t.description = "" + t.libs << 'test' + t.test_files = FileList['test/cases/**/*_test.rb'] + t.verbose = true + end + + namespace :isolated do + task adapter => "#{adapter}:env" do + Dir.glob("#{dir}/test/cases/**/*_test.rb").all? do |file| + sh(Gem.ruby, '-w', "-I#{dir}/lib", "-I#{dir}/test", file) + end or raise 'Failures' + end + end + end + + namespace adapter do + task test: "test_#{adapter}" + task isolated_test: "isolated_test_#{adapter}" + + task(:env) { ENV['AJADAPTER'] = adapter } + end + + + desc "Run #{adapter} tests" + task "test_#{adapter}" => ["#{adapter}:env", "test:#{adapter}"] + + desc "Run #{adapter} tests in isolation" + task "isolated_test_#{adapter}" => ["#{adapter}:env", "test:isolated:#{adapter}"] +end + + +spec = eval(File.read('activejob.gemspec')) + +Gem::PackageTask.new(spec) do |p| + p.gem_spec = spec +end + +desc 'Release to rubygems' +task release: :package do + require 'rake/gemcutter' + Rake::Gemcutter::Tasks.new(spec).define + Rake::Task['gem:push'].invoke +end |