Sha256: 6396cc0eeec94012a8227ec8ff2fc164d8f73eccae9a8a1b3bacaccdf8aa1444

Contents?: true

Size: 869 Bytes

Versions: 63

Compression:

Stored size: 869 Bytes

Contents

module Appsignal
  class Hooks
    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

63 entries across 63 versions & 1 rubygems

Version Path
appsignal-2.0.6 lib/appsignal/hooks/rake.rb
appsignal-2.0.5 lib/appsignal/hooks/rake.rb
appsignal-2.0.5.beta.1 lib/appsignal/hooks/rake.rb
appsignal-2.1.0.alpha.3 lib/appsignal/hooks/rake.rb
appsignal-2.1.0.alpha.2 lib/appsignal/hooks/rake.rb
appsignal-2.1.0.alpha.1 lib/appsignal/hooks/rake.rb
appsignal-2.0.4 lib/appsignal/hooks/rake.rb
appsignal-2.0.3 lib/appsignal/hooks/rake.rb
appsignal-2.0.2 lib/appsignal/hooks/rake.rb
appsignal-2.0.1 lib/appsignal/hooks/rake.rb
appsignal-2.0.0 lib/appsignal/hooks/rake.rb
appsignal-2.0.0.beta.1 lib/appsignal/hooks/rake.rb
appsignal-1.4.0.beta.1 lib/appsignal/hooks/rake.rb
appsignal-1.3.6 lib/appsignal/hooks/rake.rb
appsignal-1.3.6.beta.1 lib/appsignal/hooks/rake.rb
appsignal-1.3.5 lib/appsignal/hooks/rake.rb
appsignal-1.3.5.beta.1 lib/appsignal/hooks/rake.rb
appsignal-1.3.4 lib/appsignal/hooks/rake.rb
appsignal-1.3.3 lib/appsignal/hooks/rake.rb
appsignal-1.4.0.alpha.2 lib/appsignal/hooks/rake.rb