Sunday, February 8, 2009

Oh Ruby

This week I attended an excellent four day training course by SpringSource on Core Spring. I've touched on Spring before, so time time ago I decided it was time to book myself on a course and get into it in a bit more detail. The timing was fortuitous since I have been seconded to another team that makes extensive use of use of this interesting technology.
While in North Sydney I took the opportunity to visit an excellent technical bookshop called Bookware. Its cheaper to buy from them any of the city bookstores, cheaper even than getting the books through Amazon and paying their shipping costs.
Its on Arthur St and camouflaged by building site hordings, but it was worth the effort in finding it. Small and overflowing with Business, Marketing but chiefly computing books.
Anyway, I bought a book on Spring Web Flow, but couldn't resist picking up a Pragmatic Programmers book on Ruby, called Agile Web Development with Rails. Cool, been meaning to look at this for ages (in between work, running, guitar, balloons and a baby).

I get the book home and start reading only to discover that there is a new version of Rails out and the book is the the old one, but the latest edition of the book is not available yet, except in pdf format. I don't want to shell out again, so I'll stick with what I've got.

Ok so the book pretty quickly cuts to the chase and in no time I'm downloading Ruby. The book directs you to some one stop shop installer that doesn't seem to have been updated in about 2 years, so I just download Ruby and run hte install, selecting a gem checkbox along the way. Done.
Next to install rails with gem done.
Then Mysql. Ok, some problem with a port and maybe a firwall, will check it out later.
Onto the coding. A Hello World program in Ruby. Cool.

Except now the problems start.
Instead of getting the 'Template is Missing' error the book says is likely I get a message like this:

> MissingSourceFile in SayController#hello
>
> no such file to load -- sqlite3

It turns out that you need a database to run hello world. No mention of that in the tutorial.
Ok so I down load Sqlite3, both the exe and dll zips and place the location on the path.

I then install sqlite 3 using gem. But it seems that the current version of gem or sqlite3 or both has a bug and you have to install sqlite3 version 1.2.3.

I do that (stopping and starting the WEBrick server every time).

Next a Runtime Error - can't find sqlite3.dll.

Come on. Its there. Its on the path.
Its late, I can't be bothered fighting the machine, so I reboot, restart and get 'Hello from Rails!' in my browser.

That's the longest its ever taken me to get Hello World up and running.
Browsing the various forums indicates that I'm far from being the only one.

The premise of Ruby on Rails is that it is simple to build web sites. The inference is that you don't have to be an uber nerd to learn this language and framework. The Pragmatic Programmer's books are always easy to read and motivational. I know that the book is targeted at an older version of rails, but still, it didn't help. Hopefully the rest will be a bit smoother and of course, solving these problems will enhance my understanding.
Or drive me mad and cause me to abandon this little project.
Pressing on...

No comments: