How to inject code before plugins load


#1

I’m having problem with the RMagick requires – my dev and prod systems
each only work with a different require line (require ‘rmagick’ on OSX
dev; require ‘RMagick’ on FC5 prod). After many many hours wasted trying
to figure out WHY they are acting differently, I’m cutting my losses and
going with a hack, like this:

begin
puts “RMagick was loaded properly on startup.” if Magick
rescue NameError
require ‘RMagick’
puts “RMagick loaded after startup with require ‘RMagick’.”
end

This works. However, because one of my plugins (validates_captcha) needs
RMagick, I can’t put that code in environment.rb, which is run after
the plugins are loaded. Is there a way to inject this block before the
plugins are loaded?

Thanks!

/afb


#2

Is there a way to inject this block before the
plugins are loaded?

Yes…just put the code above the existing require line in
environment.rb. Duh.

Doesn’t solve my problem, though, since the plugin is hard coded to look
for the RMagick lib named in a way that breaks FC5. Time to edit the
plugin. :frowning:

/afb