just a dude abiding

Pushing an entire Sinatra app into a Rackup file

The title pretty much says it all. This is a pretty pointless thought experiment inspired by this post by the guys at devver. They came up with a simple way to put both a sinatra application AND it’s tests into a single file. Nothing TOO crazy, but definitely cool.

Not satisfied with simple and effective, I went to complete overkill. I put together a way to not only embed a sinatra app and it’s tests into a single file, but for that file to be a rackup compliant file. Also, as a pointless but neat bonus, I forced the tests to run before successfully before the app can start. What’s the point? I don’t really know, but it seemed cool so I thought I’d share. And no, I’m not using this anywhere, I don’t think.