Absolute Beginner - Where to run program?

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! :smiley:

-m

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

···

On 5/12/07, MichaelCuculich@gmail.com <MichaelCuculich@gmail.com> wrote:

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?

--

A Look into Japanese Ruby List in English

MichaelCuculich@gmail.com writes:

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

Start Menu -> /Programs/Accessories/Command Prompt

sherm--

···

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net

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

···

On 5/12/07, MichaelCuculich@gmail.com <MichaelCuculich@gmail.com> wrote:

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: Ruby in Twenty Minutes

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

--

A Look into Japanese Ruby List in English

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.

···

On May 11, 9:47 pm, MichaelCucul...@gmail.com wrote:

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: Ruby in Twenty Minutes

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! :smiley:

-m

I suggest that you use eclipse.

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."

···

--
Posted via http://www.ruby-forum.com/.

From: MichaelCuculich@gmail.com [mailto:MichaelCuculich@gmail.com]
Sent: 12 May 2007 05:50
To: ruby-talk ML
Subject: Absolute Beginner - Where to run program?

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

Click Start -> Run, type 'cmd' (without quotes) and hit enter :slight_smile:

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?

The 'shell' under Windows is not very powerful compared to a Unix shell, and
the Windows shell does not support the same set of commands as Unix.

Just a quick overview, try some of these commands:

dir (lists the contents of the current directory)
cd <dir> (change to the directory specified)
mkdir <dir> (creates the directory specified)
rmdir <dir> (removes the directory specified - only if empty)

That's probably about all you'll need :slight_smile: Oh, and all paths on Windows use
a backslash character (\) whereas paths on Unix are specified using forward
slashes (/). E.g. "C:\Windows\System32" on Windows, vs "/usr/bin" on Unix.

So, for example, to create a 'work' directory on the root of your C drive
and move to it:

cd \
mkdir work
cd work

If you now go to your C drive through My Computer, you'll see a 'work'
directory :slight_smile:

Oh, and to change to another drive entirely (e.g. if you are on your C drive
and you wish to change to your D drive) - just type the name of the drive
followed by a colon. For example, to change to your D drive, just type:

D:

That's it :slight_smile:

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! :smiley:

Not silly at all :slight_smile: Same with any knowledge. You don't know until you
know :slight_smile:

Incidentally, someone suggested you should use Eclipse. Please, for your
own sake don't even think about using an IDE like Eclipse until you are
familiar with how things work without one. Otherwise as soon as something
goes wrong you'll have no idea why and you'll have a mountain of other
things to learn first before you can solve your problems. Keep it simple
until you feel it nescessary to move onto something advanced.

My 2 pence :slight_smile:

Cliff

···

-----Original Message-----

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

First of all, let me say that the following terms you might find in
tutorials or books all mean basically the same: Command line, Command
Prompt, DOS Prompt, Terminal, Shell, Console and probably a few more.

Another thing: If you installed from the One-Click-Installer you also
should have the file extension .rb been associated with the ruby
interpreter. This means if you double-click of a file (let's say
'test.rb') it will automatically open a Command Prompt and run ruby on
your file (with the command 'ruby test.rb') in the directory it is
saved. If your Command Prompt opens and directly closes and you can't
see the output of your program this means that your program has
terminated and therefore the Command Prompt was closed. To avoid that
you can tell somewhere (I can't remember where - I'm running Linux here)
to let you close the window manually or simply put a 'gets' at the end
of your source file ('test.rb'). This is a method that asks for user
input via the keyboard and therefore your program won't close until you
hit the <Return> key.

Cheers,

Christian Luginbuehl

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

Hope that helps.

David

···

On May 12, 12:47 am, MichaelCucul...@gmail.com wrote:

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

-m

found it! thanks to all! :slight_smile:
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! :slight_smile:

···

On May 12, 9:26 am, mully <david.mul...@gmail.com> wrote:

On May 12, 12:47 am, MichaelCucul...@gmail.com wrote:

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

> -m

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

Introduction to the Windows Command Prompt

Hope that helps.

Davidhttp://rubyonwindows.blogspot.com

MichaelCuculich@gmail.com wrote:

···

On May 12, 9:26 am, mully <david.mul...@gmail.com> wrote:
  

On May 12, 12:47 am, MichaelCucul...@gmail.com wrote:

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

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

Introduction to the Windows Command Prompt

Hope that helps.

Davidhttp://rubyonwindows.blogspot.com
    
found it! thanks to all! :slight_smile:
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! :slight_smile:

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.

--
RMagick [http://rmagick.rubyforge.org]
RMagick Installation FAQ [http://rmagick.rubyforge.org/install-faq.html\]

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

···

On May 12, 2:20 pm, MichaelCucul...@gmail.com wrote:

On May 12, 9:26 am, mully <david.mul...@gmail.com> wrote:

> On May 12, 12:47 am, MichaelCucul...@gmail.com wrote:

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

> > -m

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

>Introduction to the Windows Command Prompt

> Hope that helps.

> Davidhttp://rubyonwindows.blogspot.com

found it! thanks to all! :slight_smile:
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! :slight_smile:

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

···

On May 12, 5:20 pm, MichaelCucul...@gmail.com wrote:

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! :slight_smile:

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.

···

On May 13, 2007, at 7:35 AM, mully wrote:

On May 12, 5:20 pm, MichaelCucul...@gmail.com wrote:

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! :slight_smile:

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

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' :wink:

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.

···

On 5/13/07, John Joyce <dangerwillrobinsondanger@gmail.com> wrote:

On May 13, 2007, at 7:35 AM, mully wrote:

> On May 12, 5:20 pm, MichaelCucul...@gmail.com wrote:
>
>> 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! :slight_smile:
>

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.

--
Bill Guindon (aka aGorilla)
The best answer to most questions is "it depends".