inchworms -
Tue 2 July, 2013, 18:50
We continued working on our sample app Songs By Nancy.
Before implementing a database, and with it the ability to add and remove content, we worked with a static file of data first (as per Matt’s suggestion). This involved creating a spreadsheet file, exporting it as a csv file, converting this file to JSON, then parsing the JSON file into a ruby hash. All in a morning’s work ;-)
(Actually, Anja was pretty excited about learning how to do this and Carla was amazed that she remembered - from hack-day projects she’d worked on - how it could be done).
Then there was a bit more faffing about with a couple of new pages (one to display a list of songs, one to display individual song lyrics), which meant new templates, and some changes to the main.rb.
Our next task was to sketch up an outline of what the structure of our tutorial would look like. We charted several steps, which we divided into parts. Each part will form the basis of a screencast:
Building a Basic Website - Screencast Outline
Part 1 - Basic Requests, Defining Variables, Using Sinatra Reloader
Part 2 - Views, Layouts, Partials, Folder Structure, Images, CSS
Part 3 - Using Static Data, Using a Database, Add/Edit/Deleting
Part 4 - Error Handling
Konstantin, meanwhile, refused, despite our insistence, to print the single-page literary epic that is Sinatra’s base.rb. We wanted to stick it to the wall and draw flow-arrows between which parts of the file interacted with other parts of the file. Herr Haase, however, was dubious.
22 pages? A ridiculous idea!
Were we deterred? No!
We hopped onto the Ezeep printing service, found a printer on Level 3 of the same building, and within miniutes had the 22 page document plastered to the wall.
Unsurprisingly it took less than another half minute for Konstantin to appear and admire his handiwork. There he remained for the rest of the afternoon.
Tomorrow rkh promises to print out Almost Sinatra. It should take up a little less space…
inchworms -
Tue 2 July, 2013, 10:47
inchworms -
Mon 1 July, 2013, 19:00
We spent a couple of hours in the morning with Matt having CGI (Common Interface Gateway) explained to us. It’s the old-school way of doing simple dynamic content on the web.
He then walked us through FastCGI, SimpleCGI, and WSGI until he arrived at Rack, the current protocol that Rails and Sinatra apps use for passing requests and responses back and forth across the internets. This post by Hubert Łępicki was very useful in explaining how Rack works.
We were then set the task of building a simple Sinatra app. We used a tutorial from the excellent Jump Start Sinatra book by Darren Jones. We modified his sample app a little. You can check out our initial work here. We’ve still got more work to do but we’ve learnt some fundamentals about how Sinatra works.
We also had to make a diagram of the basic way a Sinatra app handles a request. We came up with this, a messy representation of how an app talks to a client:
On the http level this is what Sinatra is doing:
more or less…
inchworms -
Mon 1 July, 2013, 09:30
… and we’re EXCITED!!!
Matt is about to tell us all about the Common Gateway Interface.
inchworms -
Mon 24 June, 2013, 22:15
Tonight we met with coach @fidothe and mentor @konstantinhaase to devise a plan for what we would work on for the Sinatra leg of our program.
Our first task will be to familiarise ourselves with Sinatra, referring in the first instance to the comprehensive Readme documentation.
We’ll then spend the first week/week-and-a-half building a sample application that covers how routes, templates, and error handling work. We’ll make a screencast that can be used as a guide for others wanting to learn Sinatra basics.
We’ll then spend the next two weeks re-writing our sample application using test driven development, and produce a screencast that demonstrates how to test a Sinatra application.
Finally we’ll use the remainder of our time on Sinatra writing tests in rspec to test the Sinatra framework itself, focusing primarily on the behaviour we used in our sample app - routes, templates, and error handling (our template tests will cover high level template behaviour only).
We’ll work on our own fork of the Sinatra repository.
Bis Montag…