Pow! etc.

April 15th, 2011  |  Published in ruby

It seems as if a few colleagues might need to use that little Sinatra-based reclassifier ditty, which is always a nice thing: The first iteration of these things usually seems to come close to breaking even on time saved if I just use it once, but if I can make the same tool available to one or two more people, then it’s a lock to earn the development time back and start saving a lot of time.

The problem with sharing stuff like Rails and Sinatra is deployment. Easy for me to set something up on my desktop that never seems to leave dev mode, but less of a pleasure to get it working for others, especially on shared hosting.

Several things will help with that:

First, Pow! from 37 Signals makes it easy to create a local development domain for webapps that use Rack. You just install it, create a config.ru file for your app in its directory, then symlink the app directory to ~/.pow and it becomes available at http://yourappdir.dev. Besides being a great way to work on a number of webapps in parallel, it’s a nice way to practice dealing with Rack.

Second, it looks like it’s not too hard to use those Rack-enabled apps on Dreamhost. This worked for my config.ru file, and it’s the same as the one I use for my desktop machine:

Third, it’s not too hard to add http authentication to a Sinatra app. That means I can deploy little apps that don’t require a robust user model to a subdomain and protect them for as long as they need to be up, which is just a day or two. Here’s all I had to add to the top of my app file to get http authentication:

This all makes me think back to 2008, when I wrote about my recent discovery of Rails: The combination of Sinatra, Pow! and Rack does even more to provide me with a comfortable replacement for lightweight databases, and makes it much easier to share my work, which is even better.

Leave a Response

© Michael Hall, licensed under a Creative Commons Attribution-ShareAlike 3.0 United States license.