Skip to content

Commit

Permalink
Removed deprecated adapters.
Browse files Browse the repository at this point in the history
  • Loading branch information
morgoth committed Jul 18, 2016
1 parent 34592cf commit cc410bc
Show file tree
Hide file tree
Showing 16 changed files with 15 additions and 297 deletions.
1 change: 1 addition & 0 deletions delayed_paperclip.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Gem::Specification.new do |s|
s.homepage = %q{http://github.com/jrgifford/delayed_paperclip}

s.add_dependency 'paperclip', [">= 3.3"]
s.add_dependency 'activejob', ">= 4.2"

s.add_development_dependency 'mocha'
s.add_development_dependency "rspec", '< 3.0'
Expand Down
12 changes: 2 additions & 10 deletions lib/delayed_paperclip.rb
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
require 'delayed_paperclip/jobs'
require 'delayed_paperclip/jobs/active_job'
require 'delayed_paperclip/attachment'
require 'delayed_paperclip/url_generator'
require 'delayed_paperclip/railtie'

module DelayedPaperclip

class << self

def options
@options ||= {
:background_job_class => detect_background_task,
:background_job_class => DelayedPaperclip::Jobs::ActiveJob,
:url_with_processing => true,
:processing_image_url => nil,
:queue => "paperclip"
}
end

def detect_background_task
return DelayedPaperclip::Jobs::ActiveJob if defined? ::ActiveJob::Base
return DelayedPaperclip::Jobs::DelayedJob if defined? ::Delayed::Job
return DelayedPaperclip::Jobs::Resque if defined? ::Resque
return DelayedPaperclip::Jobs::Sidekiq if defined? ::Sidekiq
end

def processor
options[:background_job_class]
end
Expand Down
8 changes: 0 additions & 8 deletions lib/delayed_paperclip/jobs.rb

This file was deleted.

46 changes: 0 additions & 46 deletions lib/delayed_paperclip/jobs/delayed_job.rb

This file was deleted.

22 changes: 0 additions & 22 deletions lib/delayed_paperclip/jobs/resque.rb

This file was deleted.

30 changes: 0 additions & 30 deletions lib/delayed_paperclip/jobs/sidekiq.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/delayed_paperclip/attachment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe DelayedPaperclip::Attachment do
before :each do
DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::Resque
DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::ActiveJob
reset_dummy(dummy_options)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/delayed_paperclip/class_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe DelayedPaperclip::ClassMethods do
before :each do
DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::Resque
DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::ActiveJob
reset_dummy(with_processed: false)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/delayed_paperclip/instance_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe DelayedPaperclip::InstanceMethods do
before :each do
DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::Resque
DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::ActiveJob
reset_dummy
end

Expand Down
2 changes: 1 addition & 1 deletion spec/delayed_paperclip/url_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe DelayedPaperclip::UrlGenerator do
before :each do
DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::Resque
DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::ActiveJob
reset_dummy(dummy_options)
end

Expand Down
8 changes: 4 additions & 4 deletions spec/delayed_paperclip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

context "with Resque adapter" do
before :each do
DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::Resque
DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::ActiveJob
end

describe ".options" do
it ".options returns basic options" do
DelayedPaperclip.options.should == {:background_job_class => DelayedPaperclip::Jobs::Resque,
DelayedPaperclip.options.should == {:background_job_class => DelayedPaperclip::Jobs::ActiveJob,
:url_with_processing => true,
:processing_image_url => nil,
:queue => "paperclip"}
Expand All @@ -22,13 +22,13 @@

describe ".processor" do
it ".processor returns processor" do
DelayedPaperclip.processor.should == DelayedPaperclip::Jobs::Resque
DelayedPaperclip.processor.should == DelayedPaperclip::Jobs::ActiveJob
end
end

describe ".enqueue" do
it "delegates to processor" do
DelayedPaperclip::Jobs::Resque.expects(:enqueue_delayed_paperclip).with("Dummy", 1, :image)
DelayedPaperclip::Jobs::ActiveJob.expects(:enqueue_delayed_paperclip).with("Dummy", 1, :image)
DelayedPaperclip.enqueue("Dummy", 1, :image)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/base_delayed_paperclip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe "Base Delayed Paperclip Integration" do
before :each do
DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::Resque
DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::ActiveJob
Resque.remove_queue(:paperclip)
end

Expand Down
63 changes: 0 additions & 63 deletions spec/integration/delayed_job_spec.rb

This file was deleted.

47 changes: 0 additions & 47 deletions spec/integration/resque_spec.rb

This file was deleted.

54 changes: 0 additions & 54 deletions spec/integration/sidekiq_spec.rb

This file was deleted.

Loading

0 comments on commit cc410bc

Please sign in to comment.