IMGKit icon indicating copy to clipboard operation
IMGKit copied to clipboard

'which' command in configuration.rb fails on Windows

Open ghost opened this issue 11 years ago • 1 comments

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?

ghost avatar Dec 11 '13 05:12 ghost

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

abhijitnandy avatar Feb 05 '20 04:02 abhijitnandy