pdfkit 0.8.3 → 0.8.4
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.
- checksums.yaml +4 -4
- data/.travis.yml +6 -6
- data/CHANGELOG.md +5 -0
- data/README.md +0 -1
- data/lib/pdfkit/configuration.rb +11 -1
- data/lib/pdfkit/pdfkit.rb +1 -1
- data/lib/pdfkit/version.rb +1 -1
- data/spec/configuration_spec.rb +27 -0
- data/spec/pdfkit_spec.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de215391f5d6f31b3bb381eca4662d19fda9c628d582862388e5d8180b10c73e
|
4
|
+
data.tar.gz: 402ec1719d3548fce4550ae150d48090951c1597b7b0ac7f8482682aadacf381
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48e4d2d1460b51560536001e7e9c7874e297b8d365ec4b3c57bf8831d0becbc8f6b381d876ca64f8ae8066084f94db50ddc1289b22f0218e396da8c918289638
|
7
|
+
data.tar.gz: c785e6cde8040feb20c5d48fa94dc7e736b1d8350441c7418fc542a233b08d92031d00608f0bac47d4d230fb5bed84b4b70fe16b085bfae1c96cc6a90e92746a
|
data/.travis.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
rvm:
|
2
|
-
-
|
3
|
-
-
|
4
|
-
- 2.
|
5
|
-
- 2.
|
2
|
+
- 2.2
|
3
|
+
- 2.3
|
4
|
+
- 2.4
|
5
|
+
- 2.5
|
6
6
|
|
7
7
|
before_install:
|
8
8
|
- gem update --system
|
@@ -12,5 +12,5 @@ before_script:
|
|
12
12
|
- "export DISPLAY=:99.0"
|
13
13
|
- "sh -e /etc/init.d/xvfb start"
|
14
14
|
- "sudo apt-get -qq -y install fontconfig libxrender1"
|
15
|
-
- "wget
|
16
|
-
- "sudo
|
15
|
+
- "wget https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb"
|
16
|
+
- "sudo apt-get install ./wkhtmltox_0.12.5-1.trusty_amd64.deb"
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/pdfkit/configuration.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
class PDFKit
|
2
2
|
class Configuration
|
3
3
|
attr_accessor :meta_tag_prefix, :default_options, :root_url
|
4
|
-
attr_writer :verbose
|
4
|
+
attr_writer :use_xvfb, :verbose
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@verbose = false
|
8
|
+
@use_xvfb = false
|
8
9
|
@meta_tag_prefix = 'pdfkit-'
|
9
10
|
@default_options = {
|
10
11
|
:disable_smart_shrinking => false,
|
@@ -35,6 +36,14 @@ class PDFKit
|
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
39
|
+
def executable
|
40
|
+
using_xvfb? ? "xvfb-run #{wkhtmltopdf}" : wkhtmltopdf
|
41
|
+
end
|
42
|
+
|
43
|
+
def using_xvfb?
|
44
|
+
@use_xvfb
|
45
|
+
end
|
46
|
+
|
38
47
|
def quiet?
|
39
48
|
!@verbose
|
40
49
|
end
|
@@ -54,6 +63,7 @@ class PDFKit
|
|
54
63
|
# @example
|
55
64
|
# PDFKit.configure do |config|
|
56
65
|
# config.wkhtmltopdf = '/usr/bin/wkhtmltopdf'
|
66
|
+
# config.use_xvfb = true
|
57
67
|
# config.verbose = true
|
58
68
|
# end
|
59
69
|
|
data/lib/pdfkit/pdfkit.rb
CHANGED
data/lib/pdfkit/version.rb
CHANGED
data/spec/configuration_spec.rb
CHANGED
@@ -12,6 +12,17 @@ describe PDFKit::Configuration do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
describe "#executable" do
|
16
|
+
it "returns wkhtmltopdf by default" do
|
17
|
+
expect(subject.executable).to eql subject.wkhtmltopdf
|
18
|
+
end
|
19
|
+
|
20
|
+
it "uses xvfb-run wrapper when option of using xvfb is configured" do
|
21
|
+
expect(subject).to receive(:using_xvfb?).and_return(true)
|
22
|
+
expect(subject.executable).to include 'xvfb-run'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
15
26
|
describe "#default_options" do
|
16
27
|
it "sets defaults for the command options" do
|
17
28
|
expect(subject.default_options[:disable_smart_shrinking]).to eql false
|
@@ -53,6 +64,22 @@ describe PDFKit::Configuration do
|
|
53
64
|
end
|
54
65
|
end
|
55
66
|
|
67
|
+
describe "#using_xvfb?" do
|
68
|
+
it "can be configured to true" do
|
69
|
+
subject.use_xvfb = true
|
70
|
+
expect(subject.using_xvfb?).to eql true
|
71
|
+
end
|
72
|
+
|
73
|
+
it "defaults to false" do
|
74
|
+
expect(subject.using_xvfb?).to eql false
|
75
|
+
end
|
76
|
+
|
77
|
+
it "can be configured to false" do
|
78
|
+
subject.use_xvfb = false
|
79
|
+
expect(subject.using_xvfb?).to eql false
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
56
83
|
describe "#verbose?" do
|
57
84
|
it "can be configured to true" do
|
58
85
|
subject.verbose = true
|
data/spec/pdfkit_spec.rb
CHANGED
@@ -384,6 +384,24 @@ describe PDFKit do
|
|
384
384
|
end
|
385
385
|
end
|
386
386
|
|
387
|
+
it "does not use xvfb-run wrapper by default" do
|
388
|
+
pdfkit = PDFKit.new('html')
|
389
|
+
expect(pdfkit.command).not_to include 'xvfb-run'
|
390
|
+
end
|
391
|
+
|
392
|
+
it "uses xvfb-run wrapper when option of using xvfb is configured" do
|
393
|
+
PDFKit.configure do |config|
|
394
|
+
config.use_xvfb = true
|
395
|
+
end
|
396
|
+
|
397
|
+
pdfkit = PDFKit.new('html')
|
398
|
+
expect(pdfkit.command).to include 'xvfb-run'
|
399
|
+
|
400
|
+
PDFKit.configure do |config|
|
401
|
+
config.use_xvfb = false
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
387
405
|
context "on windows" do
|
388
406
|
before do
|
389
407
|
allow(PDFKit::OS).to receive(:host_is_windows?).and_return(true)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdfkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Pace
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-02-
|
12
|
+
date: 2019-02-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|