module Rapporteur

Rapporteur is a Rails Engine which provides your application with an application status endpoint.

Constants

VERSION

Public Class Methods

add_check(object_or_nil_with_block = nil, &block) click to toggle source

Public: Add a pre-built or custom check to your status endpoint. These checks are used to test the state of the world of the application, and need only respond to `#call`.

Once added, the given check will be called and passed an instance of this checker. If everything is good, do nothing! If there is a problem, use `add_error` to add an error message to the checker.

Examples

Rapporteur.add_check { |checker|
  checker.add_error("Bad luck.") if rand(2) == 1
}

Returns the Checker instance. Raises ArgumentError if the given check does not respond to call.

# File lib/rapporteur.rb, line 34
def self.add_check(object_or_nil_with_block = nil, &block)
  checker.add_check(object_or_nil_with_block, &block)
end
checker() click to toggle source

Internal: The Checker instance. All toplevel calls on Rapporteur are delgated to this object.

# File lib/rapporteur.rb, line 41
def self.checker
  unless @checker
    @checker = Checker.new
    add_check(Checks::RevisionCheck)
    add_check(Checks::TimeCheck)
  end
  @checker
end
clear_checks() click to toggle source

Public: Empties all configured checks from the checker. This may be useful for testing and for cases where you might've built up some basic checks but for one reason or another (environment constraint) need to start from scratch.

Returns the Checker instance.

# File lib/rapporteur.rb, line 58
def self.clear_checks
  checker.clear
end
run() click to toggle source

Public: This is the primary execution point for this class. Use run to exercise the configured checker and collect any application errors or data for rendering.

Returns the Checker instance.

# File lib/rapporteur.rb, line 68
def self.run
  checker.run
end