Sha256: 5050e04f01854cc8fcfb432bce4a2a0593522f3303ce55ffbe14c94e8ed1499e

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

# encoding: utf-8
# This file is distributed under Ting Yun's license terms.

# == TingYun  Initialization
#
# When installed as a gem, you can activate the Ting Yun agent one of the following ways:
#
# For Rails, add:
#    config.gem 'tingyun_rpm'
# to your initialization sequence.
#
# For merb, do
#    dependency 'tingyun_rpm'
# in the Merb config/init.rb
#
# For Sinatra, do
#    require 'tingyun_rpm'
# after requiring 'sinatra'.
#
# For other frameworks, or to manage the agent manually, invoke TingYun::Agent#manual_start
# directly.
#

require 'ting_yun/frameworks'


#if the agent had started in manual , then shouldn't start in auto again
unless TingYun::Agent.agent
if defined?(Rails::VERSION)
  if Rails::VERSION::MAJOR.to_i >= 3
    module TingYun
      class Railtie < Rails::Railtie

        initializer "tingyun_rpm.start_plugin" do |app|
            TingYun::Agent.logger.info('initialize tingyun_rpm start_plugin')
            TingYun::Frameworks.init_start(:config => app.config)
        end
      end
    end
  else
    # After version 2.0 of Rails we can access the configuration directly.
    # We need it to add dev mode routes after initialization finished.
    config = nil
    config = Rails.configuration if Rails.respond_to?(:configuration)
    TingYun::Frameworks.init_start(:config => config)
  end
else
  TingYun::Frameworks.init_start
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tingyun_rpm-1.1.4 lib/tingyun_rpm.rb