Sha256: 44d93e26d98bb85af98425bbd54daa228fcacb7c537fac1789fc9c62b29639be

Contents?: true

Size: 1.19 KB

Versions: 39

Compression:

Stored size: 1.19 KB

Contents

# encoding: utf-8

module OneApm
  class Probe
    module FrameworkLoader

      def init(options = {})
        instance.init_plugin options
      end

      def instance
        @instance ||= new_instance
      end

      def new_instance
        if OneApm::Manager.config[:framework] == :test
          load_test_framework
        else
          load_framework_class(Manager.config[:framework]).new(local_env)
        end
      end

      def reset
        @instance = nil
        @local_env = nil
      end

      def local_env
        @local_env ||= OneApm::LocalEnvironment.new
      end

      def load_test_framework
        config = File.expand_path(File.join('..', '..', '..', '..', 'test', 'config', 'oneapm.yml'), __FILE__)
        require 'config/test_control'
        OneApm::Probe::Frameworks::Test.new(local_env, config)
      end

      def load_framework_class(framework)
        begin
          require "one_apm/frameworks/#{framework}"
        rescue LoadError
        end
        OneApm::Probe::Frameworks.const_get(framework.to_s.capitalize)
      end

      def oneapm_root
        File.expand_path(File.join('..', '..', '..', '..'), __FILE__)
      end
    end

    extend FrameworkLoader
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
oneapm_rpm-1.2.9.rc1 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.8 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.8.rc1 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.7 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.7.rc1 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.6 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.6.rc1 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.5 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.5.rc1 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.4 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.4.rc1 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.3 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.3.rc2 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.2 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.2.rc lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.1 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.1.rc lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.2.0 lib/one_apm/probe/framework_loader.rb
oneapm_rpm-1.1.3 lib/one_apm/probe/framework_loader.rb