Absolute Beginner - Where to run program?

M

MichaelCuculich

hello there,

i am an absolute beginner, so my question might seem rather silly. i
just installed ruby 186-25 using the windows installer- my computer is
windows xp.

my first step was to follow the "ruby in twenty minutes" tutorial. at
a certain point they tell you to close the fxri consule in order to
create a ruby program on a file. so far so good. they then tell you
to run the file by typing "ruby ri20min.rb"
here is the tutorial: http://www.ruby-lang.org/en/documentation/quickstart/3/

that is all fine, but my question is: where do you type that command
line?

another tutorial i was looking at said to find out what version you
have installed to type "ruby -v" in the shell - but what exact is the
shell? the unix shell? if i am using windows xp where do i find that
exactly?

i know this may be a really silly question, and i bet it's so simple
that they don't post this information anywhere. i'm almost
embarrassed to ask. but i'd appreciate a kick start here- thanks! :D

-m
 
H

Harry Kakueki

hello there,

another tutorial i was looking at said to find out what version you
have installed to type "ruby -v" in the shell - but what exact is the
shell? the unix shell? if i am using windows xp where do i find that
exactly?
Hi,

You can type 'ruby -v' in at the command prompt.
I think you can find that under Start-Accessories-Command prompt.
I'm on Japanese XP so I'm not sure of the exact English wording they use.

This window will allow you to type DOS commands and run ruby programs, etc.

Harry
 
H

Harry Kakueki

hello there,


my first step was to follow the "ruby in twenty minutes" tutorial. at
a certain point they tell you to close the fxri consule in order to
create a ruby program on a file. so far so good. they then tell you
to run the file by typing "ruby ri20min.rb"
here is the tutorial: http://www.ruby-lang.org/en/documentation/quickstart/3/

that is all fine, but my question is: where do you type that command
line?
I'm not familiar with that tutorial, but have you already created your
file using notepad or some other editor?

To run the Ruby program, you will need to navigate to the directory
containing your file (ri20min.rb) and type 'ruby ri20min.rb'.


Harry
 
Z

zotobi

hello there,

i am an absolute beginner, so my question might seem rather silly. i
just installed ruby 186-25 using the windows installer- my computer is
windows xp.

my first step was to follow the "ruby in twenty minutes" tutorial. at
a certain point they tell you to close the fxri consule in order to
create a ruby program on a file. so far so good. they then tell you
to run the file by typing "ruby ri20min.rb"
here is the tutorial: http://www.ruby-lang.org/en/documentation/quickstart/3/

that is all fine, but my question is: where do you type that command
line?

another tutorial i was looking at said to find out what version you
have installed to type "ruby -v" in the shell - but what exact is the
shell? the unix shell? if i am using windows xp where do i find that
exactly?

i know this may be a really silly question, and i bet it's so simple
that they don't post this information anywhere. i'm almost
embarrassed to ask. but i'd appreciate a kick start here- thanks! :D

-m

What you need is the command prompt. If you can't find it with what
Sherm said, try going to Run (shortcut: Startbutton+R, the startbutton
on your keyboard) and typing in 'cmd' and hitting enter. That should
do it.
 
L

Lloyd Linklater

I suggest that you use eclipse.

http://www.eclipse.org/

Then, get the Ruby for Eclipse add ons:
http://www-128.ibm.com/developerworks/opensource/library/os-rubyeclipse/

Then, run eclipse. In the menu go to
window->preferences->ruby->installed interpreters. Click add and point
to the ruby directory.

Then, write a simple program. You might copy and paste this one to start
with:

10.times {puts 'Lloyd is the greatest!'}

and hit the run button. It is ever so much better than "Hello world."
 
M

MichaelCuculich

As Sherm mentioned, you'll want to open a command/console window.
You'll find further details on the Windows Command Prompt here...

http://www.bleepingcomputer.com/tutorials/tutorial76.html#intro

Hope that helps.

Davidhttp://rubyonwindows.blogspot.com

found it! thanks to all! :)
when creating these ruby files, is there a specific place that you
should put them and/pr run them from? in other words, when i create
this sample ruby program, should i just put it in the C:/ruby folder?
or is it better "form" to create a folder for them, etc.? just
wondering...
in any case, thanks! :)
 
T

Tim Hunter

