aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2014-05-19 09:47:55 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2014-05-19 10:15:19 +0200
commitfd1e61adfc40275fe23fdcbc7796f7a72bf12fa3 (patch)
tree28363f61366d31ca8a434ec8ef30c1389ee36516
parentd7c30987ff83e1ab02f3ba981f5c0027e674583f (diff)
downloadrails-fd1e61adfc40275fe23fdcbc7796f7a72bf12fa3.tar.gz
rails-fd1e61adfc40275fe23fdcbc7796f7a72bf12fa3.tar.bz2
rails-fd1e61adfc40275fe23fdcbc7796f7a72bf12fa3.zip
Dont need the explicit error handling -- if the require fails, it will raise exactly the error we want to communicate anyway. Also use the load path, so we can allow plugins, rather than requre_relative
-rw-r--r--lib/active_job/base.rb16
-rw-r--r--lib/active_job/errors.rb12
2 files changed, 2 insertions, 26 deletions
diff --git a/lib/active_job/base.rb b/lib/active_job/base.rb
index f39dba6f5f..86008d3c94 100644
--- a/lib/active_job/base.rb
+++ b/lib/active_job/base.rb
@@ -1,9 +1,7 @@
-require 'active_job/errors'
require 'active_job/queue_adapters/inline_adapter'
require 'active_support/core_ext/string/inflections'
module ActiveJob
-
class Base
cattr_accessor(:queue_adapter) { ActiveJob::QueueAdapters::InlineAdapter }
cattr_accessor(:queue_base_name) { "active_jobs" }
@@ -19,19 +17,9 @@ module ActiveJob
end
def adapter=(adapter_name)
- adapter_name = adapter_name.to_s
- unless %w(inline resque sidekiq sucker_punch).include?(adapter_name)
- fail ActiveJob::NotImplementedError
- end
-
- begin
- require_relative "queue_adapters/#{adapter_name}_adapter"
- ActiveJob::Base.queue_adapter = "ActiveJob::QueueAdapters::#{adapter_name.camelize}Adapter".constantize
- rescue
- fail ActiveJob::Error.new("#{adapter_name} is missing")
- end
+ require "active_job/queue_adapters/#{adapter_name}_adapter"
+ ActiveJob::Base.queue_adapter = "ActiveJob::QueueAdapters::#{adapter_name.to_s.camelize}Adapter".constantize
end
end
-
end
end \ No newline at end of file
diff --git a/lib/active_job/errors.rb b/lib/active_job/errors.rb
deleted file mode 100644
index 4fc3be6878..0000000000
--- a/lib/active_job/errors.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-module ActiveJob
-
- class NotImplementedError < ::NotImplementedError #:nodoc:
- end
-
- class Error < ::StandardError #:nodoc:
- def initialize(message = nil)
- super(message)
- end
- end
-
-end \ No newline at end of file