Skip to content
Hoptoad notifier for rack-based frameworks
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
spec
.gitignore
MIT-LICENSE
README.markdown
Rakefile
require.rb

README.markdown

Lilypad

Hoptoad notifier for Rack-based frameworks.

Install

sudo gem install lilypad --source http://gemcutter.org

Basic Usage

require 'lilypad'
use Rack::Lilypad, 'hoptoad_api_key_goes_here'

Rails

config/environment.rb

require 'lilypad'

Rails::Initializer.run do |config|
  config.middleware.insert_after(ActionController::Failsafe, Rack::Lilypad)
end

Lilypad do
  api_key 'hoptoad_api_key_goes_here'
  rails
end

Sinatra

require 'lilypad'

class MyApp < Sinatra::Application
  use Rack::Lilypad do
    api_key 'hoptoad_api_key_goes_here'
    sinatra
  end
end

Error Redirection

Conditionally redirect errors to different Hoptoad buckets.

Lilypad do
  api_key do |env, exception|
    if exception && exception.message =~ /No route matches/
      'hoptoad_api_key_goes_here'
    elsif env && env['HTTP_USER_AGENT'] =~ /Googlebot/
      'hoptoad_api_key_goes_here'
    else
      'hoptoad_api_key_goes_here'
    end
  end
end

Notify

Send exceptions to Hoptoad from a rescue block.

begin
  raise 'Test'
rescue Exception => e
  Lilypad.notify(e)
end

Deploy

Send deploy notifications to Hoptoad.

deploy.rb

require 'capistrano/lilypad'
Lilypad { api_key 'hoptoad_api_key_goes_here' }

Or you can do it manually:

Lilypad.deploy(
  :environment => 'production',
  :repository => 'git@github.com:winton/lilypad.git',
  :revision => '8acc488967085987f0a9f2c662383119f83e1bb8',
  :username => 'winton'
)

Options

Below are the available options and their default values:

Lilypad do
  api_key nil
  environments %w(production staging)
  deploy_url 'http://hoptoadapp.com:80/deploys.txt'
  notify_url 'http://hoptoadapp.com:80/notifier_api/v2/notices'
  filters []  # Array of environment variables to hide from Hoptoad
  log nil     # Path of Hoptoad log
  rails       # Requires the Rails adapter
  sinatra     # Requires the Sinatra adapter
  always_notify # notify regardless of RACK_ENV
end

Redmine

To send the notices to a Redmine Hoptoad Server:

Lilypad do
  api_key               "use the key from redmine"
  redmine_url           "http://your.redmine.host/notices"
  redmine_project       "short name of the redmine project"
  redmine_tracker       "Bug"
  redmine_category      "category"  # optional
  redmine_assigned_to   "admin"     # optional
  redmine_priority      5           # optional

Compatibility

Tested with Ruby 1.8.6, 1.8.7, and 1.9.1.

Thanks

Lilypad wouldn't have happened without rack_hoptoad, toadhopper, Builder, and Nokogiri.

Something went wrong with that request. Please try again.