Sha256: 0f0cc37988d94e2ef6aef06ca3a1327a18e7c0bbb908eb8937a111bc68d66495

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

require_relative './railtie'

require 'active_support'
require 'rails_cloud_tasks/rack/errors'

module RailsCloudTasks
  extend ActiveSupport::Autoload

  autoload :Scheduler
  autoload :Credentials
  autoload :Adapter
  autoload :AppEngine
  autoload :Configuration
  autoload :Version
  autoload :Instrumentation

  module Rack
    extend ActiveSupport::Autoload

    autoload :Jobs
    autoload :Tasks
  end

  attr_writer :config

  def self.configure
    yield(config)
  end

  def self.config
    @config ||= Configuration.new
  end

  def self.logger
    return @logger if @logger

    @logger ||= (Rails.logger || Logger.new($stdout)).tap do |logger|
      logger.formatter = proc do |severity, datetime, _progname, msg|
        "[#{datetime}] #{severity} [rails-cloud-tasks]: #{msg}\n"
      end
    end
  end

  @queue_adapter = nil

  def queue_adapter
    @@queue_adapter
  end

  def self.queue_adapter
    @queue_adapter ||= Adapter.new
  rescue StandardError => e
    raise e unless Rails.env.development?

    logger.warn('unable to setup adapter, falling back to :inline')
    logger.warn(e)

    :inline
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rails-cloud-tasks-0.0.10 lib/rails-cloud-tasks.rb
rails-cloud-tasks-0.0.9 lib/rails-cloud-tasks.rb
rails-cloud-tasks-0.0.9.pre.rc lib/rails-cloud-tasks.rb
rails-cloud-tasks-0.0.8 lib/rails-cloud-tasks.rb
rails-cloud-tasks-0.0.7 lib/rails-cloud-tasks.rb
rails-cloud-tasks-0.0.7.pre.rc lib/rails-cloud-tasks.rb
rails-cloud-tasks-0.0.6 lib/rails-cloud-tasks.rb
rails-cloud-tasks-0.0.5 lib/rails-cloud-tasks.rb
rails-cloud-tasks-0.0.4rc2 lib/rails-cloud-tasks.rb
rails-cloud-tasks-0.0.4.rc1 lib/rails-cloud-tasks.rb
rails-cloud-tasks-0.0.3 lib/rails-cloud-tasks.rb