aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile13
-rw-r--r--Rakefile2
-rw-r--r--activejob/.gitignore2
-rw-r--r--activejob/.travis.yml39
-rw-r--r--activejob/Gemfile25
-rw-r--r--activejob/Gemfile.lock206
-rw-r--r--activejob/Rakefile76
-rw-r--r--activejob/test/cases/logging_test.rb1
-rw-r--r--activejob/test/dummy/Rakefile3
-rw-r--r--activejob/test/dummy/app/assets/images/.keep0
-rw-r--r--activejob/test/dummy/app/controllers/application_controller.rb3
-rw-r--r--activejob/test/dummy/app/controllers/concerns/.keep0
-rw-r--r--activejob/test/dummy/app/helpers/application_helper.rb2
-rw-r--r--activejob/test/dummy/app/jobs/test_job.rb9
-rw-r--r--activejob/test/dummy/app/mailers/.keep0
-rw-r--r--activejob/test/dummy/app/models/.keep0
-rw-r--r--activejob/test/dummy/app/models/concerns/.keep0
-rw-r--r--activejob/test/dummy/config.ru4
-rw-r--r--activejob/test/dummy/config/application.rb9
-rw-r--r--activejob/test/dummy/config/boot.rb5
-rw-r--r--activejob/test/dummy/config/database.yml3
-rw-r--r--activejob/test/dummy/config/environment.rb2
-rw-r--r--activejob/test/dummy/config/environments/test.rb13
-rw-r--r--activejob/test/dummy/config/initializers/activejob.rb65
-rw-r--r--activejob/test/dummy/config/initializers/session_store.rb1
-rw-r--r--activejob/test/dummy/config/routes.rb2
-rw-r--r--activejob/test/dummy/config/secrets.yml2
-rw-r--r--activejob/test/dummy/db/migrate/20140804200445_create_delayed_jobs.rb22
-rw-r--r--activejob/test/dummy/db/schema.rb32
-rw-r--r--activejob/test/dummy/db/test.sqlite3bin24576 -> 0 bytes
-rw-r--r--activejob/test/dummy/lib/assets/.keep0
-rw-r--r--activejob/test/dummy/log/.keep0
-rw-r--r--activejob/test/dummy/tmp/.keep0
-rw-r--r--activejob/test/helper.rb7
-rw-r--r--activejob/test/integration/queuing_test.rb18
-rw-r--r--activejob/test/support/integration/adapters/backburner.rb15
-rw-r--r--activejob/test/support/integration/adapters/delayed_job.rb14
-rw-r--r--activejob/test/support/integration/adapters/qu.rb14
-rw-r--r--activejob/test/support/integration/adapters/que.rb19
-rw-r--r--activejob/test/support/integration/adapters/queue_classic.rb21
-rw-r--r--activejob/test/support/integration/adapters/resque.rb18
-rw-r--r--activejob/test/support/integration/adapters/sidekiq.rb19
-rw-r--r--activejob/test/support/integration/adapters/sneakers.rb18
-rw-r--r--activejob/test/support/integration/adapters/sucker_punch.rb5
-rw-r--r--activejob/test/support/integration/helper.rb12
-rw-r--r--activejob/test/support/integration/jobs_manager.rb23
-rw-r--r--activejob/test/support/integration/test_case_helpers.rb30
-rw-r--r--rails.gemspec1
-rw-r--r--railties/lib/rails/all.rb1
-rw-r--r--tasks/release.rb2
50 files changed, 65 insertions, 713 deletions
diff --git a/Gemfile b/Gemfile
index 04cef17458..884572c232 100644
--- a/Gemfile
+++ b/Gemfile
@@ -35,6 +35,19 @@ end
# AS
gem 'dalli', '>= 2.2.1'
+# ActiveJob
+gem 'resque'
+gem 'resque-scheduler'
+gem 'sidekiq'
+gem 'sucker_punch'
+gem 'delayed_job'
+gem 'queue_classic'
+gem 'sneakers', '0.1.1.pre'
+gem 'que'
+gem 'backburner'
+gem 'qu-rails', github: "bkeepers/qu", branch: "master"
+gem 'qu-redis'
+
# Add your own local bundler stuff
local_gemfile = File.dirname(__FILE__) + "/.Gemfile"
instance_eval File.read local_gemfile if File.exist? local_gemfile
diff --git a/Rakefile b/Rakefile
index 0737afd089..db27105cc3 100644
--- a/Rakefile
+++ b/Rakefile
@@ -11,7 +11,7 @@ task :build => "all:build"
desc "Release all gems to rubygems and create a tag"
task :release => "all:release"
-PROJECTS = %w(activesupport activemodel actionpack actionview actionmailer activerecord railties)
+PROJECTS = %w(activesupport activemodel actionpack actionview actionmailer activerecord railties activejob)
desc 'Run all tests by default'
task :default => %w(test test:isolated)
diff --git a/activejob/.gitignore b/activejob/.gitignore
deleted file mode 100644
index ee45263e91..0000000000
--- a/activejob/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/test/dummy/log/*
-/test/dummy/tmp/*
diff --git a/activejob/.travis.yml b/activejob/.travis.yml
deleted file mode 100644
index fba12f9d0d..0000000000
--- a/activejob/.travis.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-before_install:
-- travis_retry gem install bundler
-- sudo apt-get update -qq
-- sudo apt-get install beanstalkd
-- echo "START=yes" | sudo tee -a /etc/default/beanstalkd
-- sudo /etc/init.d/beanstalkd start
-
-rvm:
-- 1.9.3
-- 2.0.0
-- 2.1
-- ruby-head
-- rbx-2
-- jruby
-env:
-- QC_DATABASE_URL="postgres://postgres@localhost/active_jobs_qc_int_test" QUE_DATABASE_URL="postgres://postgres@localhost/active_jobs_qc_int_test"
-matrix:
- allow_failures:
- - rvm: rbx-2
- - rvm: jruby
- - rvm: ruby-head
- fast_finish: true
-notifications:
- email: false
- irc:
- on_success: change
- on_failure: always
- channels:
- - irc.freenode.org#rails-contrib
- campfire:
- on_success: change
- on_failure: always
- rooms:
- - secure: AgZwJA+9VdnWAw7QN9Z5s6RpQIzsEB0q7V+p3pCzXY45156WocL8iNQx+KnyOQ8jbRUt4L/XIOiZl5xHf4pHjXytHWHNhetAlVQP/hPeDcCSk/h0g5gqgf6QABdp38tBNaUq866bXHgCOZYPwwP9bypcmuv2SLyfIO+b/PBgqN0=
-services:
-- redis
-- rabbitmq
-addons:
- postgresql: "9.3"
diff --git a/activejob/Gemfile b/activejob/Gemfile
deleted file mode 100644
index 12a1798fd5..0000000000
--- a/activejob/Gemfile
+++ /dev/null
@@ -1,25 +0,0 @@
-source 'https://rubygems.org'
-
-gemspec
-
-gem 'rake'
-gem 'resque'
-gem 'resque-scheduler'
-gem 'sidekiq'
-gem 'sucker_punch'
-gem 'delayed_job'
-gem 'queue_classic'
-gem 'sneakers', '0.1.1.pre'
-gem 'que'
-gem 'backburner'
-gem 'qu-rails', github: "bkeepers/qu", branch: "master"
-gem 'qu-redis'
-
-#for integration testing
-gem 'arel', github: 'rails/arel'
-gem 'rack', github: 'rack/rack'
-gem 'i18n', github: 'svenfuchs/i18n'
-gem 'rails', github: 'rails/rails'
-gem 'sqlite3'
-gem 'delayed_job_active_record'
-gem 'sequel'
diff --git a/activejob/Gemfile.lock b/activejob/Gemfile.lock
deleted file mode 100644
index 53ba5c055b..0000000000
--- a/activejob/Gemfile.lock
+++ /dev/null
@@ -1,206 +0,0 @@
-GIT
- remote: git://github.com/bkeepers/qu.git
- revision: 50f3788f2b55ddd4dc939767fb35aebefa260322
- branch: master
- specs:
- qu (0.2.0)
- qu-rails (0.2.0)
- qu (= 0.2.0)
- railties (>= 3.2, < 5)
- qu-redis (0.2.0)
- qu (= 0.2.0)
- redis-namespace
-
-GIT
- remote: git://github.com/rack/rack.git
- revision: e98a9f7ef0ddd9589145ea953948c73a8ce3caa9
- specs:
- rack (1.6.0.alpha)
-
-GIT
- remote: git://github.com/rails/arel.git
- revision: 66cee768bc163537087037a583f60639eae49fc3
- specs:
- arel (6.0.0.20140505020427)
-
-GIT
- remote: git://github.com/rails/rails.git
- revision: b2e88043b52a8f83820a0f4e8a65aa42fd40c544
- specs:
- actionmailer (4.2.0.alpha)
- actionpack (= 4.2.0.alpha)
- actionview (= 4.2.0.alpha)
- mail (~> 2.5, >= 2.5.4)
- actionpack (4.2.0.alpha)
- actionview (= 4.2.0.alpha)
- activesupport (= 4.2.0.alpha)
- rack (~> 1.6.0.alpha)
- rack-test (~> 0.6.2)
- actionview (4.2.0.alpha)
- activesupport (= 4.2.0.alpha)
- builder (~> 3.1)
- erubis (~> 2.7.0)
- activemodel (4.2.0.alpha)
- activesupport (= 4.2.0.alpha)
- builder (~> 3.1)
- activerecord (4.2.0.alpha)
- activemodel (= 4.2.0.alpha)
- activesupport (= 4.2.0.alpha)
- arel (~> 6.0.0)
- activesupport (4.2.0.alpha)
- i18n (>= 0.7.0.dev, < 0.8)
- json (~> 1.7, >= 1.7.7)
- minitest (~> 5.1)
- thread_safe (~> 0.1)
- tzinfo (~> 1.1)
- rails (4.2.0.alpha)
- actionmailer (= 4.2.0.alpha)
- actionpack (= 4.2.0.alpha)
- actionview (= 4.2.0.alpha)
- activemodel (= 4.2.0.alpha)
- activerecord (= 4.2.0.alpha)
- activesupport (= 4.2.0.alpha)
- bundler (>= 1.3.0, < 2.0)
- railties (= 4.2.0.alpha)
- sprockets-rails (~> 2.1)
- railties (4.2.0.alpha)
- actionpack (= 4.2.0.alpha)
- activesupport (= 4.2.0.alpha)
- rake (>= 0.8.7)
- thor (>= 0.18.1, < 2.0)
-
-GIT
- remote: git://github.com/svenfuchs/i18n.git
- revision: cb679b8cdbab675703a3f88de4d48a48f7b50e06
- specs:
- i18n (0.7.0.dev)
-
-PATH
- remote: .
- specs:
- activejob (4.2.0.alpha)
- activemodel-globalid
- activesupport (>= 4.1.0)
-
-GEM
- remote: https://rubygems.org/
- specs:
- activemodel-globalid (0.1.1)
- activemodel (>= 4.1.0)
- activesupport (>= 4.1.0)
- amq-protocol (1.9.2)
- backburner (0.4.5)
- beaneater (~> 0.3.1)
- dante (~> 0.1.5)
- beaneater (0.3.2)
- builder (3.2.2)
- bunny (1.1.9)
- amq-protocol (>= 1.9.2)
- celluloid (0.15.2)
- timers (~> 1.1.0)
- connection_pool (2.0.0)
- dante (0.1.5)
- delayed_job (4.0.2)
- activesupport (>= 3.0, < 4.2)
- delayed_job_active_record (4.0.1)
- activerecord (>= 3.0, < 4.2)
- delayed_job (>= 3.0, < 4.1)
- erubis (2.7.0)
- hike (1.2.3)
- json (1.8.1)
- mail (2.6.1)
- mime-types (>= 1.16, < 3)
- mime-types (2.3)
- minitest (5.4.0)
- mono_logger (1.1.0)
- multi_json (1.10.1)
- pg (0.17.1)
- que (0.8.1)
- queue_classic (2.2.3)
- pg (~> 0.17.0)
- rack-protection (1.5.3)
- rack
- rack-test (0.6.2)
- rack (>= 1.0)
- rake (10.3.2)
- redis (3.1.0)
- redis-namespace (1.5.1)
- redis (~> 3.0, >= 3.0.4)
- resque (1.25.2)
- mono_logger (~> 1.0)
- multi_json (~> 1.0)
- redis-namespace (~> 1.3)
- sinatra (>= 0.9.2)
- vegas (~> 0.1.2)
- resque-scheduler (3.0.0)
- mono_logger (~> 1.0)
- redis (~> 3.0)
- resque (~> 1.25)
- rufus-scheduler (~> 2.0)
- rufus-scheduler (2.0.24)
- tzinfo (>= 0.3.22)
- sequel (4.8.0)
- serverengine (1.5.9)
- sigdump (~> 0.2.2)
- sidekiq (3.2.1)
- celluloid (>= 0.15.2)
- connection_pool (>= 2.0.0)
- json
- redis (>= 3.0.6)
- redis-namespace (>= 1.3.1)
- sigdump (0.2.2)
- sinatra (1.4.5)
- rack (~> 1.4)
- rack-protection (~> 1.4)
- tilt (~> 1.3, >= 1.3.4)
- sneakers (0.1.1.pre)
- bunny (~> 1.1.3)
- serverengine
- thor
- thread
- sprockets (2.12.1)
- hike (~> 1.2)
- multi_json (~> 1.0)
- rack (~> 1.0)
- tilt (~> 1.1, != 1.3.0)
- sprockets-rails (2.1.3)
- actionpack (>= 3.0)
- activesupport (>= 3.0)
- sprockets (~> 2.8)
- sqlite3 (1.3.9)
- sucker_punch (1.1)
- celluloid (~> 0.15.2)
- thor (0.19.1)
- thread (0.1.4)
- thread_safe (0.3.4)
- tilt (1.4.1)
- timers (1.1.0)
- tzinfo (1.2.1)
- thread_safe (~> 0.1)
- vegas (0.1.11)
- rack (>= 1.0.0)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- activejob!
- arel!
- backburner
- delayed_job
- delayed_job_active_record
- i18n!
- qu-rails!
- qu-redis
- que
- queue_classic
- rack!
- rails!
- rake
- resque
- resque-scheduler
- sequel
- sidekiq
- sneakers (= 0.1.1.pre)
- sqlite3
- sucker_punch
diff --git a/activejob/Rakefile b/activejob/Rakefile
index b2910de81d..e661622165 100644
--- a/activejob/Rakefile
+++ b/activejob/Rakefile
@@ -1,6 +1,7 @@
-require 'bundler/gem_tasks'
-
require 'rake/testtask'
+require 'rubygems/package_task'
+
+dir = File.dirname(__FILE__)
def run_without_aborting(*tasks)
errors = []
@@ -18,51 +19,66 @@ end
task default: :test
-ADAPTERS = %w(inline delayed_job qu que queue_classic resque sidekiq sneakers sucker_punch backburner)
+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 = ADAPTERS.map{|a| "test_#{a}" }+["integration_test"]
+ tasks = ACTIVEJOB_ADAPTERS.map{|a| "test_#{a}" }
run_without_aborting(*tasks)
end
-ADAPTERS.each do |adapter|
- Rake::TestTask.new("test_#{adapter}") do |t|
- t.libs << 'test'
- t.test_files = FileList['test/cases/**/*_test.rb']
- t.verbose = true
+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
- task "test_#{adapter}" => "#{adapter}:env"
-end
-
+ desc "Run #{adapter} tests"
+ task "test_#{adapter}" => ["#{adapter}:env", "test:#{adapter}"]
-desc 'Run all adapter integration tests'
-task :integration_test do
- tasks = (ADAPTERS-['inline']).map{|a| "integration_test_#{a}" }
- run_without_aborting(*tasks)
+ desc "Run #{adapter} tests in isolation"
+ task "isolated_test_#{adapter}" => ["#{adapter}:env", "test:isolated:#{adapter}"]
end
-(ADAPTERS-['inline']).each do |adapter|
- Rake::TestTask.new("integration_test_#{adapter}") do |t|
- t.libs << 'test'
- t.test_files = FileList['test/integration/**/*_test.rb']
- t.verbose = true
- end
- namespace "integration_#{adapter}" do
- task test: "integration_test_#{adapter}"
- task(:env) do
- ENV['AJADAPTER'] = adapter
- ENV['AJ_INTEGRATION_TESTS'] = "1"
- end
- end
+spec = eval(File.read('activejob.gemspec'))
+
+Gem::PackageTask.new(spec) do |p|
+ p.gem_spec = spec
+end
- task "integration_test_#{adapter}" => "integration_#{adapter}:env"
+desc 'Release to rubygems'
+task release: :package do
+ require 'rake/gemcutter'
+ Rake::Gemcutter::Tasks.new(spec).define
+ Rake::Task['gem:push'].invoke
end
diff --git a/activejob/test/cases/logging_test.rb b/activejob/test/cases/logging_test.rb
index 537702edd4..a4c010c7bd 100644
--- a/activejob/test/cases/logging_test.rb
+++ b/activejob/test/cases/logging_test.rb
@@ -1,5 +1,6 @@
require 'helper'
require "active_support/log_subscriber/test_helper"
+require 'jobs/hello_job'
require 'jobs/logging_job'
require 'jobs/nested_job'
diff --git a/activejob/test/dummy/Rakefile b/activejob/test/dummy/Rakefile
deleted file mode 100644
index 9866295e6a..0000000000
--- a/activejob/test/dummy/Rakefile
+++ /dev/null
@@ -1,3 +0,0 @@
-require 'sneakers/tasks'
-require File.expand_path('../config/application', __FILE__)
-Rails.application.load_tasks
diff --git a/activejob/test/dummy/app/assets/images/.keep b/activejob/test/dummy/app/assets/images/.keep
deleted file mode 100644
index e69de29bb2..0000000000
--- a/activejob/test/dummy/app/assets/images/.keep
+++ /dev/null
diff --git a/activejob/test/dummy/app/controllers/application_controller.rb b/activejob/test/dummy/app/controllers/application_controller.rb
deleted file mode 100644
index 1c07694e9d..0000000000
--- a/activejob/test/dummy/app/controllers/application_controller.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class ApplicationController < ActionController::Base
- protect_from_forgery with: :exception
-end
diff --git a/activejob/test/dummy/app/controllers/concerns/.keep b/activejob/test/dummy/app/controllers/concerns/.keep
deleted file mode 100644
index e69de29bb2..0000000000
--- a/activejob/test/dummy/app/controllers/concerns/.keep
+++ /dev/null
diff --git a/activejob/test/dummy/app/helpers/application_helper.rb b/activejob/test/dummy/app/helpers/application_helper.rb
deleted file mode 100644
index de6be7945c..0000000000
--- a/activejob/test/dummy/app/helpers/application_helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module ApplicationHelper
-end
diff --git a/activejob/test/dummy/app/jobs/test_job.rb b/activejob/test/dummy/app/jobs/test_job.rb
deleted file mode 100644
index 281771a851..0000000000
--- a/activejob/test/dummy/app/jobs/test_job.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class TestJob < ActiveJob::Base
- queue_as :default
-
- def perform(x)
- File.open(Rails.root.join("tmp/#{x}"), "w+") do |f|
- f.write x
- end
- end
-end
diff --git a/activejob/test/dummy/app/mailers/.keep b/activejob/test/dummy/app/mailers/.keep
deleted file mode 100644
index e69de29bb2..0000000000
--- a/activejob/test/dummy/app/mailers/.keep
+++ /dev/null
diff --git a/activejob/test/dummy/app/models/.keep b/activejob/test/dummy/app/models/.keep
deleted file mode 100644
index e69de29bb2..0000000000
--- a/activejob/test/dummy/app/models/.keep
+++ /dev/null
diff --git a/activejob/test/dummy/app/models/concerns/.keep b/activejob/test/dummy/app/models/concerns/.keep
deleted file mode 100644
index e69de29bb2..0000000000
--- a/activejob/test/dummy/app/models/concerns/.keep
+++ /dev/null
diff --git a/activejob/test/dummy/config.ru b/activejob/test/dummy/config.ru
deleted file mode 100644
index 5bc2a619e8..0000000000
--- a/activejob/test/dummy/config.ru
+++ /dev/null
@@ -1,4 +0,0 @@
-# This file is used by Rack-based servers to start the application.
-
-require ::File.expand_path('../config/environment', __FILE__)
-run Rails.application
diff --git a/activejob/test/dummy/config/application.rb b/activejob/test/dummy/config/application.rb
deleted file mode 100644
index 8b06039a68..0000000000
--- a/activejob/test/dummy/config/application.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require File.expand_path('../boot', __FILE__)
-require 'rails/all'
-Bundler.require(*Rails.groups)
-
-module Dummy
- class Application < Rails::Application
- end
-end
-
diff --git a/activejob/test/dummy/config/boot.rb b/activejob/test/dummy/config/boot.rb
deleted file mode 100644
index 6266cfc509..0000000000
--- a/activejob/test/dummy/config/boot.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# Set up gems listed in the Gemfile.
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
-
-require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
-$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
diff --git a/activejob/test/dummy/config/database.yml b/activejob/test/dummy/config/database.yml
deleted file mode 100644
index f5f3aaf1fa..0000000000
--- a/activejob/test/dummy/config/database.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-test:
- adapter: sqlite3
- database: "db/test.sqlite3"
diff --git a/activejob/test/dummy/config/environment.rb b/activejob/test/dummy/config/environment.rb
deleted file mode 100644
index 7fd2f91b8f..0000000000
--- a/activejob/test/dummy/config/environment.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require File.expand_path('../application', __FILE__)
-Rails.application.initialize!
diff --git a/activejob/test/dummy/config/environments/test.rb b/activejob/test/dummy/config/environments/test.rb
deleted file mode 100644
index ff0318412f..0000000000
--- a/activejob/test/dummy/config/environments/test.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-Rails.application.configure do
- config.cache_classes = true
- config.eager_load = false
- config.serve_static_assets = true
- config.static_cache_control = 'public, max-age=3600'
- config.consider_all_requests_local = true
- config.action_controller.perform_caching = false
- config.action_dispatch.show_exceptions = false
- config.action_controller.allow_forgery_protection = false
- config.action_mailer.delivery_method = :test
- config.active_support.deprecation = :stderr
- config.log_level = :debug
-end
diff --git a/activejob/test/dummy/config/initializers/activejob.rb b/activejob/test/dummy/config/initializers/activejob.rb
deleted file mode 100644
index 5fcde86c96..0000000000
--- a/activejob/test/dummy/config/initializers/activejob.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-case ENV['AJADAPTER']
-when "delayed_job"
- ActiveJob::Base.queue_adapter = :delayed_job
-when "sidekiq"
- ActiveJob::Base.queue_adapter = :sidekiq
-when "resque"
- ActiveJob::Base.queue_adapter = :resque
- Resque.redis = Redis::Namespace.new 'active_jobs_int_test', redis: Redis.connect(url: "tcp://127.0.0.1:6379/12", :thread_safe => true)
- Resque.logger = Rails.logger
-when 'qu'
- ActiveJob::Base.queue_adapter = :qu
- ENV['REDISTOGO_URL'] = "tcp://127.0.0.1:6379/12"
- backend = Qu::Backend::Redis.new
- backend.namespace = "active_jobs_int_test"
- Qu.backend = backend
- Qu.logger = Rails.logger
- Qu.interval = 0.5
-when 'que'
- ActiveJob::Base.queue_adapter = :que
- QUE_URL = ENV['QUE_DATABASE_URL'] || 'postgres://localhost/active_jobs_que_int_test'
- uri = URI.parse(QUE_URL)
- user = uri.user||ENV['USER']
- pass = uri.password
- db = uri.path[1..-1]
- %x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'drop database "#{db}"' -U #{user} -t template1}
- %x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'create database "#{db}"' -U #{user} -t template1}
- Que.connection = Sequel.connect(QUE_URL)
- Que.migrate!
- Que.mode = :off
- Que.worker_count = 1
-when 'queue_classic'
- ENV['QC_DATABASE_URL'] ||= 'postgres://localhost/active_jobs_qc_int_test'
- ENV['QC_LISTEN_TIME'] = "0.5"
- ActiveJob::Base.queue_adapter = :queue_classic
- uri = URI.parse(ENV['QC_DATABASE_URL'])
- user = uri.user||ENV['USER']
- pass = uri.password
- db = uri.path[1..-1]
- %x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'drop database "#{db}"' -U #{user} -t template1}
- %x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'create database "#{db}"' -U #{user} -t template1}
- QC::Setup.create
-when 'sidekiq'
- ActiveJob::Base.queue_adapter = :sidekiq
-when 'sneakers'
- ActiveJob::Base.queue_adapter = :sneakers
- Sneakers.configure :heartbeat => 2,
- :amqp => 'amqp://guest:guest@localhost:5672',
- :vhost => '/',
- :exchange => 'active_jobs_sneakers_int_test',
- :exchange_type => :direct,
- :daemonize => true,
- :threads => 1,
- :workers => 1,
- :pid_path => Rails.root.join("tmp/sneakers.pid").to_s,
- :log => Rails.root.join("log/sneakers.log").to_s
-when 'sucker_punch'
- ActiveJob::Base.queue_adapter = :sucker_punch
-when 'backburner'
- ActiveJob::Base.queue_adapter = :backburner
- Backburner.configure do |config|
- config.logger = Rails.logger
- end
-else
- ActiveJob::Base.queue_adapter = nil
-end
diff --git a/activejob/test/dummy/config/initializers/session_store.rb b/activejob/test/dummy/config/initializers/session_store.rb
deleted file mode 100644
index 70a5a506a9..0000000000
--- a/activejob/test/dummy/config/initializers/session_store.rb
+++ /dev/null
@@ -1 +0,0 @@
-Rails.application.config.session_store :cookie_store, key: '_dummy_session'
diff --git a/activejob/test/dummy/config/routes.rb b/activejob/test/dummy/config/routes.rb
deleted file mode 100644
index 1daf9a4121..0000000000
--- a/activejob/test/dummy/config/routes.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-Rails.application.routes.draw do
-end
diff --git a/activejob/test/dummy/config/secrets.yml b/activejob/test/dummy/config/secrets.yml
deleted file mode 100644
index 7dfacb38ea..0000000000
--- a/activejob/test/dummy/config/secrets.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-test:
- secret_key_base: b83ee5aeada663bc4270a1817d0ca43b2784017cc77dc8afcd60967cc968d4ce30caff9eb682766129e18a4048c4d5ebf14eabf463fc37ad67c18934f4345545
diff --git a/activejob/test/dummy/db/migrate/20140804200445_create_delayed_jobs.rb b/activejob/test/dummy/db/migrate/20140804200445_create_delayed_jobs.rb
deleted file mode 100644
index ec0dd93ce1..0000000000
--- a/activejob/test/dummy/db/migrate/20140804200445_create_delayed_jobs.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-class CreateDelayedJobs < ActiveRecord::Migration
- def self.up
- create_table :delayed_jobs, :force => true do |table|
- table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue
- table.integer :attempts, :default => 0, :null => false # Provides for retries, but still fail eventually.
- table.text :handler, :null => false # YAML-encoded string of the object that will do work
- table.text :last_error # reason for last failure (See Note below)
- table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
- table.datetime :locked_at # Set when a client is working on this object
- table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
- table.string :locked_by # Who is working on this object (if locked)
- table.string :queue # The name of the queue this job is in
- table.timestamps
- end
-
- add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
- end
-
- def self.down
- drop_table :delayed_jobs
- end
-end
diff --git a/activejob/test/dummy/db/schema.rb b/activejob/test/dummy/db/schema.rb
deleted file mode 100644
index 012a099f9c..0000000000
--- a/activejob/test/dummy/db/schema.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# encoding: UTF-8
-# This file is auto-generated from the current state of the database. Instead
-# of editing this file, please use the migrations feature of Active Record to
-# incrementally modify your database, and then regenerate this schema definition.
-#
-# Note that this schema.rb definition is the authoritative source for your
-# database schema. If you need to create the application database on another
-# system, you should be using db:schema:load, not running all the migrations
-# from scratch. The latter is a flawed and unsustainable approach (the more migrations
-# you'll amass, the slower it'll run and the greater likelihood for issues).
-#
-# It's strongly recommended that you check this file into your version control system.
-
-ActiveRecord::Schema.define(version: 20140804200445) do
-
- create_table "delayed_jobs", force: true do |t|
- t.integer "priority", default: 0, null: false
- t.integer "attempts", default: 0, null: false
- t.text "handler", null: false
- t.text "last_error"
- t.datetime "run_at"
- t.datetime "locked_at"
- t.datetime "failed_at"
- t.string "locked_by"
- t.string "queue"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority"
-
-end
diff --git a/activejob/test/dummy/db/test.sqlite3 b/activejob/test/dummy/db/test.sqlite3
deleted file mode 100644
index 671e20102e..0000000000
--- a/activejob/test/dummy/db/test.sqlite3
+++ /dev/null
Binary files differ
diff --git a/activejob/test/dummy/lib/assets/.keep b/activejob/test/dummy/lib/assets/.keep
deleted file mode 100644
index e69de29bb2..0000000000
--- a/activejob/test/dummy/lib/assets/.keep
+++ /dev/null
diff --git a/activejob/test/dummy/log/.keep b/activejob/test/dummy/log/.keep
deleted file mode 100644
index e69de29bb2..0000000000
--- a/activejob/test/dummy/log/.keep
+++ /dev/null
diff --git a/activejob/test/dummy/tmp/.keep b/activejob/test/dummy/tmp/.keep
deleted file mode 100644
index e69de29bb2..0000000000
--- a/activejob/test/dummy/tmp/.keep
+++ /dev/null
diff --git a/activejob/test/helper.rb b/activejob/test/helper.rb
index 104dabd861..ad263c05cd 100644
--- a/activejob/test/helper.rb
+++ b/activejob/test/helper.rb
@@ -6,13 +6,8 @@ $LOAD_PATH << File.dirname(__FILE__) + "/../lib"
require 'active_job'
adapter = ENV['AJADAPTER'] || 'inline'
-puts "Testing#{" integration" if ENV['AJ_INTEGRATION_TESTS']} using #{adapter}"
-if ENV['AJ_INTEGRATION_TESTS']
- require 'support/integration/helper'
-else
- require "adapters/#{adapter}"
-end
+require "adapters/#{adapter}"
require 'active_support/testing/autorun'
diff --git a/activejob/test/integration/queuing_test.rb b/activejob/test/integration/queuing_test.rb
deleted file mode 100644
index bf6137af4c..0000000000
--- a/activejob/test/integration/queuing_test.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require 'helper'
-require 'jobs/logging_job'
-require 'active_support/core_ext/numeric/time'
-
-
-class QueuingTest < ActiveSupport::TestCase
- setup do
-
- end
-
- test 'run queued job' do
- id = "AJ-#{SecureRandom.uuid}"
- TestJob.enqueue id
- sleep 2
- assert Dummy::Application.root.join("tmp/#{id}").exist?
- end
-
-end
diff --git a/activejob/test/support/integration/adapters/backburner.rb b/activejob/test/support/integration/adapters/backburner.rb
deleted file mode 100644
index 7271d50a45..0000000000
--- a/activejob/test/support/integration/adapters/backburner.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-module BackburnerJobsManager
- def clear_jobs
- Backburner::Worker.connection.tubes.all.map &:clear
- end
-
- def start_workers
- @thread = Thread.new { Backburner.work "active-jobs-default" }
- end
-
- def stop_workers
- @thread.kill
- end
-
-end
-
diff --git a/activejob/test/support/integration/adapters/delayed_job.rb b/activejob/test/support/integration/adapters/delayed_job.rb
deleted file mode 100644
index 3e55933438..0000000000
--- a/activejob/test/support/integration/adapters/delayed_job.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-module DelayedJobJobsManager
- def clear_jobs
- Delayed::Job.delete_all
- end
-
- def start_workers
- @worker = Delayed::Worker.new(quiet: false, sleep_delay: 0.5)
- @thread = Thread.new { @worker.start }
- end
-
- def stop_workers
- @worker.stop
- end
-end
diff --git a/activejob/test/support/integration/adapters/qu.rb b/activejob/test/support/integration/adapters/qu.rb
deleted file mode 100644
index 12d063ea0d..0000000000
--- a/activejob/test/support/integration/adapters/qu.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-module QuJobsManager
- def clear_jobs
- Qu.clear "active_jobs_default"
- end
-
- def start_workers
- @thread = Thread.new { Qu::Worker.new("active_jobs_default").start }
- end
-
- def stop_workers
- @thread.kill
- end
-end
-
diff --git a/activejob/test/support/integration/adapters/que.rb b/activejob/test/support/integration/adapters/que.rb
deleted file mode 100644
index f15c9af910..0000000000
--- a/activejob/test/support/integration/adapters/que.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-module QueJobsManager
- def clear_jobs
- Que.clear!
- end
-
- def start_workers
- @thread = Thread.new do
- loop do
- Que::Job.work("active_jobs_default")
- sleep 0.5
- end
- end
- end
-
- def stop_workers
- @thread.kill
- end
-end
-
diff --git a/activejob/test/support/integration/adapters/queue_classic.rb b/activejob/test/support/integration/adapters/queue_classic.rb
deleted file mode 100644
index 3b24eca5b9..0000000000
--- a/activejob/test/support/integration/adapters/queue_classic.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-module QC; WAIT_TIME = 0.5; end
-
-module QueueClassicJobsManager
- def clear_jobs
- # disabling this as it locks
- # QC::Queue.new("active_jobs_default").delete_all
- end
-
- def start_workers
- @pid = fork do
- QC::Conn.connection = QC::Conn.connect
- worker = QC::Worker.new(q_name: 'active_jobs_default')
- worker.start
- end
- end
-
- def stop_workers
- Process.kill 'HUP', @pid
- end
-end
-
diff --git a/activejob/test/support/integration/adapters/resque.rb b/activejob/test/support/integration/adapters/resque.rb
deleted file mode 100644
index b9811bd3e1..0000000000
--- a/activejob/test/support/integration/adapters/resque.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-module ResqueJobsManager
- def clear_jobs
- Resque.queues.each { |queue_name| Resque.redis.del "queue:#{queue_name}" }
- Resque.redis.keys("delayed:*").each { |key| Resque.redis.del "#{key}" }
- Resque.redis.del "delayed_queue_schedule"
- end
-
- def start_workers
- @thread = Thread.new do
- Resque::Worker.new("*").work(0.5)
- end
- end
-
- def stop_workers
- @thread.kill
- end
-end
-
diff --git a/activejob/test/support/integration/adapters/sidekiq.rb b/activejob/test/support/integration/adapters/sidekiq.rb
deleted file mode 100644
index d3b7d15614..0000000000
--- a/activejob/test/support/integration/adapters/sidekiq.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-require 'sidekiq/launcher'
-require 'sidekiq/api'
-
-module SidekiqJobsManager
- def clear_jobs
- Sidekiq::Queue.new("active_jobs_default").clear
- end
-
- def start_workers
- options = {:queues=>["active_jobs_default"], :concurrency=>1, :environment=>"test", :timeout=>8, :daemon=>true, :strict=>true}
- @launcher = Sidekiq::Launcher.new(options)
- @launcher.run
- end
-
- def stop_workers
- @launcher.stop
- end
-end
-
diff --git a/activejob/test/support/integration/adapters/sneakers.rb b/activejob/test/support/integration/adapters/sneakers.rb
deleted file mode 100644
index 5dcab68515..0000000000
--- a/activejob/test/support/integration/adapters/sneakers.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require 'sneakers/runner'
-
-module SneakersJobsManager
- def clear_jobs
- end
-
- def start_workers
- cmd = %{cd #{Rails.root.to_s} && (RAILS_ENV=test AJADAPTER=sneakers WORKERS=ActiveJob::QueueAdapters::SneakersAdapter::JobWrapper bundle exec rake --trace sneakers:run)}
- `#{cmd}`
- while !Rails.root.join("tmp/sneakers.pid").exist? do
- sleep 0.5
- end
- end
-
- def stop_workers
- Process.kill 'TERM', File.open(Rails.root.join("tmp/sneakers.pid").to_s).read.to_i
- end
-end
diff --git a/activejob/test/support/integration/adapters/sucker_punch.rb b/activejob/test/support/integration/adapters/sucker_punch.rb
deleted file mode 100644
index 317f9c80fd..0000000000
--- a/activejob/test/support/integration/adapters/sucker_punch.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-module SuckerPunchJobsManager
- def clear_jobs
- end
-end
-
diff --git a/activejob/test/support/integration/helper.rb b/activejob/test/support/integration/helper.rb
deleted file mode 100644
index cb94e7cfb5..0000000000
--- a/activejob/test/support/integration/helper.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-ENV["RAILS_ENV"] = "test"
-require File.expand_path("../../../dummy/config/environment.rb", __FILE__)
-require "rails/test_help"
-Rails.backtrace_cleaner.remove_silencers!
-
-require_relative 'test_case_helpers'
-ActiveSupport::TestCase.send(:include, TestCaseHelpers)
-
-JobsManager.current_manager.setup
-JobsManager.current_manager.start_workers
-Minitest.after_run { JobsManager.current_manager.stop_workers }
-
diff --git a/activejob/test/support/integration/jobs_manager.rb b/activejob/test/support/integration/jobs_manager.rb
deleted file mode 100644
index 1da74193b1..0000000000
--- a/activejob/test/support/integration/jobs_manager.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-class JobsManager
- @@managers = {}
- attr :adapter_name
-
- def self.current_manager
- @@managers[ENV['AJADAPTER']] ||= new(ENV['AJADAPTER'])
- end
-
- def initialize(adapter_name)
- @adapter_name = adapter_name
- require_relative "adapters/#{adapter_name}"
- extend "#{adapter_name.camelize}JobsManager".constantize
- end
-
- def setup
- end
-
- def start_workers
- end
-
- def stop_workers
- end
-end
diff --git a/activejob/test/support/integration/test_case_helpers.rb b/activejob/test/support/integration/test_case_helpers.rb
deleted file mode 100644
index 9a5eea0783..0000000000
--- a/activejob/test/support/integration/test_case_helpers.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-require 'active_support/concern'
-require 'support/integration/jobs_manager'
-
-module TestCaseHelpers
- extend ActiveSupport::Concern
-
- included do
- self.use_transactional_fixtures = false
-
- setup do
- clear_jobs
- end
-
- teardown do
- clear_jobs
- FileUtils.rm_rf Dir[Dummy::Application.root.join("tmp/AJ-*")]
- end
- end
-
- protected
-
- def jobs_manager
- JobsManager.current_manager
- end
-
- def clear_jobs
- jobs_manager.clear_jobs
- end
-
-end
diff --git a/rails.gemspec b/rails.gemspec
index 4800df0df4..b1a7d16722 100644
--- a/rails.gemspec
+++ b/rails.gemspec
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
s.add_dependency 'activemodel', version
s.add_dependency 'activerecord', version
s.add_dependency 'actionmailer', version
+ s.add_dependency 'activejob', version
s.add_dependency 'railties', version
s.add_dependency 'bundler', '>= 1.3.0', '< 2.0'
diff --git a/railties/lib/rails/all.rb b/railties/lib/rails/all.rb
index 2e83c0fe14..45361fca83 100644
--- a/railties/lib/rails/all.rb
+++ b/railties/lib/rails/all.rb
@@ -5,6 +5,7 @@ require "rails"
action_controller
action_view
action_mailer
+ active_job
rails/test_unit
sprockets
).each do |framework|
diff --git a/tasks/release.rb b/tasks/release.rb
index 767feaf236..de05dfad99 100644
--- a/tasks/release.rb
+++ b/tasks/release.rb
@@ -1,4 +1,4 @@
-FRAMEWORKS = %w( activesupport activemodel activerecord actionview actionpack actionmailer railties )
+FRAMEWORKS = %w( activesupport activemodel activerecord actionview actionpack actionmailer railties activejob )
root = File.expand_path('../../', __FILE__)
version = File.read("#{root}/RAILS_VERSION").strip