Newbie having trouble at my first task. Please Help!

I am trying to teach myself programming as a complete beginner. I use a
windows XP laptop. I have read up some of the basic concepts on Hackety
Hack and am now trying to use Chris P.s book ‘Learn to program’

I have installed Ruby 1.9.3 on my computer using an installer from here:
http://rubyinstaller.org/downloads/ but am unsure if it is definitely
working.

The book says to download the latest version from rubyinstaller.org.
After that it says to make a new desktop folder and name it programs.
Done.

Now click the programs folder open and right-click in the
folder->New->Select Ruby P… Which no such file exists. What do I
do?

I have also downloaded the text editor sciTE.

These are the exact instructions I was given on page 17 of the book:

“First, let’s install Ruby. Go get the One-Click Installer from the
website
(http://rubyinstaller.rubyforge.org/wiki/wiki.pl) by clicking Download
and
then clicking the highest-numbered version of Ruby you see there
(version
1.8.6-26 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 doubleclick
the folder to open it.
To make a blank Ruby program, right-click in the folder, select New,
and then select Ruby P… You can rename the file if you want,
but make sure to keep the .rb file extension, since that’s what tells
your
computer this is a Ruby program (and not an email or a picture of Mr.
Bean or something).
Now, when you installed Ruby, you also installed a really nice text
editor called SciTE (which is what I use when I’m on Windows or Linux).
To use it to edit your new program, right-click your program, and select
Edit. (When you get to the next chapter, you’ll even write a program”

I’ve tried turning a text file into an .rb extention but it wont give me
the option. How should I do this? Is there a way to check if ruby
installer is working on my laptop?

When I got to the installer section: ‘Installation Destination and
optional tasks.’ It asked me if I wanted 3 potional tasks: '1. Install
Tcl/Tk support. 2.Add Ruby executables to your PATH 3.associate .rb and
.rbw files with this ruby installation.

I dont understand any of these and the default is all 3 are unselected,
so I didn’t select any of them. Was this the right thing to do?

Any help would be much appreciated!

Thank you! :slight_smile:

Hi Joshua,

I might be wrong, but I believe at the very least you’re going to want
to
add Ruby executables with your PATH. I clicked all three. Adding Ruby to
your PATH allows you to run Ruby files from anywhere in the command
terminal, not just the folder where Ruby itself was installed. More help
will be needed on this topic as I’m obviously not an expert.

Jay

They’re unticked by default in case you’re running multiple Ruby
versions side-by-side. If it’s your first or only install, you’ll want
to tick all 3.

Open up a text editor (I use sublimetext, but there are many out there).
Type in this exactly:
puts “Hello world”

Then save the file as helloworld.rb.

And voila! You’ve created your first .rb file. Your best bet is to run
this
in the command terminal. Are you familiar with the command terminal at
all?

Thank you Jason and Joel! This really helps. I’m getting there slowly
but surely, still not sure how to create a .rb file!

I got so excited I was gonna nail this Jason, but when I get to: “save
as” in my text editor, I only have the option to change the file name,
there are no opitons in file type. I literally cannot chose a .rb
extention even though i want to. The option isnt there?! …so
frustrating. But thank you for the advice Jason.

a file that has the .rb extention is a ruby file. There is nothing
magical about it (except that it contains ruby code). :wink:

Any text editor including the barebones Notepad application in Windows
can work as an editor.

put in some basic ruby code, then save the file. Add the .rb extention
onto the name and you’re done.

that creates the .rb file.

Wayne B. wrote in post #1127897:

a file that has the .rb extention is a ruby file. There is nothing
magical about it (except that it contains ruby code). :wink:

Any text editor including the barebones Notepad application in Windows
can work as an editor.

put in some basic ruby code, then save the file. Add the .rb extention
onto the name and you’re done.

that creates the .rb file.

Oohhh, onto the NAME! I thought .rb was a file type!! Thank you!

All you have to do when you save the file is type .rb at the end. This
will
save it as a Ruby file. No need to choose the extension in the drop-down
menu.

Thank you Jason and Wayne! I am now happily typing away on the command
line and getting very simple programmes to run, all thanks to you guys!
I’m already on page 23 now, hopefully it will be a while before I am
back here on the forums.

Thank you both so much again!

More than happy to help. I’m a beginner too, and I’ve been able to make
strides learning Ruby thanks to the amazing community of people willing
to
help out. I’ve read Chris’ book twice now and it really is an incredibly
resource.

I’d highly recommend installing Notepad++. It’ll give you a right-click
option to edit text files, including .rb files. It can highlight syntax
for you, and do loads of other awesome things like Regexp find &
replace.

You’ll want to do this if you haven’t already:
Inside any folder -> Folder and Search Options
Select the View tab
Untick “hide extensions for known file types”
Now you can see which files are .rb

The exact steps will vary on different versions of Windows.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs