Sha256: 5df9666fe6ac2283cbcfdd81b143f8c39a9009acfd36212180da5be96f8a08e9

Contents?: true

Size: 1.23 KB

Versions: 9

Compression:

Stored size: 1.23 KB

Contents

module ResqueBus
  module Deprecated
    def show_deprecations=val
      @show_deprecations = val
    end

    def show_deprecations?
      return @show_deprecations if defined?(@show_deprecations)
      return true if !ENV['QUEUES'] && !ENV['QUEUE'] # not in background, probably test
      return true if ENV['VVERBOSE'] || ENV['LOGGING'] || ENV['VERBOSE']
      false
    end
    
    def note_deprecation(message)
      @noted_deprecations ||= {}
      if @noted_deprecations[message]
        @noted_deprecations[message] += 1
      else
        warn(message) if show_deprecations?
        @noted_deprecations[message] = 1
      end
    end

    def redis
      ResqueBus.note_deprecation "[DEPRECATION] ResqueBus direct usage is deprecated. Use `QueueBus.redis` instead. Note that it also requires block usage now."
      ::Resque.redis
    end

    def redis=val
      ResqueBus.note_deprecation "[DEPRECATION] ResqueBus can no longer set redis directly. It will use Resque's instance of redis."
    end

    def method_missing(method_name, *args, &block)
      ResqueBus.note_deprecation "[DEPRECATION] ResqueBus direct usage is deprecated. Use `QueueBus.#{method_name}` instead."
      ::QueueBus.send(method_name, *args, &block)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
resque-bus-0.7.0 lib/resque_bus/compatibility/deprecated.rb
resque-bus-0.6.1 lib/resque_bus/compatibility/deprecated.rb
resque-bus-0.6.0 lib/resque_bus/compatibility/deprecated.rb
resque-bus-0.5.12 lib/resque_bus/compatibility/deprecated.rb
resque-bus-0.5.11 lib/resque_bus/compatibility/deprecated.rb
resque-bus-0.5.10 lib/resque_bus/compatibility/deprecated.rb
resque-bus-0.5.9 lib/resque_bus/compatibility/deprecated.rb
resque-bus-0.5.8 lib/resque_bus/compatibility/deprecated.rb
resque-bus-0.5.7 lib/resque_bus/compatibility/deprecated.rb