Sha256: 4e7d08161047642f2e8700916dadeaa6dc727345c030725578e928be8ab4faca

Contents?: true

Size: 805 Bytes

Versions: 3

Compression:

Stored size: 805 Bytes

Contents

module SyncMachine
  # Initialize SyncMachine inside a Rails application.
  class Railtie < Rails::Railtie
    initializer :sync_machine do
      Module.const_defined?(:ActiveRecord) && \
        require("sync_machine/orm_adapters/active_record_adapter")
      Module.const_defined?(:Mongoid) && \
        require("sync_machine/orm_adapters/mongoid_adapter")
      if Module.const_defined?(:OpenTracing)
        begin
          require 'sidekiq-opentracing'
        rescue LoadError
          SyncMachine.abort_with_installation_hint(
            'sfx-sidekiq-opentracing', 'OpenTracing'
          )
        end
      end
    end

    config.after_initialize do
      if Module.const_defined?(:OpenTracing)
        Sidekiq::Tracer.instrument(tracer: OpenTracing.global_tracer)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sync_machine-1.4.0 lib/sync_machine/railtie.rb
sync_machine-1.3.0 lib/sync_machine/railtie.rb
sync_machine-1.2.0 lib/sync_machine/railtie.rb