![]() |
is a university student in São Paulo, and working in multinational companies, both in programming, as well as in infrastructure areas. Big fan of Metallica, he has a big question - "Onde está Antonio Nunes?" |
This introductory article presents step by step the installation of Ruby on Rails on Windows. A following article will describe the installation of the Oracle 10g database and discuss the most frequently encountered problems.
Installing Ruby
Download Ruby (version 1.9.2) from http://rubyforge.org/frs?group_id=167 or http://rubyinstaller.org/, then run the file rubyinstaller-1.9.2-p0.exe starting the installation, and wait for it to complete.
The next step is to install Rails and its dependencies.
Installing Rails
Rails and its dependencies must be run from a command in prompt of Microsoft Windows with Ruby, locate in menu Start > Programs > Ruby 1.9.2-p0.
"Gem" is the package manager for plugins and engines of Ruby.
To install Rails and all its dependencies automatically, run the following command from directory %\Ruby192\Bin\:
gem install rails --include-dependecies (Figure 1).
Make sure your computer is connected to the Internet and the user has administrator rights.
If following error is returned: "'gem' is not recognized as an internal or external command, operable program or batch file.", it means that probably you are in the wrong directory or Ruby was not successfully installed.
When questioned about accepting the Rails installation with its dependencies, confirm with Yes (Y) and press Enter to continue.
To ensure you are using the latest version of rubygems, use the command:
ruby gem update --system
After completing this step, run the command:
ruby gem update rails
This update may take several minutes, as the updated version will be automatically downloaded from Internet.
If you have any problem with this procedure, see the alternative below, using NetBeans.
To make sure everything was correctly installed, check the version of Ruby and Rails installed on your computer with the following commands:
ruby -v
rails -v
Installing and using NetBeans
To install the NetBeans development environment, first download the JDK from http://java.sun.com/javase/downloads/index.jsp.
Run the file, start the installation and wait until it is successfully finished.
At the end of the JDK installation, you can install Netbeans. You can download it from http://netbeans.org/downloads/; select the full version. Then run the setup application and follow the installation steps. If you experience any problems with NetBeans installation, probably the JDK was not installed correctly, simply reinstall it.
Let's create a new Ruby on Rails project and application to verify the installation.
To create a new application with NetBeans, select menu File > New Project. A new window will open as below:
In “Categories” select Ruby, and in Projects, select “Ruby on Rails Application”, then click Next (see figure below). In Project setup, you can:
- rename the project;
- select the server (WEBrick);
- directory to save the project;
- select the Ruby platform (Ruby 1.9.2-p0).
Note: If you can not see the option Ruby 1.9.2-p0, don`t worry, just click Manage... > Add Plataform…, point to directory %\Ruby192\bin and select ruby.exe.
Then click Next button, select the option a Configure a Using IDE Connections. Click Next button again.
If Rails has been installed successfully, select a version to use in your project (version 2.3.9 is currently the latest available in the 2.3 branch). If no version of Rails appears, a message that rails is not installed will be shown. To install, just click the 'Update Rails' button. In this case, NetBeans will search for the last version of Rails on Internet and install it.
The new application is ready for development.
To run the project press F6. The compiler will start WEBrick server and the browser and the following window will appear:
If your browser pops up a window like the image above, everything is working properly and you have a working Ruby on Rails application.