pdfkit 0.2.1 → 0.2.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.
- data/Rakefile +16 -0
- data/VERSION +1 -1
- data/lib/{PDFKit.rb → pdfkit.rb} +0 -0
- data/pdfkit.gemspec +3 -3
- metadata +4 -4
- data/spec/PDFKit_spec.rb +0 -61
data/Rakefile
CHANGED
@@ -12,6 +12,22 @@ begin
|
|
12
12
|
gem.authors = ["jdpace"]
|
13
13
|
gem.add_dependency "activesupport"
|
14
14
|
gem.add_development_dependency "rspec", "~> 2.0.0.beta.8"
|
15
|
+
gem.files = [
|
16
|
+
".document",
|
17
|
+
".gitignore",
|
18
|
+
"LICENSE",
|
19
|
+
"README.md",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"lib/pdfkit.rb",
|
23
|
+
"lib/pdfkit/middleware.rb",
|
24
|
+
"lib/pdfkit/pdfkit.rb",
|
25
|
+
"pdfkit.gemspec",
|
26
|
+
"spec/pdfkit_spec.rb",
|
27
|
+
"spec/fixtures/example.css",
|
28
|
+
"spec/spec.opts",
|
29
|
+
"spec/spec_helper.rb"
|
30
|
+
]
|
15
31
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
32
|
end
|
17
33
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/lib/{PDFKit.rb → pdfkit.rb}
RENAMED
File without changes
|
data/pdfkit.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{pdfkit}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.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"]
|
@@ -23,12 +23,12 @@ Gem::Specification.new do |s|
|
|
23
23
|
"README.md",
|
24
24
|
"Rakefile",
|
25
25
|
"VERSION",
|
26
|
-
"lib/
|
26
|
+
"lib/pdfkit.rb",
|
27
27
|
"lib/pdfkit/middleware.rb",
|
28
28
|
"lib/pdfkit/pdfkit.rb",
|
29
29
|
"pdfkit.gemspec",
|
30
|
-
"spec/PDFKit_spec.rb",
|
31
30
|
"spec/fixtures/example.css",
|
31
|
+
"spec/pdfkit_spec.rb",
|
32
32
|
"spec/spec.opts",
|
33
33
|
"spec/spec_helper.rb"
|
34
34
|
]
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- jdpace
|
@@ -61,12 +61,12 @@ files:
|
|
61
61
|
- README.md
|
62
62
|
- Rakefile
|
63
63
|
- VERSION
|
64
|
-
- lib/
|
64
|
+
- lib/pdfkit.rb
|
65
65
|
- lib/pdfkit/middleware.rb
|
66
66
|
- lib/pdfkit/pdfkit.rb
|
67
67
|
- pdfkit.gemspec
|
68
|
-
- spec/PDFKit_spec.rb
|
69
68
|
- spec/fixtures/example.css
|
69
|
+
- spec/pdfkit_spec.rb
|
70
70
|
- spec/spec.opts
|
71
71
|
- spec/spec_helper.rb
|
72
72
|
has_rdoc: true
|
data/spec/PDFKit_spec.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe PDFKit do
|
4
|
-
|
5
|
-
context "initialization" do
|
6
|
-
it "should take HTML for the renderer" do
|
7
|
-
pdfkit = PDFKit.new('<h1>Oh Hai</h1>')
|
8
|
-
pdfkit.html.should == '<h1>Oh Hai</h1>'
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should parse the options into a cmd line friedly format" do
|
12
|
-
pdfkit = PDFKit.new('html', :page_size => 'Letter')
|
13
|
-
pdfkit.options.should have_key('--page-size')
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should provide default options" do
|
17
|
-
pdfkit = PDFKit.new('<h1>Oh Hai</h1>')
|
18
|
-
['--disable-smart-shrinking', '--margin-top', '--margin-right', '--margin-bottom', '--margin-left'].each do |option|
|
19
|
-
pdfkit.options.should have_key(option)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should not have any stylesheedt by default" do
|
24
|
-
pdfkit = PDFKit.new('<h1>Oh Hai</h1>')
|
25
|
-
pdfkit.stylesheets.should be_empty
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context "command" do
|
30
|
-
it "should contstruct the correct command" do
|
31
|
-
pdfkit = PDFKit.new('html', :page_size => 'Letter')
|
32
|
-
pdfkit.command.should include('wkhtmltopdf')
|
33
|
-
pdfkit.command.should include('--page-size Letter')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
context "to_pdf" do
|
38
|
-
it "should generate a PDF of the HTML" do
|
39
|
-
pdfkit = PDFKit.new('html', :page_size => 'Letter')
|
40
|
-
pdf = pdfkit.to_pdf
|
41
|
-
pdf.should match(/^%PDF/) # PDF Signature at beginning of file
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should have the stylesheet added to the head if it has one" do
|
45
|
-
pdfkit = PDFKit.new("<html><head></head><body>Hai!</body></html>")
|
46
|
-
css = File.expand_path(File.dirname(__FILE__) + '/fixtures/example.css')
|
47
|
-
pdfkit.stylesheets << css
|
48
|
-
pdfkit.to_pdf
|
49
|
-
pdfkit.html.should include("<style>#{File.read(css)}</style>")
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should prepend style tags if the HTML doesn't have a head tag" do
|
53
|
-
pdfkit = PDFKit.new("<html><body>Hai!</body></html>")
|
54
|
-
css = File.expand_path(File.dirname(__FILE__) + '/fixtures/example.css')
|
55
|
-
pdfkit.stylesheets << css
|
56
|
-
pdfkit.to_pdf
|
57
|
-
pdfkit.html.should include("<style>#{File.read(css)}</style><html>")
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|