Spectator monkey-patch that supports notification to the emacs modeline (via Enotify)
Ruby Emacs Lisp
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
emacs
lib/spectator
spec
.document
.gitignore
.rspec
.yardopts
ChangeLog.rdoc
Gemfile
LICENSE.txt
README.md
Rakefile
spectator-emacs.gemspec

README.md

spectator-emacs

Description

spectator-emacs is a Spectator extension that provides discreet notificatoins in the Emacs modeline, via the Enotify Emacs notification system.

The RSpec output is displayed in an emacs buffer, and using the RSpec Org Formatter, they are nicely formatted as an org-mode file. Minimize your switching from Emacs to the shell or the browser to just display the test results!

If you hate growl-style popups and prefer a simple green/red (customizable!) indicator on the modeline, spectator-emacs is for you.

Features

  • Notifications on the emacs modeline
  • Short summary report on mouse-over in the modeline indicator
  • Easily switch to the results buffer with just a click on the modeline indicator
  • Org formatted RSpec results with the aid of RSpec Org Formatter
  • Summary extraction can be customized to work with different RSpec output formats
  • all the features offered by Spectator

Install

$ gem install spectator-emacs

Examples

To run spectator-emacs, just run it!

$ spectator-emacs

To customize it, create a .spectator-emacs file in your project root. You can customize various aspects of how spectator-emacs works:

  • Enotify host (default: localhost)
  • Enotify port (default: 5000)
  • The notification message that will appear on the emacs modeline (default: 'F' for failures, 'P' for pending, 'S' for success)
  • The notification faces used to display the icons in the modeline (default: enotify-success-face for success, enotify-failure-facefor failures, enotify-warning-face for success with pending examples)
  • The Enotify slot id to register for notifications
  • The major mode used for the rspec output buffer

An example `.spectator-emacs' file:

require 'spectator/emacs'

@runner = Spectator::ERunner.new(:enotify_port => 5001,
                                 :notification_messages => {
                                   :failure => "failure",
                                   :success => "success",
                                   :pending => "pending"
                                 },
                                 # Use org-mode to display the report buffer
                                 :report_buffer_mode => "org",
                                 :slot_id => "project foobar",
                                 :notification_face => {
                                   :pending => :font_lock_warning_face,
                                   # see the docs for detail on Symbol#keyword
                                   :success => :success.keyword,
                                   :failure => :failure
                                 }) do |runner|
  # This code will be executed before entering the main loop.

  def format_summary(examples, failures, pending)
    summary = "#{examples} examples"
    summary << ", #{failures} failures"  if failures > 0
    summary << ", #{pending} pending"  if pending > 0
    summary << "."
    summary
  end

Requirements

spectator-emacs requires a working Emacs installation. You need to install Enotify, which can be found in the MELPA repository.

You also need to load the enotify-spectator-emacs Enotify plugin.

Put this in your .emacs:

(require 'enotify)
(require 'enotify-tdd)
(enotify-minor-mode t)

Copyright

Copyright (c) 2013 Alessandro Piras

See LICENSE.txt for details.

Thank yous

Thanks to Roberto Romero (sildur) for the automatic summary line detection patch, and to Petko Bordjukov for his ruby 2.1 compatibility fixes!