Scott Rutherford

Life on and off the Rails

 

If you have seen this sort of thing:

ActionView::TemplateError: Expected image.rb to define Image

or this:

SystemExit (exit):
    /usr/local/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:70:in `exit'
    /usr/local/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:70:in `rootdir'
    /usr/local/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:84:in `directory'
    /usr/local/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:258:in `so_name'
    /usr/local/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:294:in `load_cache'
    /usr/local/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:678:in `inline'
    /usr/local/lib/ruby/gems/1.8/gems/image_science-1.1.3/lib/image_science.rb:84

in your log files when using ImageScience you may well of been a bit confused and frustrated – I was.

Then through a fair bit of googling I came across Stephen Sykes blog and his post which gave me the answer. It turns out that Ruby Inline a directory called “.ruby_inline” to store its extensions. It chooses this directory from either the environment setting INLINEDIR, or if that isn’t set then HOME – unfortunately for myself, Stephen and presumably yourself if this is of interest your server is probably running as a user without a HOME dir!!! To get around this simply add this to your environment.rb file (and make sure the server user has access!):

if RAILS_ENV == "production" 
  ENV['INLINEDIR'] = RAILS_ROOT + "/tmp" 
end

Not the clearest errors ever thrown!!!!

2 Responses to “ImageScience and RubyInline Errors”

  1. Ryan Davis Says:
    This issue is documented in my blog: http://blog.zenspider.com/archives/2007/05/image_science_and_deployment.html The "expected image.rb to define Image" is rails obfuscating an error. I hate that message because it can be anything wrong including a missing comma.
  2. chris nohr Says:
    Hi there, we seem to be having this problem, although even after setting INLINEDIR, and fixing the perms to meet the rubyinline security checks, it still craps out on us. Any brilliant thoughts? chris.
Leave a Reply

This blog used the Shay theme as a base and is powered by Mephisto