diff options
-rw-r--r-- | Gemfile | 1 | ||||
-rw-r--r-- | Gemfile.lock | 2 | ||||
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | Rakefile | 22 |
4 files changed, 14 insertions, 22 deletions
@@ -2,6 +2,7 @@ source 'https://rubygems.org' gemspec +gem 'rake' gem 'resque' gem 'sidekiq' gem 'sucker_punch' diff --git a/Gemfile.lock b/Gemfile.lock index 1d86563133..849ccf6634 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,6 +34,7 @@ GEM rack (1.5.2) rack-protection (1.5.2) rack + rake (10.3.2) redis (3.0.7) redis-namespace (1.4.1) redis (~> 3.0.4) @@ -69,6 +70,7 @@ PLATFORMS DEPENDENCIES activejob! delayed_job + rake resque sidekiq sucker_punch @@ -10,6 +10,13 @@ that makes it easy to turn any mailing into a job for running later. That's one of the most common jobs in a modern web application: Sending emails outside of the request-response cycle, so the user doesn't have to wait on it. +The main point is to ensure that all Rails apps will have a job infrastructure +in place, even if it's in the form of an "immediate runner". We can then have +framework features and other gems build on top of that, without having to worry +about API differences between Delayed Job and Resque. Picking your queuing +backend becomes more of an operational concern, then. And you'll be able to +switch between them without having to rewrite your jobs. + ## Usage @@ -40,7 +47,7 @@ you then have to manually deserialize. Before, jobs would look like this: ```ruby class TrashableCleanupJob - def perfom(trashable_class, trashable_id, depth) + def perform(trashable_class, trashable_id, depth) trashable = trashable_class.constantize.find(trashable_id) trashable.cleanup(depth) end @@ -51,7 +58,7 @@ Now you can simply do: ```ruby class TrashableCleanupJob - def perfom(trashable, depth) + def perform(trashable, depth) trashable.cleanup(depth) end end @@ -1,4 +1,4 @@ -dir = File.dirname(__FILE__) +require 'bundler/gem_tasks' require 'rake/testtask' @@ -16,8 +16,6 @@ def run_without_aborting(*tasks) abort "Errors running #{errors.join(', ')}" if errors.any? end - - task :default => :test desc 'Run all adapter tests' @@ -26,8 +24,7 @@ task :test do run_without_aborting(*tasks) end - -%w( inline resque sidekiq sucker_punch delayed_job).each do |adapter| +%w(inline resque sidekiq sucker_punch delayed_job).each do |adapter| Rake::TestTask.new("test_#{adapter}") do |t| t.libs << 'test' t.test_files = FileList['test/cases/**/*_test.rb'] @@ -41,18 +38,3 @@ end task "test_#{adapter}" => "#{adapter}:env" end - -require 'rubygems/package_task' - -spec = eval(File.read("#{dir}/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 |