Sha256: 2e1028ef01d528a03da6d460f3f8f5a255067c7028f5dae775f44606fc631455

Contents?: true

Size: 861 Bytes

Versions: 46

Compression:

Stored size: 861 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
            raise error
          end
        end
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
appsignal-1.1.0.beta.8 lib/appsignal/hooks/rake.rb
appsignal-1.0.6.beta.1 lib/appsignal/hooks/rake.rb
appsignal-1.0.5 lib/appsignal/hooks/rake.rb
appsignal-1.1.0.beta.7 lib/appsignal/hooks/rake.rb
appsignal-1.0.5.beta.4 lib/appsignal/hooks/rake.rb
appsignal-1.0.5.beta.3 lib/appsignal/hooks/rake.rb
appsignal-1.0.5.beta.2 lib/appsignal/hooks/rake.rb
appsignal-1.0.5.beta.1 lib/appsignal/hooks/rake.rb
appsignal-1.0.4 lib/appsignal/hooks/rake.rb
appsignal-1.1.0.beta.6 lib/appsignal/hooks/rake.rb
appsignal-1.0.3 lib/appsignal/hooks/rake.rb
appsignal-1.0.3.beta.2 lib/appsignal/hooks/rake.rb
appsignal-1.0.3.beta.1 lib/appsignal/hooks/rake.rb
appsignal-1.1.0.beta.5 lib/appsignal/hooks/rake.rb
appsignal-1.1.0.beta.4 lib/appsignal/hooks/rake.rb
appsignal-1.1.0.beta.3 lib/appsignal/hooks/rake.rb
appsignal-1.1.0.beta.2 lib/appsignal/hooks/rake.rb
appsignal-1.1.0.beta.1 lib/appsignal/hooks/rake.rb
appsignal-1.0.2 lib/appsignal/hooks/rake.rb
appsignal-1.0.2.beta.4 lib/appsignal/hooks/rake.rb