Getting started with Ruby on rails
By: Emiley J.
First of all you have to check whether Ruby is already installed in your computer. To do that you can follow these steps.
Ruby runs on Windows 2000, Windows XP, or later; Mac OS X; and any version of Unix youâ€™re likely to find. You may already have Ruby installed on your machine. To find out, type this at the command
prompt> ruby -v
If you see a complaint like â€œcommand not found,â€ youâ€™ll have to install Ruby.
If Ruby is installed, the response will look something like this:
ruby 1.8.1 (2003-12-25) [powerpc-darwin]
There is a one-click Ruby installer. You can find it here: http://www.ruby-lang.org/en/downloads/. After you download it, double-click it in Windows Explorer to run it, and then follow the directions. After installing Ruby, close any command-line windows, open a new one, and then follow the directions above to check the installation.
in Mac OS X
Tiger (version 10.4) and later versions of Mac OS X come with recent enough versions of Ruby. If youâ€™re using an older release of OS X, see http://www.ruby-lang.org/en/downloads/
Other Unix Variants
You may be able to find precompiled versions of Ruby (RPMs, etc.) in the usual places and retrieve them via the usual tools (apt-get, pkg-get, ports, etc.).
Your Two Basic Tools to use Ruby on rails
There are two basic tools: an editor and an interpreter.
You can use any editor that works with text files to create Ruby scripts. On Windows, I recommend you use SciTE, which is installed with Ruby. Itâ€™s more than just a text editor: it understands Ruby well enough to color-code parts of a script to make it easier to read, and it lets you run scripts without having to switch to the command line. (In the Start menuâ€™s Programs entry, youâ€™ll find a Ruby entry, and SciTE is under that.)
On a Mac, I recommend TextMate (http://macromates.com/). It costs money, but you can try a free download. On the Mac and other Unix-like systems, you can use pico. Itâ€™s free. Start it by typing its name at the command prompt. It shows its available editing commands at the bottom of the screen. In that help,
Control + X is denoted by Ë†X.
If you use the Gnome window system on Linux, gedit is worth trying.
The second useful tool is irb. It lets you try your ideas without having to write a whole script. You can type a little snippet of Ruby and quickly check what it does. Now check that irb is ready for use. At the command prompt, type the following. (Remember not to include the prompt.)
Youâ€™ll see something like this:
Most of the pieces of the prompt are unimportant. Now type a Ruby expression, and press Enter (on Windows) or Return (on Unix-like systems):
irb displays the result and then prompts you to type something more. 2 is the result of evaluating the expression 1+1.
Exit from irb like this:
1. Thanks dear
View Tutorial By: Muthin at 2009-04-29 00:32:24
Comment on this tutorial
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews
Using Proxy to connect to URLs in Ruby
Open and manipulate CSV files in Ruby
dRuby client/server mode sample program
Using remote objects under dRuby
Reading URL content using Ruby (HTTP)
Traversing all files in a directory using Ruby