lib/imgkit/configuration.rb in imgkit-1.3.8 vs lib/imgkit/configuration.rb in imgkit-1.3.9
- old
+ new
@@ -2,12 +2,13 @@
class Configuration
attr_accessor :meta_tag_prefix, :wkhtmltoimage, :default_options, :default_format
def initialize
@meta_tag_prefix = 'imgkit-'
- @wkhtmltoimage = '/usr/local/bin/wkhtmltoimage'
@default_options = {:height => 1000}
@default_format = :jpg
+ @wkhtmltoimage ||= (defined?(Bundler::GemfileError) ? `bundle exec which wkhtmltoimage` : `which wkhtmltoimage`).chomp
+ @wkhtmltoimage = '/usr/local/bin/wkhtmltoimage' if @wkhtmltoimage.strip.empty? # Fallback
end
end
class << self
attr_accessor :configuration