Permalink
Browse files

Merge pull request #37 from Aesthetikx/master

Add Sneakers wrapper
  • Loading branch information...
guilleiguaran committed May 20, 2014
2 parents c6925f5 + 1b71fe5 commit 3a233d087a4221ad8822f70e2ae289ef7e543985
Showing with 55 additions and 5 deletions.
  1. +1 −0 Gemfile
  2. +14 −0 Gemfile.lock
  3. +0 −3 README.md
  4. +2 −2 Rakefile
  5. +24 −0 lib/active_job/queue_adapters/sneakers_adapter.rb
  6. +2 −0 test/adapters/sneakers.rb
  7. +12 −0 test/support/sneakers/inline.rb
View
@@ -8,3 +8,4 @@ gem 'sidekiq'
gem 'sucker_punch'
gem 'delayed_job'
gem 'queue_classic'
gem 'sneakers', '0.1.1.pre'
View
@@ -20,7 +20,10 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
amq-protocol (1.9.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)
@@ -47,18 +50,28 @@ GEM
redis-namespace (~> 1.2)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
serverengine (1.5.7)
sigdump (~> 0.2.2)
sidekiq (3.0.2)
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.4)
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
sucker_punch (1.0.5)
celluloid (~> 0.15.2)
thor (0.19.1)
thread (0.1.4)
thread_safe (0.3.3)
tilt (1.4.1)
timers (1.1.0)
@@ -77,4 +90,5 @@ DEPENDENCIES
rake
resque
sidekiq
sneakers (= 0.1.1.pre)
sucker_punch
View
@@ -84,9 +84,6 @@ We currently have adapters for:
* Sucker Punch
* Delayed Job
* QueueClassic
We would like to have adapters for:
* Sneakers
View
@@ -20,11 +20,11 @@ task :default => :test
desc 'Run all adapter tests'
task :test do
tasks = %w(test_inline test_resque test_sidekiq test_sucker_punch test_delayed_job test_queue_classic)
tasks = %w(test_inline test_resque test_sidekiq test_sucker_punch test_delayed_job test_queue_classic test_sneakers)
run_without_aborting(*tasks)
end
%w(inline resque sidekiq sucker_punch delayed_job queue_classic).each do |adapter|
%w(inline resque sidekiq sucker_punch delayed_job queue_classic sneakers).each do |adapter|
Rake::TestTask.new("test_#{adapter}") do |t|
t.libs << 'test'
t.test_files = FileList['test/cases/**/*_test.rb']
@@ -0,0 +1,24 @@
require 'sneakers'
module ActiveJob
module QueueAdapters
class SneakersAdapter
class << self
def queue(job, *args)
JobWrapper.enqueue([job, *args])
end
end
class JobWrapper
include Sneakers::Worker
self.from_queue("queue", {})
def work(*args)
job_name = args.shift
job_name.new.perform *Parameters.deserialize(args)
end
end
end
end
end
@@ -0,0 +1,2 @@
require 'support/sneakers/inline'
ActiveJob::Base.queue_adapter = :sneakers
@@ -0,0 +1,12 @@
require 'sneakers'
module Sneakers
module Worker
module ClassMethods
def enqueue(msg)
worker = self.new(nil, nil, {})
worker.work(*msg)
end
end
end
end

0 comments on commit 3a233d0

Please sign in to comment.