Over the next few weeks / months I plan to blog about my experiences of using Ruby on Rails, with this being the first post.
I will be using my iBook (OSX 10.4) to work with rails, one reason is because I want to use my ibook more – I can then justify a new one, and also because it enables me to understand creating websites for linux servers.
In case you don’t yet know, Ruby on Rails is all the rage at the moment. Their website says
“Ruby on Rails is an open-source web framework that’s optimized for programmer happiness and sustainable productivity. It lets you write beautiful code by favoring convention over configuration”.
I have to admit, I tried it when it was first released and found it really cool, however never thought it would take off – won’t make that mistake again.
Locomotive is an application for OS X to allow developers to drag and drop the installation into the Applications directory, and have a full working Ruby on Rails environment instantly.
Download : http://locomotive.raaum.org/
Strongly suggest you install (sorry, drag and drop) this. It will save you hours!
I’m sure everyone has heard of MySQL. MySQL is a open source database application running on almost every platform, offering both commercial and a free community edition.
I went ahead and installed MySQL 5.0 Community Edition (free) from http://dev.MySQL.com/downloads/MySQL/5.0.html . OSX installation of this is very simple, has two packages – a main and a startup – I installed the main package first. After installing both packages you will need to edit your ~/.bash_login script to set the path directory for MySQL.
The default username is root. Default password is blank – nice and secure.
You can login to the server by loading a new terminal window and entering the command MySQL. If you have problems accessing the server, you might need to start the MySQL service (or just reboot).
First RoR Application
The application will look something like below (with Aqua effects which got lost in the screenshot)
From within the application you can start/stop the application, open a terminal with RoR commands (like gem), show the application in finder as well as create new applications.
To create a new application, select the Applications menu, and click Create New… which will launch the dialog below.
Enter a name, and a directory where the app will live and click Create.
Next, click Run on the toolbar which will start the pre-configured webserver. Then go Applications > Preview in Browser to view the new application. The application runs on http://localhost:3000
That’s your first application created.
Just to sum up, Locomotive solves a whole host of problems when configuring RoR on OSX. It gives you a great environment to develop applications.
Over time, I will post more on RoR, locomotive and MySQL.