Sha256: 2cbaf0e6b5a4eac0797517c4f8dac0c9de3295494af56f4ac843e202a73b1e2f

Contents?: true

Size: 943 Bytes

Versions: 4

Compression:

Stored size: 943 Bytes

Contents

Rake::TaskManager.record_task_metadata = true

module Bugsnag::Rake
  def self.included(base)
    base.extend ClassMethods
    base.class_eval do
      class << self
        alias_method :original_define_task, :define_task
        alias_method :define_task, :bugsnag_define_task
      end
    end
  end

  module ClassMethods
    def bugsnag_define_task(*args, &block)
      task = self.original_define_task *args do
        begin
          Bugsnag.before_notify_callbacks << lambda {|notif|
            notif.add_tab(:rake_task, {
              :name => task.name,
              :description => task.full_comment,
              :arguments => task.arg_description
            })
            notif.context ||= task.name
          }

          yield if block_given?
        rescue Exception => e
          Bugsnag.notify(e)
          raise
        end
      end
    end
  end
end

Rake::Task.send(:include, Bugsnag::Rake) if defined?(Rake::Task)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bugsnag-1.5.0 lib/bugsnag/rake.rb
bugsnag-1.4.2 lib/bugsnag/rake.rb
bugsnag-1.4.1 lib/bugsnag/rake.rb
bugsnag-1.4.0 lib/bugsnag/rake.rb