Sha256: e12cb612be8530c3b32e4668aac7540d80412cfbd9b9d3ac5729bd1627df9009

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'active_support/core_ext/object'
require 'backgrounder/support/backends'
require 'backgrounder/orm/base'
require 'backgrounder/delay'

module CarrierWave
  module Backgrounder
    include Support::Backends

    class UnsupportedBackendError < StandardError ; end
    class TooManyBackendsAvailableError < StandardError ; end

    def self.configure
      yield self
      case @backend
      when :sidekiq
        ::CarrierWave::Workers::ProcessAsset.class_eval do
          require 'sidekiq'
          include ::Sidekiq::Worker
        end
        ::CarrierWave::Workers::StoreAsset.class_eval do
          require 'sidekiq'
          include ::Sidekiq::Worker
        end
      when :sucker_punch
        ::CarrierWave::Workers::ProcessAsset.class_eval do
          require 'sucker_punch'
          include ::SuckerPunch::Worker
        end
        ::CarrierWave::Workers::StoreAsset.class_eval do
          require 'sucker_punch'
          include ::SuckerPunch::Worker
        end
      end
    end

  end
end

require 'backgrounder/railtie' if defined?(Rails)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
carrierwave_backgrounder-0.2.1 lib/carrierwave_backgrounder.rb