found it! thanks to all! :)
when creating these ruby files, is there a specific place that you
should put them and/pr run them from? in other words, when i create
this sample ruby program, should i just put it in the C:/ruby folder?
or is it better "form" to create a folder for them, etc.? just
wondering...
in any case, thanks! :)
I would keep them separate from the Ruby files themselves. You may need
to delete that directory for some reason or upgrade Ruby and you don't
want to run the risk of erasing all your Ruby programs.

I keep my Ruby programs in C:\rb.
 
Z

zotobi

found it! thanks to all! :)
when creating these ruby files, is there a specific place that you
should put them and/pr run them from? in other words, when i create
this sample ruby program, should i just put it in the C:/ruby folder?
or is it better "form" to create a folder for them, etc.? just
wondering...
in any case, thanks! :)

Probably better to put it in a separate folder from your ruby
installation just to keep things neat and clear.
 
M

mully

when creating these ruby files, is there a specific place that you
should put them and/pr run them from? in other words, when i create
this sample ruby program, should i just put it in the C:/ruby folder?
or is it better "form" to create a folder for them, etc.? just
wondering...
in any case, thanks! :)

Good question! I agree with zotobi that's it's definitely best to
create a separate folder for your ruby scripts, outside your ruby
install folder. This ensures that your scripts don't get blown away by
changes to your ruby installation folder.

I'll soon be posting a Ruby on Windows FAQ to my blog. You've asked
good questions here, which I plan to include in that article.

David

http://rubyonwindows.blogspot.com
 
J

John Joyce

Good question! I agree with zotobi that's it's definitely best to
create a separate folder for your ruby scripts, outside your ruby
install folder. This ensures that your scripts don't get blown away by
changes to your ruby installation folder.

I'll soon be posting a Ruby on Windows FAQ to my blog. You've asked
good questions here, which I plan to include in that article.

David

http://rubyonwindows.blogspot.com

It's not only a Ruby issue, but organizing files is an interesting
issue. There are many approaches. Notice how files are organized in
the operating system. Windows and various *nix's organize things in
various ways. Web sites as well tend to have a few different ways
that files are commonly organized.
So you may want to create a directory (folder) that holds all or most
of the stuff you create for one language (such as RubyStuff).
Then another for each grouping. So if you start working through
exercises in a book on Ruby, create a directory just for that book's
exercises. Directory tree structure is as important as anything else
in planning a program. Rails for example has its own directory tree
structure. It is a pretty well thought out one too. There are a few
directories in Rails that are legacy things from older versions, but
most of it makes a lot of sense once you start to get familiar with
it. The environment (the OS and the way it is structured and the way
it works) is as much a part of your programs as anything else!
Just something to think about. It becomes more clear as you go along.
Different kinds of projects demand different sensibilities in
organization.
 
B

Bill Guindon

It's not only a Ruby issue, but organizing files is an interesting
issue. There are many approaches. Notice how files are organized in
the operating system. Windows and various *nix's organize things in
various ways. Web sites as well tend to have a few different ways
that files are commonly organized.
So you may want to create a directory (folder) that holds all or most
of the stuff you create for one language (such as RubyStuff).
Then another for each grouping. So if you start working through
exercises in a book on Ruby, create a directory just for that book's
exercises. Directory tree structure is as important as anything else
in planning a program. Rails for example has its own directory tree
structure. It is a pretty well thought out one too. There are a few
directories in Rails that are legacy things from older versions, but
most of it makes a lot of sense once you start to get familiar with
it. The environment (the OS and the way it is structured and the way
it works) is as much a part of your programs as anything else!
Just something to think about. It becomes more clear as you go along.
Different kinds of projects demand different sensibilities in
organization.

I completely agree with John. Over time, you'll probably end up with
not only a Ruby directory, but subdirectories below it. Of course,
you don't have to do that immediately, but you might want to.

Personally, I like to have at least one 'junk' directory, a place
where I drop small experiments that may one day become something
useful, or that I can turn back to when I get hit with the same
question months later. In the past, I've called it 'sandbox', or
'playground', my current one is called 'anarchy' - it's where
'anything goes' ;-)

Some ideas:
ruby\learning # 'primitive' stuff that beginners write.
ruby\sandbox # useful examples, or test scripts.
ruby\apps\someapp # when you actually have working apps
ruby\quiz # if you do the quizes, you should group them, with a dir for each.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top