Building our first app
The Ironhack is an intensive, 8-week programming course (Ruby on Rails / iOS) with bootcamps in Miami, Barcelona and Madrid. I’ll get my hands dirty by working on real projects and presenting them at Demo Day — “The Hackshow”.
Extending the Toolset
Sinatra is a Ruby framework or library that allows you to code web apps easily. You simply install and run Sinatra, and start coding the application logic.
To install and run Sinatra:
$ gem install sinatra
$ ruby myapp.rb
There are a lot of other frameworks out there (especially in Ruby), so let’s see what makes Sinatra unique.
- Size — Sinatra is really tiny: aprox. 1500 lines of code vs. 100,000 of Rails.
- Solution — Sinatra doesn’t do anything that Rails or other frameworks can’t. It’s just a web framework.
- Scope — Each framework is designed to suit different scale projects. If you’re building a large project, you’d better go for Rails or Merb.
Rack provides anl interface between Ruby webservers and Ruby frameworks.
To install rack:
$ gem install rack
To use Rack, provide an “app”: an object that responds to the call method, taking the environment hash as a parameter, and returning an Array with three elements:
- The HTTP response code
- A Hash of headers
- The response body, which must respond to each
Shotgun is a bridge tool between Sinatra and Rack. Shotgun will relaunch your app every time a new request comes in from the web browser.
Sinatra does not refresh its code whenever you make a change. If you make a change in the sinatra file, you have to restart the server manually so, we can use Shotgun in order to avoid this additional step.
To install Shotgun:
$ gem install shotgun
Pstore creates local storage for our apps, that means that we don’t lose our previous data when, for example, using Shotgun. You should read the documentation carefully as Pstore uses a proprietary method called transaction to manage inputs/outputs from the memory.
Pstore is a Ruby class so just use:
require 'pstore'
Wrapping it Up
So, it’s been some days from the beginning of The Ironhack, and we are able to deploy our first complete app using our toolset. What a great milestone!
We’ve created a simple to-do list that you can clone or fork from our Ironhacker mate Xavier Simó.

ps. You can follow me on twitter @jonathangak or @megafounder if you want to raise funds for your projects.
Thanks to @beatriztejeiro for reading a draft of this.