#!/usr/bin/env ruby
executable = `which wkhtmltopdf`.chomp
if executable.empty?
binary = case RUBY_PLATFORM
when /linux/
'wkhtmltopdf-linux-i386-0-9-9'
when /darwin/
'wkhtmltopdf-osx-i386-0-9-9'
else
raise "No bundled binaries found for your system. Please install wkhtmltopdf."
end
executable = File.join(File.dirname(__FILE__), binary)
end
arguments = $*.map { |arg| arg.include?(' ') ? %Q("#{arg}") : arg }
system(executable + " " + arguments.join(" "))