To get started, if you want to work with ruby you will need to download and install it on your pc. Ruby can run on a number of operating systems, but in my case I am working on a Windows pc. To download and install the latest version of ruby go to: www.rubyinstaller.org/downloads/ and select the latest ruby installer download. Once the download is complete double click the exe to install.
Once ruby is installed you will need to add the path the the ruby.exe to your environment variables path. Heres how to do it:
Windows XP : http://support.microsoft.com/kb/310519
Windows 7 : http://geekswithblogs.net/renso/archive/2009/10/21/how-to-set-the-windows-path-in-windows-7.aspx
Here is how you might create a hello world ruby script:
- Create a new folder for the scripts c:\rubyscripts
- Add a new text document in the folder called hello_world.rb
- Edit the script in your favourite text editor and add the following
puts "hello world"
- Open a command prompt in the c:\rubyscripts folder
- Run the following c:\rubyscripts\ruby hello_ruby.rb