Axeman

A basic ‘what actions are actually used’ tester, in the spirit of destroying underused actions in your rails app.

Usage with Rails:

Simply add the gem to your gemfile:

gem 'axeman', :git => 'git://github.com/jaggederest/axeman.git'

and then require it:

require 'axeman'

Usage without rails:

Without rails, you’ll need to do two things:

  1. Require the gem and mount the middleware

# in config.ru
require 'axeman'
require 'axeman/display'

use Axeman::Display
  1. Notify axeman when you access an endpoint:

Axeman.subscriber.notice(first, second)

You can use any first and second part that you like, under Rails these are controller and action, but you could easily use method and matcher under sinatra, or whatever you prefer. Anything that can be a hash key should work. Note that I’d recommend that you use smaller keys and values, since they’ll be stored for the life of the application server.

Viewing statistics:

To view statistics, assuming the middleware is mounted and your app does not otherwise use the path, go to:

/axeman

Notes and TODO

Currently, axeman loses the state of the visited pages when the server restarts - on multiple server environments, you’ll get whichever server’s output that your request gets routed to.

Future development will save state periodically to a sqlite server or other preferred nonvolatile storage.

Also, currently axeman will never notice actions that are never used. It will notice any action that is visited at least once, but not the completely unreachable or abandoned actions. A method around this would be to run some sort of spider on your website to exercise little-used parts of your application, or to run integration tests against it likewise.