Ruby - - By Darren Jones

New Book: Jump Start Sinatra

Some of you may have noticed that I haven’t written so much on RubySource lately. The reason for this is that all of my time has been taken up writing a brand new book all about Sinatra! A few months ago, the nice guys at SitePoint asked me to write something for their brand new ‘Jump Start’ series. I’d already had some ideas for a Sinatra book, so I was really excited to get the opportunity to put my ideas into print.

The book will be called ‘Jump Start Sinatra: Classy Web Development Made Simple’. Konstantin Haase, the maintainer of Sinatra has agreed to be the technical reviewer for the book and his help and feedback have been invaluable. I’ve almost finished the first draft and would like to share a little bit of what it’s all about with the readers of RubySource .

The book is aimed at anybody with an interest in web development and a reasonable understanding of HTML and CSS. As the title suggests, it uses Sinatra to make the process of building a web application as simple and classy as possible. You don’t need to be an expert in Ruby, but some experience of programming would be a definite advantage.

The basic idea is that you should be able to work through it over the course of a weekend and by the end have a reasonably good idea of how Sinatra works. The book explains how to build a modular, database driven site from start to finish in simple and easy to follow steps. You can already see the sample application up and running online.

Here’s how the book is currently shaping up at the moment:

  • The first chapter introduces Sinatra, goes through installation and some basic routes.
  • The second chapter deals with routes and views and introduces the Slim templating engine as well as using Sass for CSS pre-processing.
  • The third chapter introduces DataMapper to build a database backend. It goes through the basic CRUD operations as well as building a RESTful web interface for them.
  • The fourth chapter explains configuration and settings in Sintra as well as using sessions to create a simple authentication login sysyem. It also explains how to deploy the site on the Heroku platform.
  • The fifth chapter shows how to use helpers as well as external gems to add more functionality to the application. In particular it uses the Pony gem to send emails and Sinatra-Flash to provide feedback messages. It also explains how to make the simple authentication into a Sinatra extension.
  • The sixth chapter demonstrates how to use CoffeeScript and JQuery to add some JavaScript effects to the front end of the application as well using Ajax to improve the feel of the application.
  • The last chapter goes through how to make the application easier to maintain by using Sinatra’s class-based modular style rather than the classical style application.

I hope that lots of you who read this site will find the book and interesting and informative read.

The book is due to be published in January, but there’s still time to make any changes and additions. If you’d like to see something in the book or particularly want to know how to do something in Sinatra then let me know in the comments below and I’ll do my best to squeeze some more in before the final deadline hits.

Sponsors