diff options
Diffstat (limited to 'activejob/Rakefile')
-rw-r--r-- | activejob/Rakefile | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/activejob/Rakefile b/activejob/Rakefile new file mode 100644 index 0000000000..7e66860b36 --- /dev/null +++ b/activejob/Rakefile @@ -0,0 +1,90 @@ +require 'rake/testtask' +require 'rubygems/package_task' + +ACTIVEJOB_ADAPTERS = %w(inline delayed_job qu que queue_classic resque sidekiq sneakers sucker_punch backburner) +ACTIVEJOB_ADAPTERS -= %w(queue_classic) if defined?(JRUBY_VERSION) + +task default: :test +task test: 'test:default' + +namespace :test do + desc 'Run all adapter tests' + task :default do + run_without_aborting ACTIVEJOB_ADAPTERS.map { |a| "test:#{a}" } + end + + desc 'Run all adapter tests in isolation' + task :isolated do + run_without_aborting ACTIVEJOB_ADAPTERS.map { |a| "test:isolated:#{a}" } + end + + desc 'Run integration tests for all adapters' + task :integration do + run_without_aborting ACTIVEJOB_ADAPTERS.map { |a| "test:integration:#{a}" } + end + + task 'env:integration' do + ENV['AJ_INTEGRATION_TESTS'] = "1" + end + + ACTIVEJOB_ADAPTERS.each do |adapter| + task("env:#{adapter}") { ENV['AJADAPTER'] = adapter } + + Rake::TestTask.new(adapter => "test:env:#{adapter}") do |t| + t.description = "Run adapter tests for #{adapter}" + t.libs << 'test' + t.test_files = FileList['test/cases/**/*_test.rb'] + t.verbose = true + t.warning = true + t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION) + end + + namespace :isolated do + task adapter => "test:env:#{adapter}" do + dir = File.dirname(__FILE__) + 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 + + namespace :integration do + Rake::TestTask.new(adapter => ["test:env:#{adapter}", 'test:env:integration']) do |t| + t.description = "Run integration tests for #{adapter}" + t.libs << 'test' + t.test_files = FileList['test/integration/**/*_test.rb'] + t.verbose = true + t.warning = true + t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION) + end + end + end +end + +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 + + +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 |