Jump To Content

Ruby Installation

What is Ruby?

Ruby is a cross-platform, interpreted and an object-oriented language. Ruby has been designed on the Principle of Least Surprise - Matz says "I wanted to minimize my frustration during programming, so I want to minimize my effort in programming. That was my primary goal in designing Ruby. I want to have fun in programming myself. After releasing Ruby and many people around the world got to know Ruby, they said they feel the way I feel. They came up with the phrase the principle of least surprise."

The year 2004 saw a massive surge of interest in Ruby, with the introduction of the Ruby on Rails Web application framework by David Heinemeier Hansson.

Yukihiro Matsumoto, commonly known as 'Matz' created the Ruby language in 1993. An interview with him in 2001, talks about the history of Ruby.

How Ruby can help you, in more detail

In David Black's book, 'Ruby for Rails', he mentions that a solid grounding in Ruby can serve you, as a Rails developer, in four ways:
  1. By helping you know what the code in your application (including Rails boilerplate code) is doing
  2. By helping you do more in, and with, your Rails applications than you can if you limit yourself to the readily available Rails idioms and techniques (as powerful as those are)
  3. By allowing you to familiarize yourself with the Rails source code, which in turn enables you to participate in discussions about Rails and perhaps even submit bug reports and code patches
  4. By giving you a powerful tool for administrative and organization tasks (for example, legacy code conversion) connected with your application
Downloading Ruby and an Editor

As an open source language, Ruby has been ported to run on many different computer platforms and architectures. This means that if you develop a Ruby program on one machine, it's likely you'll be able to run it without any changes on a different machine. You can use Ruby, in one form or another, on most operating systems and platforms.

The simplest way to get Ruby installed on a PC is by using the Ruby Installer for Windows. Click on ruby186-26.exe. After you have downloaded this, double-click this file and install Ruby on your PC, accepting all the defaults. After you have installed your Ruby software, the System Environment Variable path is already set to point to the bin folder of Ruby. Always check whether this has been set properly or not. If not, set it externally.

The installed Ruby includes the First Edition of Programming Ruby book and the SciTE code editor.

You'll find two executables in the Ruby Windows distribution. ruby.exe is meant to be used at a command prompt (a DOS shell), just as in the Unix version. For applications that read and write to the standard input and output, this is fine. But this also means that anytime you run ruby.exe, you'll get a DOS shell even if you don't want one - Windows will create a new command prompt window and display it while Ruby is running. This may not be appropriate behavior if, for example, you double-click a Ruby script that uses a graphical interface (such as Tk), or if you are running a Ruby script as a background task or from inside another program. In these cases, you'll want to use rubyw.exe. It is the same as ruby.exe except that it does not provide standard in, standard out, or standard error and does not launch a DOS shell when run.

Ruby releases with even subversion numbers - 1.6, 1.8, and so on are stable, public releases. However, in 2007 Matz broke with convention and made 1.9 a stable public release of Ruby.

Do note that these instructions assume that you are going to use a Windows platform. For installation on other platforms, you can refer here, here and here.

Ruby Programming Environment

Let's assume that you have installed Ruby in the folder c:/ruby, then the installation creates a number of sub-folders. The folders:

c:/ruby/bin is where the Ruby executables (including ruby and irb) have been installed.
c:/ruby/lib/ruby/1.8 you'll find program files written in Ruby. These files provide standard library facilities, which you can require from your own programs if you need the functionality they provide.
c:/ruby/lib/ruby/1.8/i386-mswin32 contains architecture-specific extensions and libraries. The files in this directory generally have names ending in .so or .dll (depending on your platform). These files are C-language extensions to Ruby; or, more precisely, they are the binary, runtime-loadable files generated from Ruby's C-language extension code, compiled into binary form as part of the Ruby installation process.
c:/ruby/lib/ruby/site_ruby folder is where you and/or your system administrator store third-party extensions and libraries. Some of these may be code you yourself write; others are tools you download from other people's sites and archives of Ruby libraries.
c:/ruby/lib/ruby/gems is the Ruby-Gems packaging system (more on this later).
c:/ruby/src is where you will find the Ruby source code.
c:/ruby/samples/RubySrc-1.8.6/sample is where you will find some sample Ruby programs.


  • Your comment will be modifiable for 10 minutes after posted.

Page Author

Avatar
IndianGuru
Name
IndianGuru

From Here You Can…

Information

Most Recent Related Content

Published In…