Sha256: 96f9e14df4e5f54619e8c6fb97d529b5bdfbfe137f87936c079da02a90d3e93b

Contents?: true

Size: 888 Bytes

Versions: 8

Compression:

Stored size: 888 Bytes

Contents

module Appsignal
  class Hooks
    # @api private
    class RakeHook < Appsignal::Hooks::Hook
      register :rake

      def dependencies_present?
        defined?(::Rake::Task)
      end

      def install
        ::Rake::Task.class_eval do
          alias :execute_without_appsignal :execute

          def execute(*args)
            execute_without_appsignal(*args)
          rescue => error
            transaction = Appsignal::Transaction.create(
              SecureRandom.uuid,
              Appsignal::Transaction::BACKGROUND_JOB,
              Appsignal::Transaction::GenericRequest.new(
                :params => args
              )
            )
            transaction.set_action(name)
            transaction.set_error(error)
            transaction.complete
            Appsignal.stop("rake")
            raise error
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
appsignal-2.3.1 lib/appsignal/hooks/rake.rb
appsignal-2.3.0 lib/appsignal/hooks/rake.rb
appsignal-2.3.0.beta.3 lib/appsignal/hooks/rake.rb
appsignal-2.3.0.beta.2 lib/appsignal/hooks/rake.rb
appsignal-2.3.0.beta.1 lib/appsignal/hooks/rake.rb
appsignal-2.2.1 lib/appsignal/hooks/rake.rb
appsignal-2.2.0 lib/appsignal/hooks/rake.rb
appsignal-2.2.0.beta.1 lib/appsignal/hooks/rake.rb