Sha256: 6331a6e898dc22029ae82756743daa582001f09a03d58287ed83f234370508d4

Contents?: true

Size: 919 Bytes

Versions: 32

Compression:

Stored size: 919 Bytes

Contents

require 'rake'

module Rollbar
  module Rake
    def self.patch!
      skip_patch && return unless patch?

      ::Rake::Application.class_eval do
        alias_method :orig_display_error_message, :display_error_message

        def display_error_message(ex)
          Rollbar.error(ex, :use_exception_level_filters => true)
          orig_display_error_message(ex)
        end
      end
    end

    def self.skip_patch
      warn('[Rollbar] Rollbar is disabled for Rake tasks since your Rake version is under 0.9.x. Please upgrade to 0.9.x or higher.')
    end

    def self.patch?
      major, minor, *_ = rake_version.split('.').map(&:to_i)

      major > 0 || major == 0 && minor > 8
    end

    def self.rake_version
      if Object.const_defined?('RAKEVERSION')
        return RAKEVERSION
      elsif Rake.const_defined?('VERSION')
        return Rake::VERSION
      end
    end
  end
end

Rollbar::Rake.patch!

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
rollbar-2.8.2 lib/rollbar/rake.rb
rollbar-2.8.1 lib/rollbar/rake.rb
rollbar-2.8.0 lib/rollbar/rake.rb
rollbar-2.7.1 lib/rollbar/rake.rb
rollbar-2.7.0 lib/rollbar/rake.rb
rollbar-2.6.3 lib/rollbar/rake.rb
rollbar-2.6.2 lib/rollbar/rake.rb
rollbar-2.6.1 lib/rollbar/rake.rb
rollbar-2.6.0 lib/rollbar/rake.rb
rollbar-2.5.2 lib/rollbar/rake.rb
rollbar-2.5.1 lib/rollbar/rake.rb
rollbar-2.5.0 lib/rollbar/rake.rb
rollbar-2.4.0 lib/rollbar/rake.rb
rollbar-2.3.0 lib/rollbar/rake.rb
rollbar-2.2.1 lib/rollbar/rake.rb
rollbar-2.2.0 lib/rollbar/rake.rb
rollbar-2.1.2 lib/rollbar/rake.rb
rollbar-2.1.1 lib/rollbar/rake.rb
rollbar-2.1.0 lib/rollbar/rake.rb
rollbar-2.0.2 lib/rollbar/rake.rb