wicked_pdf 0.9.5 → 0.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/wicked_pdf.rb CHANGED
@@ -37,7 +37,7 @@ class WickedPdf
37
37
  begin
38
38
  stdin, stdout, stderr = Open3.popen3(@exe_path + ' -V')
39
39
  @binary_version = parse_version(stdout.gets(nil))
40
- rescue StandardError
40
+ rescue StandardError
41
41
  end
42
42
  end
43
43
 
@@ -56,6 +56,9 @@ class WickedPdf
56
56
  err = Open3.popen3(command) do |stdin, stdout, stderr|
57
57
  stderr.read
58
58
  end
59
+ if return_file = options.delete(:return_file)
60
+ return generated_pdf_file
61
+ end
59
62
  generated_pdf_file.rewind
60
63
  generated_pdf_file.binmode
61
64
  pdf = generated_pdf_file.read
@@ -65,7 +68,7 @@ class WickedPdf
65
68
  raise "Failed to execute:\n#{command}\nError: #{e}"
66
69
  ensure
67
70
  string_file.close! if string_file
68
- generated_pdf_file.close! if generated_pdf_file
71
+ generated_pdf_file.close! if generated_pdf_file && !return_file
69
72
  end
70
73
 
71
74
  private
@@ -88,8 +91,8 @@ class WickedPdf
88
91
  end
89
92
 
90
93
  def parse_version(version_info)
91
- match_data = /wkhtmltopdf\s*(\d*\.\d*\.\d*\w*)/.match(version_info)
92
- if (match_data && (2 == match_data.length))
94
+ match_data = /wkhtmltopdf\s*(\d*\.\d*\.\d*\w*)/.match(version_info)
95
+ if (match_data && (2 == match_data.length))
93
96
  Gem::Version.new(match_data[1])
94
97
  else
95
98
  DEFAULT_BINARY_VERSION
@@ -3,7 +3,16 @@ require 'wicked_pdf_helper'
3
3
 
4
4
  if defined?(Rails)
5
5
 
6
- if Rails::VERSION::MAJOR == 2
6
+ if Rails::VERSION::MAJOR == 4
7
+
8
+ class WickedRailtie < Rails::Railtie
9
+ initializer "wicked_pdf.register" do |app|
10
+ ActionController::Base.send :include, PdfHelper
11
+ ActionView::Base.send :include, WickedPdfHelper::Assets
12
+ end
13
+ end
14
+
15
+ elsif Rails::VERSION::MAJOR == 2
7
16
 
8
17
  unless ActionController::Base.instance_methods.include? "render_with_wicked_pdf"
9
18
  ActionController::Base.send :include, PdfHelper
@@ -1,3 +1,3 @@
1
1
  class WickedPdf
2
- VERSION = '0.9.5'
2
+ VERSION = '0.9.6'
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 5
9
- version: 0.9.5
8
+ - 6
9
+ version: 0.9.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Miles Z. Sterret
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2013-04-12 00:00:00 -04:00
17
+ date: 2013-04-23 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency