Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added support for wicked-pdf on heroku #1

Open
wants to merge 5 commits into from

1 participant

@jkotchoff

Added wicked-pdf support and the linux binary for heroku

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 14, 2012
  1. Added wicked_pdf support

    Jason Kotchoff authored
  2. bumped gem version to 0.2.0

    Jason Kotchoff authored
  3. added the AMD64 wkhtmltopdf library for heroku

    Jason Kotchoff authored
  4. bumped gemspec for new amd64 binary

    Jason Kotchoff authored
This page is out of date. Refresh to see the latest.
View
9 README.mdown
@@ -0,0 +1,9 @@
+# wkhtmltopdf-heroku
+
+Provides a [wkhtmltopdf](http://code.google.com/p/wkhtmltopdf/) binary for [Heroku](http://www.heroku.com/).
+
+Preconfigures [pdfkit](https://rubygems.org/gems/pdfkit) and [wicked_pdf](https://rubygems.org/gems/wicked_pdf) to use this binary if they are loaded.
+
+## Copyright
+
+Copyright (c) 2011 Brad Phelan. See LICENSE.txt for further details.
View
9 README.rdoc
@@ -1,9 +0,0 @@
-= wkhtmltopdf-heroku
-
-Binaries for wkhtmltopdf for OSX and Heroku
-
-== Copyright
-
-Copyright (c) 2011 Brad Phelan. See LICENSE.txt for
-further details.
-
View
2  VERSION
@@ -1 +1 @@
-0.1.1
+0.2.2
View
BIN  bin/wkhtmltopdf-linux-amd64
Binary file not shown
View
27 lib/wkhtmltopdf-osx.rb
@@ -1,10 +1,19 @@
-# config/initializers/pdfkit.rb
-require 'pdfkit'
-PDFKit.configure do |config|
- config.wkhtmltopdf = File.expand_path "../../bin/wkhtmltopdf-darwin", __FILE__
- # config.default_options = {
- # :page_size => 'Legal',
- # :print_media_type => true
- # }
- # config.root_url = "http://localhost" # Use only if your external hostname is unavailable on the server.
+# use AMD64 library for heroku, Darwin library for OSX
+on_heroku = !ENV.keys.select{|k| k.starts_with?("HEROKU")}.empty?
+executable = on_heroku ? "wkhtmltopdf-linux-amd64" : "wkhtmltopdf-darwin"
+
+wkhtmltopdf_path = File.expand_path "../../bin/#{executable}", __FILE__
+
+begin
+ require 'pdfkit'
+ PDFKit.configure do |config|
+ config.wkhtmltopdf = wkhtmltopdf_path
+ end
+rescue LoadError
end
+
+begin
+ require 'wicked_pdf'
+ WickedPdf.config[:exe_path] = wkhtmltopdf_path
+rescue LoadError
+end
View
8 wkhtmltopdf-osx.gemspec
@@ -5,24 +5,24 @@
Gem::Specification.new do |s|
s.name = %q{wkhtmltopdf-osx}
- s.version = "0.1.1"
+ s.version = "0.2.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = [%q{Brad Phelan}]
- s.date = %q{2011-09-26}
+ s.date = %q{2012-05-14}
s.description = %q{wkhtmltopdf binaries for OSX(darwin)}
s.email = %q{bradphelan@xtargets.com}
s.executables = [%q{wkhtmltopdf-darwin}]
s.extra_rdoc_files = [
"LICENSE.txt",
- "README.rdoc"
+ "README.mdown"
]
s.files = [
".document",
"Gemfile",
"Gemfile.lock",
"LICENSE.txt",
- "README.rdoc",
+ "README.mdown",
"Rakefile",
"VERSION",
"bin/wkhtmltopdf-darwin",
Something went wrong with that request. Please try again.