Mafia
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.