Windows

First, let’s install Ruby. Go get the One-Click Installer from the website (http://rubyinstaller.org/) by clicking Download and then clicking the highest-numbered version of Ruby you see there (version 2.0.0 as of this writing). When you run it, it will ask you where you want to install Ruby and which parts of it you want installed. Just accept all the defaults.

Now let’s make a folder on your desktop in which you’ll keep all of your programs. Right-click your desktop, select New, and then select Folder. Name it something truly memorable, such as programs. Now double-click the folder to open it.

To make a blank Ruby program, right-click in the folder, select New, and then select Text Document. Rename the document to have the rb file extension. So if it was "New Text Document.txt", rename it to "ponies.rb" (if your program was about ponies).

Now you need a text editor. I am a fan of Notepad++ (http://notepad-plus-plus.org/), so unless you already have a favorite text editor, go ahead and download and install that one.

To actually run your programs, you’ll need to go to your command line. In your Start menu, select Accessories, and then choose Command Prompt. You’ll see something like this:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:Documents and Settingschris>​_

(That cursor at the end will probably be blinking; it’s your computer’s way of asking, “What would you like?”)

So, here we are, at the command line, which is your direct connection to the soul of your computer. You want to be somewhat careful way down here, since it’s not too hard to do Bad Things (things such as erase everything on your computer). But if you don’t try anything too wacky, you should be fine.

So, here you are, basically just staring at your computer naked. It would only be polite to say “hello” at this point, so type echo hello on the command line, and press Enter. Your computer should reply with a friendly hello as well, making your screen look something like this:

C:Documents and Settingschris>​ echo hello
hello
C:Documents and Settingschris>​_

And your cursor is blinking again in a “What’s next?” sort of way. Now that you’re acquainted, ask it to make sure Ruby is installed properly and to tell you the version number. We do this with ruby -v:

C:Documents and Settingschris>​ ruby -v
ruby 2.0.0p195 (2013-05-14) [x64-mingw32]
C:Documents and Settingschris>​_

Great! All we have left now is to find your programs folder through your command line. It’s on your desktop, so we need to go there first. We do this with cd desktop:

C:Documents and Settingschris>​ cd desktop
C:Documents and SettingschrisDesktop>​_

So, now we see what the C:Documents and Settingschris was all about. That’s where we were on the command line. But now we’re on the desktop (or C:Documents and SettingschrisDesktop according to the computer).

Why cd? Well, way back in the olden days, before CDs (when people were getting down to eight-track cassettes and phonographs and such) and when command lines roamed the earth in their terrible splendor, people didn’t call them folders on your computer. After all, there were no pictures of folders (since this was before people had discovered crayons and Photoshop), so people didn’t think of them as folders. They called them directories. So, they didn’t “move from folder to folder.” They “changed directories.” But if you actually try typing change_directory desktop all day long, you barely have time to get down to your funky eight-track cassettes; so, it was shortened to just cd.

If you want to go back up a directory, you use cd ..:

C:Documents and SettingschrisDesktop>​ cd ..
C:Documents and Settingschris>​_

And to see all the directories you can cd into from where you are, use dir /ad:

C:Documents and Settingschris>​ dir /ad
Volume in drive C is System
Volume Serial Number is 843D-8EDC
Directory of C:Documents and Settingschris
07.10.2005 14:30 <DIR> .
07.10.2005 14:30 <DIR> ..
02.09.2005 10:45 <DIR> Application Data
04.10.2005 16:19 <DIR> Cookies
07.10.2005 14:24 <DIR> Desktop
15.08.2005 13:17 <DIR> Favorites
10.02.2005 02:50 <DIR> Local Settings
05.09.2005 13:17 <DIR> My Documents
15.08.2005 14:14 <DIR> NetHood
10.02.2005 02:50 <DIR> PrintHood
07.10.2005 15:23 <DIR> Recent
10.02.2005 02:50 <DIR> SendTo
10.02.2005 02:50 <DIR> Start Menu
25.02.2005 14:57 <DIR> Templates
25.02.2005 12:07 <DIR> UserData
0 File(s) 0 bytes
15 Dir(s) 6 720 483 328 bytes free
C:Documents and Settingschris>​_

And there you go!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.224.135