bin/wkhtmltoimage
#!/usr/bin/env ruby
arch = case RUBY_PLATFORM
when /64.*linux/
case `cat /etc/*release`
when /jessie/
'jessie-amd64'
when /wheezy/
'wheezy-amd64'
when /trusty/
'trusty-amd64'
when /precise/
'precise-amd64'
when /CentOS release 6\./
'centos6-amd64'
when /CentOS release 7\./
'centos7-amd64'
else
raise 'Not supported 64 bit distribution.'
end
when /linux/
case `cat /etc/*release`
when /jessie/
'jessie-i386'
when /wheezy/
'wheezy-i386'
when /trusty/
'trusty-i386'
when /precise/
'precise-i386'
else
raise 'Not supported 32 bit distribution.'
end
else
raise 'Invalid platform. Must be a Linux 32 or 64 bit system.'
end
args = $*.map { |x| x.include?(' ') ? "'" + x + "'" : x }
cmd = File.expand_path "#{File.dirname(__FILE__)}/../libexec/wkhtmltoimage-#{arch}"
exec "#{cmd} #{args.join(' ')}"