I’m having a problem getting Gruff working with Rails on a Windows XP
box.
I installed RMagick, then Gruff via the win32 gem, and it seemed to go
OK. From irb, I can do the following
require ‘rubygems’ ##### This returns ‘false’, but seems to work OK
require ‘gruff’ ####### Ditto
g = Gruff::Bar.new
etc., and I get a nice PNG file containing my graph
Despite the fact that the two ‘require’ statements are returning
false, Gruff still appears accessible.
Within Rails, it doesn’t seem to work at all. I’ve tried
require ‘gruff’
and
require ‘rubygems’
require ‘gruff’
at the top of a controller, but Rails falls over with
no such file to load – gruff
whenever I access that controller. It looks like Gruff isn’t there,
except that it actually works OK from irb (in spite of not appearing
to be there!!!).
On Thu, 2006-02-23 at 13:47 +1100, David M. wrote:
Thanks anyway. Got any other thoughts?
Hm, is there anything helpful in the logs? When I had this problem (on
Fedora Core 4) one of the problems was that ImageMagick couldn’t find
the font it wanted - in my case, it was Arial.ttf.
As “De Railed” suggested, what happens when you type “require ‘rmagick’”
in irb?
Gem::LoadError: Could not find RubyGem rmagick (> 0.0.0)
Hm, interesting! Seems like that may be the problem… if you do a
“gem list” from the command line, is rmagick in that list? Probably
not… do you get error messages when you do a “gem install rmagick”?
irb(main):001:0>require_gem ‘rmagick’
Gem::LoadError: Could not find RubyGem rmagick (> 0.0.0)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:204:in
report_activate_ error' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:141:inactivate’
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:37:in require_gem_with_ options' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:31:inrequire_gem’
from (irb):1
irb(main):002:0>
Absolutely nothing in the Webrick log…
As I said earlier, even though require_gem ‘gruff’ fails, from within
irb I can still create new Gruff objects successfully.
On Fri, 2006-02-24 at 08:35 +1100, David M. wrote:
That’s why I resorted to downloading RMagick by hand
(RMagick-1.9.2-IM-6.2.4-6-win32.zip).
Ah, that’s right, Tim distributes a prebuilt win32 binary, I’d forgotten
about that.
It seems to have (sort of) worked, because I can
create a .png graph from Gruff under irb; it’s just the require…
returning a false that seems to be catching me out.
Hm. I’m flummoxed… if anything else occurs to me, I’ll let you
know…
‘gem list’ includes
RMagick-win32 (1.9.2)
RMagick is an interface between the Ruby programming language and
the ImageMagick and GraphicsMagick image processing libraries.
so it looks like it’s there OK.
I just did another ‘gem install rmagick’ to see if it made any
difference. I forgot this happened before, but this is what I got:
Attempting local installation of ‘rmagick’
Local gem file not found: rmagick*.gem
Attempting remote installation of ‘rmagick’
Updating Gem source index for: http://gems.rubyforge.org
Building native extensions. This could take a while…
configure:1: Can’t exec \bin\sh (fatal)
ERROR: While executing gem … (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in
c:/ruby/lib/ruby/gems/1.8/gems/rmagick-1.10.0
for inspection.
ruby configure install rmagick\n
Results logged to
c:/ruby/lib/ruby/gems/1.8/gems/rmagick-1.10.0/gem_make.out
That’s why I resorted to downloading RMagick by hand
(RMagick-1.9.2-IM-6.2.4-6-win32.zip). This file contained a
RMagick-win32-1.9.2-mswin32.gem, which installed without problems. I
then ran ‘postinstall.rb’ as per the README file, and it also ran
without problems. It seems to have (sort of) worked, because I can
create a .png graph from Gruff under irb; it’s just the require…
returning a false that seems to be catching me out.
Thanks again
Dave M.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.