Wednesday, June 28, 2006

missing gems/plugins

The designer of a project I'm working on decided to use the RedCloth ruby gem in the project we're working on. He installed the gem on his local machine and added "require 'RedCloth'" to environment.rb. Now, since he installed a gem and ruby gems by default are stored in the ruby installation directory, the source repository did not contain the RedCloth library. Unforunately I forgot to get the RedCloth gem. So when I updated my project source from SVN the project broke output in development.log. I eventually figured out that I was missing the gem. So I downloaded the gem, then moved the whole RedCloth folder into the vendor/plugins directory of the rails project. The lack of error messages pointing me to the "require 'RedCloth'" was annoying to say the least. Maybe the require statement should be moved someplace else? Someplace after the logger has been initialized maybe? I wonder if other error/issues in enviroment.rb will make WEBrick die out too. Maybe you can start WEBrick with some advanced debugging for these kinds of situations? Hmm, I guess I should do a little research...


Anonymous james said...

After getting clued in to the role the vedor/ dir plays in a Rails app, I've masde it a habit of putting all external code there. When I packge up and deliver code to a client, or a co-worker checkes ut the source, or we deploy someplace,I want to be sure everything is available.

Curious about the error message. I have this at the tail end of an environment.rb file, which leads me to believe I've had the same annoyance you ran into:

# Include your application
# configuration below
require 'base-model'
require 'risk_areas'
require 'misc-utils'
require 'string-utils'
rescue Exception
STDERR.puts( "Failed to load extra libs: #{$!}" )
raise $!

(Sorry about the formatting; have no idea how force preformated rendering.)

6/28/2006 06:37:00 PM

Blogger Ben said...

Thanks for the tip James! I'll start making a habit of catching exceptions in environment.rb.

6/28/2006 08:18:00 PM


Post a Comment

<< Home