wkhtmltopdf_for_rails 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1 @@
1
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/aratak/wkhtmltopdf_for_rails)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
data/bin/wkhtmltopdf CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- if RUBY_PLATFORM =~ /linux/ && RUBY_PLATFORM =~ /[3|4]86/
3
+ if RUBY_PLATFORM =~ /linux/ && 1.size == 4
4
4
  executable = 'wkhtmltopdf_linux_386'
5
- elsif RUBY_PLATFORM =~ /linux/ && RUBY_PLATFORM =~ /64/
5
+ elsif RUBY_PLATFORM =~ /linux/ && 1.size == 8
6
6
  executable = 'wkhtmltopdf-amd64'
7
7
  elsif RUBY_PLATFORM =~ /darwin/
8
8
  executable = 'wkhtmltopdf_darwin_386'
data/lib/render_pdf.rb CHANGED
@@ -45,17 +45,17 @@ module RenderPdf
45
45
  render_options[:template] = options.delete(:template)
46
46
  render_options[:layout] = options.delete(:layout) if options.has_key?(:layout)
47
47
 
48
- html_string = render_to_string(render_options)
48
+ html_string = render_to_string(render_options).to_str
49
49
 
50
50
  # re-route absolute paths for images, scripts and stylesheets
51
- html_string.gsub!( /src=["']+([^:]+?)["']/i ) { |m| "src=\"#{RAILS_ROOT}/public" + $1 + '"' }
52
- html_string.gsub!( /<link href=["']+([^:]+?)["']/i ) { |m| "<link href=\"#{RAILS_ROOT}/public" + $1 + '"' }
51
+ html_string.gsub!( /src=["']+([^:]+?)["']/i ) { |m| "src=\"#{::Rails.root}/public" + $1 + '"' }
52
+ html_string.gsub!( /<link href=["']+([^:]+?)["']/i ) { |m| "<link href=\"#{::Rails.root}/public" + $1 + '"' }
53
53
 
54
54
  # Remove asset ids on images, scripts, and stylesheets with a regex
55
55
  html_string.gsub!( /src=["'](\S+\?\d*)["']/i ) { |m| 'src="' + $1.split('?').first + '"' }
56
56
  html_string.gsub!( /<link href=["'](\S+\?\d*)["']/i ) { |m| '<link href="' + $1.split('?').first + '"' }
57
57
 
58
- return html_string
58
+ return html_string.html_safe
59
59
  end
60
60
 
61
61
  end
data/lib/wkhtmltopdf.rb CHANGED
@@ -18,7 +18,9 @@ class Wkhtmltopdf
18
18
  wkhtml_call << "#{@html_file}"
19
19
  end
20
20
  wkhtml_call << " #{@params_string} - -q"
21
- return `#{wkhtml_call}`
21
+ `#{wkhtml_call}`.tap do
22
+ sleep 1
23
+ end
22
24
  end
23
25
 
24
26
  private
@@ -1,6 +1,6 @@
1
1
  require 'render_pdf'
2
2
  require 'wkhtmltopdf'
3
3
 
4
- Mime::Type.register 'application/pdf', :pdf
4
+ Mime::Type.register 'application/pdf', :pdf unless Mime[:pdf]
5
5
 
6
6
  ActionController::Base.send(:include, RenderPdf)
metadata CHANGED
@@ -1,40 +1,31 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: wkhtmltopdf_for_rails
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 4
9
- version: 0.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Alexey Osipenko
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2010-04-29 00:00:00 +03:00
18
- default_executable:
12
+ date: 2010-04-29 00:00:00.000000000 Z
19
13
  dependencies: []
20
-
21
14
  description: Provides WKHTMLTOPDF for ruby on rails.
22
15
  email: alexey@osipenko.in.ua
23
- executables:
16
+ executables:
24
17
  - wkhtmltopdf
25
18
  - wkhtmltopdf-amd64
26
19
  - wkhtmltopdf-binary.rb
27
20
  - wkhtmltopdf_darwin_386
28
21
  - wkhtmltopdf_linux_386
29
- - wkhtmltopdf
30
22
  extensions: []
31
-
32
- extra_rdoc_files:
33
- - README
34
- files:
23
+ extra_rdoc_files:
24
+ - README.md
25
+ files:
35
26
  - .gitignore
36
27
  - Manifest
37
- - README
28
+ - README.md
38
29
  - VERSION
39
30
  - bin/wkhtmltopdf
40
31
  - bin/wkhtmltopdf-amd64
@@ -52,37 +43,33 @@ files:
52
43
  - test/tmp/.gitkeep
53
44
  - test/wkhtmltopdf_test.rb
54
45
  - test/wkhtmltopdf_test_controller_test.rb
55
- has_rdoc: true
56
46
  homepage: http://github.com/aratak/wkhtmltopdf_for_rails
57
47
  licenses: []
58
-
59
48
  post_install_message:
60
- rdoc_options:
49
+ rdoc_options:
61
50
  - --charset=UTF-8
62
- require_paths:
51
+ require_paths:
63
52
  - lib
64
- required_ruby_version: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- segments:
69
- - 0
70
- version: "0"
71
- required_rubygems_version: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- segments:
76
- - 0
77
- version: "0"
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
78
65
  requirements: []
79
-
80
66
  rubyforge_project:
81
- rubygems_version: 1.3.6
67
+ rubygems_version: 1.8.23
82
68
  signing_key:
83
69
  specification_version: 3
84
70
  summary: Provides WKHTMLTOPDF for ruby on rails.
85
- test_files:
71
+ test_files:
86
72
  - test/test_helper.rb
87
73
  - test/wkhtmltopdf_test.rb
88
74
  - test/wkhtmltopdf_test_controller_test.rb
75
+ has_rdoc:
data/README DELETED
File without changes