[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby with Mac OS X

Tj Superfly

1/19/2008 4:38:00 AM

Hello everyone,

I have a friend that is having some trouble getting a ruby program to
work on her Mac.

I'm kind of wondering if there is anything she can do, I've looked all
over the internet and things, are there any mac users that might be
willing to put in a word of advice?

Thanks.
--
Posted via http://www.ruby-....

21 Answers

Hassan Schroeder

1/19/2008 5:21:00 AM

0

On Jan 18, 2008 8:37 PM, Tj Superfly <nonstickglue@verizon.net> wrote:

> I have a friend that is having some trouble getting a ruby program to
> work on her Mac.
>
> I'm kind of wondering if there is anything she can do,

Yep.

> are there any mac users that might be willing to put in a word of advice?

Sure, several words: provide some real information about the specific
problem and the environment in which it's happening... :-)

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

Tj Superfly

1/19/2008 5:26:00 AM

0

She can't find the run file.

She's installed "ruby" but it will only open the .rb file in a text
editor.

When she clicks on other (to locate another program) we can't find
anything ruby related.

Does that help?

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

Hassan Schroeder

1/19/2008 5:31:00 AM

0

On Jan 18, 2008 9:25 PM, Tj Superfly <nonstickglue@verizon.net> wrote:
> She can't find the run file.
>
> She's installed "ruby" but it will only open the .rb file in a text
> editor.
>
> When she clicks on other (to locate another program) we can't find
> anything ruby related.
>
> Does that help?

Not really. What program are you trying to run? What version of
Mac OS and Ruby are installed?

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

Tj Superfly

1/19/2008 5:36:00 AM

0

Hassan Schroeder wrote:
> On Jan 18, 2008 9:25 PM, Tj Superfly <nonstickglue@verizon.net> wrote:
>> She can't find the run file.
>>
>> She's installed "ruby" but it will only open the .rb file in a text
>> editor.
>>
>> When she clicks on other (to locate another program) we can't find
>> anything ruby related.
>>
>> Does that help?
>
> Not really. What program are you trying to run? What version of
> Mac OS and Ruby are installed?

Mac OS 10.5 (leopard)

it said that ruby 1.9.0 is installed

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

Steve Ross

1/19/2008 6:54:00 AM

0


On Jan 18, 2008, at 9:35 PM, Tj Superfly wrote:

> Hassan Schroeder wrote:
>> On Jan 18, 2008 9:25 PM, Tj Superfly <nonstickglue@verizon.net>
>> wrote:
>>> She can't find the run file.
>>>
>>> She's installed "ruby" but it will only open the .rb file in a text
>>> editor.
>>>
>>> When she clicks on other (to locate another program) we can't find
>>> anything ruby related.
>>>
>>> Does that help?
>>
>> Not really. What program are you trying to run? What version of
>> Mac OS and Ruby are installed?
>
> Mac OS 10.5 (leopard)
>
> it said that ruby 1.9.0 is installed

If you're expecting some zippy IDE, that's not really what Ruby is
about. Ruby is a programming language.

Open a terminal window (it's under Applications:Utilities)

Enter some text in a text editor (emacs, vim, vi, ...):

1.upto(3){|n| puts "hello #{n}"}

save it as hello.rb.

type:

ruby hello.rb

results are:

hello 1
hello 2
hello 3

Does this get you started more in the right direction?

Tj Superfly

1/19/2008 3:40:00 PM

0

Okay, we've got programs running!

Thanks for that.

Now, the program I've created pulls information from a .yaml file. It
works fine on windows, but it says

"Macintosh: ~Xepha$ ruby /users/Xepha/Documents/for-v/numbered_news.rb
/users/Xepha/Documents/for-v/numbered_news.rb:14: uninitialized constant
YAML (NameError)"

So, all the files are in the correct place, there is data inside of the
files, why won't YAML files work?
--
Posted via http://www.ruby-....

Windham, Kristopher R.

1/19/2008 4:55:00 PM

0

not sure what you are trying to do there..

This might help:

Constants in Ruby
A variable whose name begins with an uppercase letter (A-Z) is a
constant. A constant can be reassigned a value after its
initialization, but doing so will generate a warning. Every class is
a constant.

Trying to substitute the value of a constant or trying to access an
uninitialized constant raises the NameError exception.

perhaps you need to read up a little more about Ruby Syntax?

If you send the code for numbered_news.rb I'm sure someone on this
list can help..



On Jan 19, 2008, at 10:39 AM, Tj Superfly wrote:


> Okay, we've got programs running!
>
> Thanks for that.
>
> Now, the program I've created pulls information from a .yaml file. It
> works fine on windows, but it says
>
> "Macintosh: ~Xepha$ ruby /users/Xepha/Documents/for-v/numbered_news.rb
> /users/Xepha/Documents/for-v/numbered_news.rb:14: uninitialized
> constant
> YAML (NameError)"
>
> So, all the files are in the correct place, there is data inside of
> the
> files, why won't YAML files work?
> --
> Posted via http://www.ruby-....
>


Tj Superfly

1/19/2008 5:03:00 PM

0

Well, I'm using it with arrays, here's a clip of the code that I'm
using.

captions_number = YAML.load(File.open("arrays/captions_number.yaml"))
captions = YAML.load(File.open("arrays/captions_array.yaml"))
captions_delete = []

Basically that clip right there opens the files and sets them for an
array that I use later in the program. I then at the end, send out all
the updates arrays to the files so when it loops back through the array
is updated. This way I can close the program and my arrays are still set
where they were left off.

Like I said it works great in windows, not sure why it's not working
with the Mac.
--
Posted via http://www.ruby-....

Tim Hunter

1/19/2008 5:07:00 PM

0

Tj Superfly wrote:
> Well, I'm using it with arrays, here's a clip of the code that I'm
> using.
>
> captions_number = YAML.load(File.open("arrays/captions_number.yaml"))
> captions = YAML.load(File.open("arrays/captions_array.yaml"))
> captions_delete = []
>
> Basically that clip right there opens the files and sets them for an
> array that I use later in the program. I then at the end, send out all
> the updates arrays to the files so when it loops back through the array
> is updated. This way I can close the program and my arrays are still set
> where they were left off.
>
> Like I said it works great in windows, not sure why it's not working
> with the Mac.

Ask rather why it's working on Windows. The yaml library is not
available by default. You have to require it first. Add this to the top
of your script.

require 'yaml'


--
RMagick: http://rmagick.ruby...
RMagick 2: http://rmagick.ruby...rmagick2.html

Windham, Kristopher R.

1/19/2008 5:17:00 PM

0

require 'yaml'

seems like you may want to back up and do some more reading..

here's a good starting point...
http://en.wikibooks.org/wiki/Ruby_P...

On Jan 19, 2008, at 12:03 PM, Tj Superfly wrote:

> Well, I'm using it with arrays, here's a clip of the code that I'm
> using.
>
> captions_number = YAML.load(File.open("arrays/captions_number.yaml"))
> captions = YAML.load(File.open("arrays/captions_array.yaml"))
> captions_delete = []
>
> Basically that clip right there opens the files and sets them for an
> array that I use later in the program. I then at the end, send out all
> the updates arrays to the files so when it loops back through the
> array
> is updated. This way I can close the program and my arrays are
> still set
> where they were left off.
>
> Like I said it works great in windows, not sure why it's not working
> with the Mac.
> --
> Posted via http://www.ruby-....
>