documentcloud/docsplit — pull request #111 by augustf (2014-06-07 04:36:41+00:00)
Title: Using environment vars to allow graphicsmagick and imagemagick

Awhile back, in https://github.com/documentcloud/docsplit/pull/100, I did a pull request for this same functionality. But I realized that any change to the graphics suite required a code change - a real pain for a gem. This somewhat different approach uses an environment variable to change the suite to imagemagick if desired, and requires no user code changes. For my application, I used a method outlined in http://railsapps.github.io/rails-environment-variables.html to set the variable consistently.

After looking at https://github.com/chintanparikh/docsplit/commi/6cff4e717f896096af6f3a71a7af9d1c38be7c33, I realized it would be relatively easy to get docsplit to work with both ImageMagick and GraphicsMagick. This was important to me as I didn't want to have to require both toolchains (which are extremely similar) for one package. This approach involves minimal changes to the codebase and passes the test suite under both IM and GM.