Class: TalkToYourApp::Plugins::Jobs::Plugin
- Inherits:
-
TalkToYourApp::Plugin
- Object
- TalkToYourApp::Plugin
- TalkToYourApp::Plugins::Jobs::Plugin
- Defined in:
- lib/talk_to_your_app/plugins/jobs/plugin.rb
Class Method Summary collapse
Methods inherited from TalkToYourApp::Plugin
log_level, requires_connection, requires_gem, tools
Class Method Details
.validate_enablement!(options) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/talk_to_your_app/plugins/jobs/plugin.rb', line 48 def self.validate_enablement!() adapter_name = [:adapter] if adapter_name.nil? raise ConfigurationError, "talk_to_your_app: the jobs plugin requires an `adapter:` option, e.g. " \ "`config.plugin :jobs, adapter: :sidekiq`." end adapter = Jobs.adapter_for(adapter_name) unless adapter raise ConfigurationError, "talk_to_your_app: jobs adapter #{adapter_name.inspect} is not supported. " \ "Available adapters: #{Jobs.known_adapter_names.inspect}." end req = adapter.required_gem if req && !Object.const_defined?(req[:const]) raise ConfigurationError, "talk_to_your_app: jobs adapter #{adapter_name.inspect} requires the `#{req[:gem_name]}` gem " \ "(constant #{req[:const]} is not defined)." end unless Interface.satisfied_by?(adapter) raise ConfigurationError, "talk_to_your_app: jobs adapter #{adapter_name.inspect} does not implement the full interface " \ "(#{Interface::METHODS.join(", ")})." end end |