Saturday, June 04, 2011

Take a look at that gem!

Attempting to upload an image to the refinerycms system yielded a stack trace returned to the user. In this case, refinery's images_controller is picking up an error in dragonfly.

When we try to upload an image in refinery, we get

Let's check out the top file

So it appears that the error has to do with the IO.popen. Since we know we wouldn't need that call if "use_filesystem" were true, and since line 9 suggests there is a configuration directive for this setting somewhere. We should try to find it.

So we go down the stack trace to the last known point the execution was in another gem. It turns out to be images_controller in the refinerycms gem.

Knowing the name of the controller , I tried some bash-fu and was presently suprised when it worked!

None the less. There did not appear to be any configuration in that file. I went to the refinery gem root's directory and did a "grep -R dragonfly ." to flesh out any config files. I noticed "lib/refinerycms-images.rb."

We check out the file and see the Dragonfly app initialization at line 22. We google around for the Dragonfly docs looking for a reference to where exactly the "use_filesystem" configuration directive must be set. Our search lands us on docs for Dragonfly::Analysis::FileCommandAnalyser

An example for the config is referenced which includes the directive we are looking for.

We then modify the source of lib-refinerycms.rb to include the modifications to the analyzer config.

We attempt the image upload again and the upload succeeds. Now, how do I get involved in the refinerycms repo to discuss the changes with the leads? Something like this?


No comments: