pdfkit 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pdfkit might be problematic. Click here for more details.

@@ -0,0 +1,8 @@
1
+ ******************************************************************
2
+
3
+ Now install wkhtmltopdf binaries:
4
+ Global: sudo `which pdfkit` --install-wkhtmltopdf
5
+ or inside RVM folder: export TO=`which pdfkit | sed 's:/pdfkit:/wkhtmltopdf:'` && pdfkit --install-wkhtmltopdf
6
+ (run pdfkit --help to see more options)
7
+
8
+ ******************************************************************
data/README.md CHANGED
@@ -33,7 +33,7 @@ Create PDFs using plain old HTML+CSS. Uses [wkhtmltopdf](http://github.com/antia
33
33
  kit = PDFKit.new(File.new('/path/to/html'))
34
34
 
35
35
  # Add any kind of option through meta tags
36
- PDFKit.new('<html><head><meta name="pdfkit-page-size" content="Letter")
36
+ PDFKit.new('<html><head><meta name="pdfkit-page_size" content="Letter")
37
37
 
38
38
  ## Configuration
39
39
 
data/Rakefile CHANGED
@@ -13,14 +13,7 @@ begin
13
13
  gem.add_development_dependency "rspec", "~> 2.0.0.beta.8"
14
14
  gem.add_development_dependency "rspec-core", "~> 2.0.0.beta.8"
15
15
  gem.add_development_dependency 'mocha'
16
- gem.post_install_message = <<-POST_INSTALL_MESSAGE
17
- #{'*'*50}
18
-
19
- Run sudo pdfkit --install-wkhtmltopdf to install wkhtmltopdf binaries.
20
- (run pdfkit --help to see more options)
21
-
22
- #{'*'*50}
23
- POST_INSTALL_MESSAGE
16
+ gem.post_install_message = File.read('POST_INSTALL')
24
17
  end
25
18
  Jeweler::GemcutterTasks.new
26
19
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -22,14 +22,15 @@ class PDFKit
22
22
 
23
23
  @stylesheets = []
24
24
 
25
- @options = normalize_options(PDFKit.configuration.default_options.merge(options))
25
+ @options = PDFKit.configuration.default_options.merge(options)
26
26
  @options.merge! find_options_in_meta(url_file_or_html) unless source.url?
27
+ @options = normalize_options(@options)
27
28
 
28
29
  raise NoExecutableError.new unless File.exists?(PDFKit.configuration.wkhtmltopdf)
29
30
  end
30
31
 
31
32
  def command
32
- args = [PDFKit.configuration.wkhtmltopdf]
33
+ args = [executable]
33
34
  args += @options.to_a.flatten.compact
34
35
  args << '--quiet'
35
36
 
@@ -42,6 +43,16 @@ class PDFKit
42
43
  args << '-' # Read PDF from stdout
43
44
  args
44
45
  end
46
+
47
+ def executable
48
+ default = PDFKit.configuration.wkhtmltopdf
49
+ return default if default !~ /^\// # its not a path, so nothing we can do
50
+ if File.exist?(default)
51
+ default
52
+ else
53
+ default.split('/').last
54
+ end
55
+ end
45
56
 
46
57
  def to_pdf
47
58
  append_stylesheets
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pdfkit}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jdpace"]
12
- s.date = %q{2010-07-19}
12
+ s.date = %q{2010-07-23}
13
13
  s.default_executable = %q{pdfkit}
14
14
  s.description = %q{Uses wkhtmltopdf to create PDFs using HTML}
15
15
  s.email = %q{jared@codewordstudios.com}
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
23
23
  ".gitignore",
24
24
  ".rspec",
25
25
  "LICENSE",
26
+ "POST_INSTALL",
26
27
  "README.md",
27
28
  "Rakefile",
28
29
  "VERSION",
@@ -41,13 +42,14 @@ Gem::Specification.new do |s|
41
42
  "spec/spec_helper.rb"
42
43
  ]
43
44
  s.homepage = %q{http://github.com/jdpace/PDFKit}
44
- s.post_install_message = %q{**************************************************
45
+ s.post_install_message = %q{******************************************************************
45
46
 
46
- Run sudo pdfkit --install-wkhtmltopdf to install wkhtmltopdf binaries.
47
+ Now install wkhtmltopdf binaries:
48
+ Global: sudo `which pdfkit` --install-wkhtmltopdf
49
+ or inside RVM folder: export TO=`which pdfkit | sed 's:/pdfkit:/wkhtmltopdf:'` && pdfkit --install-wkhtmltopdf
47
50
  (run pdfkit --help to see more options)
48
51
 
49
- **************************************************
50
- }
52
+ ******************************************************************}
51
53
  s.rdoc_options = ["--charset=UTF-8"]
52
54
  s.require_paths = ["lib"]
53
55
  s.rubygems_version = %q{1.3.7}
@@ -77,9 +77,17 @@ describe PDFKit do
77
77
  end
78
78
 
79
79
  it "should detect special pdfkit meta tags" do
80
- body = %{<html><head><meta name="pdfkit-page-size" content="Letter"/></head></html>}
80
+ body = %{
81
+ <html>
82
+ <head>
83
+ <meta name="pdfkit-page_size" content="Legal"/>
84
+ <meta name="pdfkit-orientation" content="Landscape"/>
85
+ </head>
86
+ </html>
87
+ }
81
88
  pdfkit = PDFKit.new(body)
82
- pdfkit.command[pdfkit.command.index('--page-size') + 1].should == 'Letter'
89
+ pdfkit.command[pdfkit.command.index('--page-size') + 1].should == 'Legal'
90
+ pdfkit.command[pdfkit.command.index('--orientation') + 1].should == 'Landscape'
83
91
  end
84
92
  end
85
93
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdfkit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - jdpace
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-19 00:00:00 -04:00
18
+ date: 2010-07-23 00:00:00 -04:00
19
19
  default_executable: pdfkit
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -82,6 +82,7 @@ files:
82
82
  - .gitignore
83
83
  - .rspec
84
84
  - LICENSE
85
+ - POST_INSTALL
85
86
  - README.md
86
87
  - Rakefile
87
88
  - VERSION
@@ -102,14 +103,15 @@ has_rdoc: true
102
103
  homepage: http://github.com/jdpace/PDFKit
103
104
  licenses: []
104
105
 
105
- post_install_message: |
106
- **************************************************
106
+ post_install_message: |-
107
+ ******************************************************************
107
108
 
108
- Run sudo pdfkit --install-wkhtmltopdf to install wkhtmltopdf binaries.
109
+ Now install wkhtmltopdf binaries:
110
+ Global: sudo `which pdfkit` --install-wkhtmltopdf
111
+ or inside RVM folder: export TO=`which pdfkit | sed 's:/pdfkit:/wkhtmltopdf:'` && pdfkit --install-wkhtmltopdf
109
112
  (run pdfkit --help to see more options)
110
113
 
111
- **************************************************
112
-
114
+ ******************************************************************
113
115
  rdoc_options:
114
116
  - --charset=UTF-8
115
117
  require_paths: