Sidekick

Sidekick is a command line tool to automatically trigger actions on certain events, as defined per project, in a local .sidekick file in your project folder:


watch('**/*.rb') { restart_passenger; rake docs }

auto_compile 'assets/*.sass', 'public/:name.css'

every(10) { notify sh 'fortune' }

Sample use cases

  • Restart server when code is changed
  • Auto-compile Sass or CoffeeScript templates (and many other languages)
  • Periodically run tasks
  • Continuous testing, notifications, hooks, you name it

Features

  • Simple and powerful DSL
  • Easy to extend
  • Compiles many formats, thanks to Tilt.
  • Powered by EventMachine
  • Short and sweet codebase – core < 100 loc

You can read the annotated source code.

Basic usage

Install with gem install sidekick and invoke the sidekick command in your project folder. If you do not have a .sidekick file, you will be offered a template with plenty of examples.

View source:

Defining new triggers

Have a look at the existing triggers, and you will get the idea. Basically, you define new triggers by calling Sidekick::Triggers.register(:trigger_name) { .. }, and hooking into EventMachine the same way as in EM.run { .. } from there.

You can keep your extensions in the .sidekick file itself, or package them in gems, or (better) ask me to merge them into the main repository.

Copyright

Copyright © 2010 Jostein Berre Eliassen. See LICENSE for details.