add support for bundler

This allows dependencies to be isolated for easy hacking.

The merges in this pull request demonstrate the changes of dependencies over time (best viewed locally with `git log --graph` or your favourite git GUI frontend), but it's not meant to be comprehensive; I started at the last "good" point (`rake test` passed).