Sha256: 5d8e56db8ed40554ae9c9407574de73913a987cd6573fc854e4fecec0e66783d

Contents?: true

Size: 920 Bytes

Versions: 4

Compression:

Stored size: 920 Bytes

Contents

# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

module OpenTelemetry
  module Instrumentation
    module Rake
      # The Instrumentation class contains logic to detect and install the Rake instrumentation
      class Instrumentation < OpenTelemetry::Instrumentation::Base
        MINIMUM_VERSION = Gem::Version.new('0.9.0')

        install do |_config|
          require_dependencies
          patch_rake
        end

        present do
          defined?(::Rake::Task)
        end

        compatible do
          gem_version >= MINIMUM_VERSION
        end

        private

        def gem_version
          Gem::Version.new(::Rake::VERSION)
        end

        def require_dependencies
          require_relative './patches/task'
        end

        def patch_rake
          ::Rake::Task.prepend(Patches::Task)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-rake-0.2.1 lib/opentelemetry/instrumentation/rake/instrumentation.rb
opentelemetry-instrumentation-rake-0.2.0 lib/opentelemetry/instrumentation/rake/instrumentation.rb
opentelemetry-instrumentation-rake-0.1.1 lib/opentelemetry/instrumentation/rake/instrumentation.rb
opentelemetry-instrumentation-rake-0.1.0 lib/opentelemetry/instrumentation/rake/instrumentation.rb