Permalink
Browse files

Add wkhtmltopdf start script

  • Loading branch information...
1 parent 98d727d commit 9e58648f5b922fdded46bb1f9856e37a89d2115c @bradphelan bradphelan committed Sep 26, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 bin/wkhtmltopdf
View
@@ -0,0 +1,15 @@
+#!/usr/bin/ruby
+
+
+if RUBY_PLATFORM =~ /x86_64-linux/
+ executable = 'wkhtmltopdf-linux-amd64'
+elsif RUBY_PLATFORM =~ /darwin/
+ raise "Invalid platform. Must be running linux amd x64"
+end
+
+arguments = $*.map { |x| x.include?(' ') ? "'" + x + "'" : x }
+
+executable = File.join(File.dirname(__FILE__), executable)
+r = system(executable + " " + arguments.join(" "))
+
+exit r ? 0 : 1

0 comments on commit 9e58648

Please sign in to comment.