jueves, 17 de diciembre de 2009

How to install Ruby on Rails on a windows PC


Note: Tutorial targeted at n00bs and is for a purely developer environemnt not suitable for a production environment (can be used as one but not recommended).

Ruby on Rails or just Rails is a framework for building web applications and is quite famous among the developers, first of all for the use of the wonderful language Ruby and next Rails itself is a wonderful piece of software in itself. Ruby is so english like and has a smooth learning curve especially for those new to programming than those who are used to some other language. Ofcourse when you are used to some language every other language seems to be strange.

Install Guide:
First of all you need to Download a few packages
Ruby Windows Installer - http://rubyforge.org/frs/?group_id=167
MySQL - http://dev.mysql.com/downloads/mysql/5.0.html#win32
 
The next thing you need depends on weather you have internet access on your developer machine or not, incase you have internet access, just use the following commandafter you have installed Ruby

gem install rails –include-dependencies 

Incase you have problem installing using this command because you are currently on the plane or in the desert waging war against terror or may be worse behind a restrictive corporate proxy server, you need to download the gem files and install them individually.

First of all download the latest Rails gem from
http://rubyforge.org/frs/?group_id=307
donwload the file with the .gem extension and then run this command

gem install gem-name-x.x.x –local
example - gem install rails-1.2.3 –local
 
The gem file should be in the path or else change to the directory where you put the file and then run the command else you are going to get gem file not found error

When you enter the above command it gives an error message saying rail-1.2.3 needs some-other-gem-1.x.x , these are called dependencies, you need these installed before you install rails, so you need to download these gem packages too, so search for the gem file missing at the rubyforge site

I have made a list of dependecnies for the latest version of rails - rails-1.2.3

rake (>= 0.7.2)
http://rubyforge.org/projects/rake/
activesupport (= 1.4.2)
http://rubyforge.org/frs/?group_id=570&release_id=10359
activerecord (= 1.15.3)
http://rubyforge.org/frs/?group_id=182&release_id=10363
actionpack (= 1.13.3)
http://rubyforge.org/frs/?group_id=249&release_id=10360
actionmailer (= 1.3.3)
http://rubyforge.org/frs/?group_id=361&release_id=10365
actionwebservice (= 1.2.3)
http://rubyforge.org/frs/?group_id=567&release_id=10366
grab the latest release of gem files at these project pages and install them using the common command
gem install gemname-1.x.x –local 
 
Once you get rails installed, you can be sure that is has succesfully installed along with all the dependencies. You might wonder, dont these things need a web server like Apache? The answer is yes and no, its actually not necessary but sure is an optio. Ruby has a build in web server WEBrick, which lets you get started and running with just one command, no install needed!

Now that you have a developer Rails environemnt setup, you can go whip a new rails application in minutes with this tutorial at IBM Developer Works

0 comentarios: