#!/usr/bin/env ruby executable = case RUBY_PLATFORM when /64.*linux/ 'wkhtmltopdf_linux_amd64' when /linux/ 'wkhtmltopdf_linux_386' when /darwin/ 'wkhtmltopdf_darwin_386' else raise "Invalid platform. Must be running linux or intel-based Mac OS." end arguments = $*.map { |x| x.include?(' ') ? "'" + x + "'" : x } executable = File.join(File.dirname(__FILE__), executable) r = system(executable + " " + arguments.join(" ")) exit r ? 0 : 1