[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Testing Rails: problem running a Gruff sample

Skippy

1/30/2006 11:09:00 AM

Hi All,

I get errors when I try to run a Gruff sample for my WinXP/SP2 system and
get an error which I can't fathom.
The sample is "Code Sample" from http://nubyonrails.topfunky.com/p...
(scroll down to find it). I call it GraphicsTest.rb and display it below.

When I test it from within SciTE, I get:
>ruby GraphicsTest.rb
GraphicsTest.rb:6: uninitialized constant Gruff (NameError)
>Exit code: 1

Months ago, I had Gem, Ruby, FxRuby, Rails, etc. all beautifully installed
and working. I believe the GraphicsTest.rb sample ran fine at that time.
Then sometime later I had a brain cramp and deleted the entire installation.
Or maybe I was a victim of alien invaders :-)

I have now reinstalled everything using the one-click installer 1.8.2-15
Stable Release. Shown below is the list of installed components according to
"gem list --local".

I ran simple tests on the various components (except Gruff) successfully
until I tried to test Rails using the above sample. Any suggestions as to
how I might get this test running properly?

--
Regards,
Richard

*** LOCAL GEMS ***
actionmailer (1.1.5)
actionpack (1.11.2)
actionwebservice (1.0.0)
activerecord (1.13.2)
activesupport (1.2.5)
fxri (0.3.2)
fxruby (1.4.4, 1.2.6)
gruff (0.0.9)
rails (1.0.0)
rake (0.7.0)
sources (0.0.1)

=== GraphicTest.rb ===
#!/usr/bin/ruby

require 'rubygems'
require 'gruff'

g = Gruff::Line.new
g.title = "My Graph"

g.data("Apples", [1, 2, 3, 4, 4, 3])
g.data("Oranges", [4, 8, 7, 9, 8, 9])
g.data("Watermelon", [2, 3, 1, 5, 6, 8])
g.data("Peaches", [9, 9, 10, 8, 7, 9])

g.labels = {0 => '2003', 2 => '2004', 4 => '2005'}

g.write('my_fruity_graph.png')



4 Answers

Raj

2/1/2006 10:40:00 PM

0

Richard Lionheart wrote:
> Hi All,
>
> I get errors when I try to run a Gruff sample for my WinXP/SP2 system
> and
> get an error which I can't fathom.
> The sample is "Code Sample" from
> http://nubyonrails.topfunky.com/p...
> (scroll down to find it). I call it GraphicsTest.rb and display it
> below.
>
> When I test it from within SciTE, I get:
>>ruby GraphicsTest.rb
> GraphicsTest.rb:6: uninitialized constant Gruff (NameError)
>>Exit code: 1
>

I ran into the same issue and resolved it as follows:

You need to have RMagick installed and configured.

Instructions to install Rmagick on windows are here:
http://rmagick.rubyforge.org/install-fa...

However for the Rmagick install to work gem must be at 0.8.11 level.

In my case gem --version reported 0.8.10

So, I did the following to get gem updated:

gem install rubygems-update
update_rubygems

That took care of gem --version (reports 0.8.11)

Then I did the following:

downloaded RMagick-1.9.2-IM-6.2.4-6-win32.zip from the rubyforge site

unzipped it, then ran the following commands from the directory where
the files where unzipped to

gem -install RMagick-win32-1.9.2-mswin32.gem
postinstall.rb

Then ran a simple standalone program (same as the one you tried) that
used gruff and voila! everything worked.

Adding it to my test Rails application was a breeze after that.

Hope that helps.

Raj

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


Skippy

2/3/2006 1:16:00 AM

0

Hi Raj.


> You need to have RMagick installed and configured.

I didn't get a response in the first day after my post, so I thought the
Gruff wasn't of much interest to folks on this NG. I emailed Geoffrey
Grosenbach, the Gruff developer, directly and he was kind enough to tell me
the same thing, but he concluded "(I need to put together a simple
RMagick-only script for testing as well.)".

So your detailed guidance on how to install RMagick was very timely,
indeed -- and excellent!

> gem -install RMagick-win32-1.9.2-mswin32.gem

Just in case you post your instructions to some other poor soul, please note
that there's a hyphen in front of 'install'.

My "Code Sample" from http://nubyonrails.topfunky.com/p... worked
fine: it created a .png file in the same directory as the .rbw source file.

But another sample from http://topfunky.net/svn/gruff/test/ar...
didn't seem to work. I noted it didn't include the "require 'rubygems'"
that the preceding sample did, but including it didn't seem to make any
difference. If you have any take on this, I'd appreciate hearing your
advice.

> Hope that helps.

It certainly did. Thank you very much for taking the time to post it.

Best wishes,
Richard


Raj

2/11/2006 4:58:00 PM

0

Richard Lionheart wrote:
> Hi Raj.
> ...
> ...
>
> But another sample from http://topfunky.net/svn/gruff/test/ar...
> didn't seem to work. I noted it didn't include the "require 'rubygems'"
> that the preceding sample did, but including it didn't seem to make any
> difference. If you have any take on this, I'd appreciate hearing your
> advice.
>

Hi Richard,

I must have skimmed through this part of your post and did not pay
attention to the above point that I should have responded to. Hope this
is isnt too late... I was able to run the referenced sample first try
without any modifications whatsoever. I did create a test/output
directory before I ran the program. That was about it

Raj


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


Skippy

2/22/2006 1:19:00 AM

0

Hi Raj,

> I must have skimmed through this part of your post and did not pay
> attention to the above point that I should have responded to. Hope this
> is isnt too late... I was able to run the referenced sample first try
> without any modifications whatsoever. I did create a test/output
> directory before I ran the program. That was about it

I abandoned this for a while, so I didn't notice you latest post. I'll
give it another try in the next week or so.

Thanks for the follow-up.

Regards,
Richard