After writing about Developing Web Apps on Windows with Vagrant spent some time immersing myself in Ruby and Ruby Gems. Tonight, while catching up on some articles in my Pocket, I ran across the following article from Addy Osmani: Building Backbone.js Apps With Ruby, Sinatra, MongoDB and Haml.
Sweet. In addition to Addy’s very awesome and open-source book Backbone Fundamentals, he’s also writing some useful related articles. And though I’d likely ditch haml in favor of Emblem with Swag, Addy’s article ought to be a good starting point for the Ruby newbie.
Building on my “you can do this on Windows too” mantra as of late, I also want to point out that, to get the linked tutorial to work correctly on Ubuntu running in a virtual machine on Windows using Vagrant, you need to
Sinatra to bind to the server on ip
127.0.0.1) so that Vagrant will be able to port-forward from Windows to WEBrick onto the Ubuntu guest machine, like:
require 'sinatra' # Listen on all interfaces in the development environment set :bind, '0.0.0.0' get '/' do "Hello World! Is it " + settings.bind + " you're looking for?" end
Here’s a screen-shot of the port-forwarded response from WEBrick for Sinatra in Chrome for Windows, a back-end for Backbone apps using Ruby: