skip to content
james@kartar:~/2011/10/mafia

Mafia

Trying out Mafia, a Sinatra application generator, and contributing a binary plus a default action to scratch my own itch

1 min read

# written 15 years ago; commands, versions and links may have changed

One of the things that I use a lot of lately is Sinatra. However I find the native application layout a tad annoying and I find myself wanting the same basics from every Sinatra application I create:

  • A simple binary
  • Laid out so I can create a gem from it including a Gem specification
  • Versioning
  • A config.ru file so I can rackup if I need to
  • A README file, license and the miscellaneous trappings
  • Created as a Git repository

I was going to create a tool to generate my own Sinatra application templates but then I saw a Tweet from RubyGems about a Sinatra application generator called Mafia.

Naturally being a proper Rubyist I examined it disdainfully and then proceeded to write my own anyway because there can never be enough Ruby-based tools that do the same thing. Oh wait. No I didn’t.

I did, however, add some new code:

  • Addition of a simple binary
  • A default action for the application. I like things to work out of the box.

I’ll also add basic RSpec testing to the template when I get a chance. I struggle with testing for Sinatra still. I’m still learning RSpec and am not sure yet what the best framework is to test simple Sinatra applications with. If anyone has recommendations or suggests alternatives to RSpec or has some good examples of how to test applications (especially DataMapper) I’d welcome the input. Every example I’ve seen online is subtly and annoyingly different.

$ whoami

I'm James Turnbull. I lead engineering teams, build products, and write on technology. More about me.