documentcloud / docsplit

Break Apart Documents into Images, Text, Pages and PDFs
http://documentcloud.github.com/docsplit/
Other
833 stars 214 forks source link

Using environment vars to allow graphicsmagick and imagemagick #111

Closed augustf closed 10 years ago

augustf commented 10 years ago

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.

jashkenas commented 10 years ago

This sounds like a fine idea for your own fork of Docsplit, but I don't think that we want to be in the business of maintaining and testing Docsplit for two different backends...

augustf commented 10 years ago

I can understand that. I would add though that the differences between ImageMagick and GraphicsMagick (its fork) are extremely minimal and unlikely to change any docsplit test results absent a dramatic syntax change to one of them.