IMGKit
IMGKit copied to clipboard
'which' command in configuration.rb fails on Windows
Not sure if imgkit is supported on Rails 2 . . . but if it is, I can't seem to get it to work with Windows. The configuration.rb accounts for the existence of bundle or the 'which' command, and neither of these is available using Rails 2 on Windows. Thoughts?
Windows has the where command.
I noticed that in the imgkit-<ver>/lib/imgkit/configuration.rb file, changing the def wkhtmltoimage helped -
def wkhtmltoimage
@wkhtmltoimage ||= begin
which_cmd = ((/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil) ? 'where' : 'which'
path = (using_bundler? ? `bundle exec which wkhtmltoimage` : `#{which_cmd} wkhtmltoimage`)
path = (path.split("\n").compact.last || "").chomp
path = '/usr/local/bin/wkhtmltoimage' if path.strip.empty? # Fallback
path
end
end