Fork me on GitHub



Vegas aims to solve the simple problem of creating executable versions of Sinatra/Rack apps.


I have a vision of a future where all us developers release gems with simple local web interfaces powered by Sinatra. I see Vegas as a little shove and an easy first step in making this vision come true.

I presented about “Sinatra: The Framework Within” at GoGaRuCo 2009: Check out the full video.


Currently, vegas contains a single class Vegas::Runner that provides a wrapper for a Sinatra app to easily make it into an executable bin.

Lets say you have a Sinatra app that looks like:

# /my_app.rb
require 'rubygems'
require 'sinatra/base'

class MyApp < Sinatra::Base
  get '/' do
    "This is my app"

You can turn this into a simple binary:

  #!/usr/bin/env ruby
  # /myapp

  require File.expand_path(File.dirname(__FILE__) + 'myapp.rb')
  require 'vegas', 'my_app')

Now if you run ./my_app it should:

  • find an appropriate rack handler (thin. mongrel)
  • find an available port
  • launch the app in a browser
  • put itself in the background
  • write a .pid and a .url file

Running it with -h or --help will print a list of available command line options. You can even add options specific to your app by using a block., 'app_name') do |runner, opts, app|
  # runner is the instance of Vegas::Runner
  # opts is an option parser object
  # app is your app class

As of version 0.0.3, Vegas::Runner and its daemon-ization is fully compatible with Windows.

Rack Apps

Vegas (> v0.1.0) is not dependent on Sinatra. Vegas works almost exactly the same for general Rack Applications. For example, this will work as expected:

#!/usr/bin/env ruby

require 'vegas'

app = {|env| 
  [200, {'Content-Type' => 'text/plain'}, ["This is an app. #{env.inspect}"]]
}, 'rack_app')


Vegas requires:

  • rack >= 0.1.0

On Windows, there is an additional requirement of the win32-process gem.


sudo gem install vegas

Or directly from github:

sudo gem install quirkey-vegas -s

Github in thier infinite awesomeness also lets you download the source in multiple formats.

Bugs/Feature Requests

The full and most up to date source is at github:

You can clone or fork from there to fix or break the code.

I’m happy to take feature requests/bug reports. Just email me (contact below) or message me on github.


This code is free to use under the terms of the MIT license.


Feel free to email me at aaron at quirkey dot com.

Please check out my blog.

If you like or use this library – I don’t want donations – but you can recommend me on or hire me to work on your next project.