prawnto_2 0.2.1 → 0.2.2
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/.gitignore +1 -0
- data/Appraisals +7 -0
- data/Gemfile +1 -0
- data/README.rdoc +14 -0
- data/Rakefile +11 -7
- data/prawnto.gemspec +2 -2
- data/spec/assets/{default_render.pdf → default_render-0.12.0.pdf} +0 -0
- data/spec/assets/default_render-0.6.3.pdf +85 -0
- data/spec/assets/{dsl_render.pdf → dsl_render-0.12.0.pdf} +0 -0
- data/spec/assets/dsl_render-0.6.3.pdf +85 -0
- data/spec/assets/{yield_block_in_helper_test.pdf → yield_block_in_helper_test-0.12.0.pdf} +0 -0
- data/spec/assets/yield_block_in_helper_test-0.6.3.pdf +78 -0
- data/spec/integrations/super_model_spec.rb +1 -1
- data/spec/integrations/test_controller_spec.rb +4 -4
- data/spec/spec_helper.rb +8 -0
- metadata +20 -13
data/.gitignore
CHANGED
data/Appraisals
ADDED
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -78,6 +78,20 @@ Sometimes you need to be able to render a PDF from anywhere (Background process
|
|
78
78
|
|
79
79
|
While layouts and partials aren't yet supported, helper methods can be called from within the PDF views. To help keep PDF's DRY, I would recommend creating a <code>PdfHelper</code> class for complex functionality. Don't forget to add this helper to your emailer if you generate PDF's as attachments.
|
80
80
|
|
81
|
+
== Testing
|
82
|
+
|
83
|
+
prawnto uses appraisal to run tests for different versions of prawn. In order to
|
84
|
+
run the specs you first need to install the dependencies for each appraisal:
|
85
|
+
|
86
|
+
rake appraisal:install
|
87
|
+
|
88
|
+
Then you can run the tests for a specifc version of prawn (only 0.12.0 and
|
89
|
+
0.6.3, but you can add your own version) or all versions:
|
90
|
+
|
91
|
+
rake appraisal:prawn0.12.0 spec
|
92
|
+
rake appraisal:prawn0.6.3 spec
|
93
|
+
rake appraisal spec # all versions
|
94
|
+
|
81
95
|
= Contributing & Reporting Issues
|
82
96
|
|
83
97
|
Obviously, all code contributions are greatly appreciated. We also need help with testing and the wiki.
|
data/Rakefile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
1
4
|
require 'rake'
|
2
5
|
require 'rake/testtask'
|
3
6
|
require 'rdoc/task'
|
4
7
|
require 'rubygems/package_task'
|
5
8
|
|
6
|
-
|
7
|
-
task :default => :test
|
9
|
+
require 'appraisal'
|
8
10
|
|
9
11
|
desc 'Generate documentation for the prawnto plugin.'
|
10
12
|
RDoc::Task.new do |rdoc|
|
@@ -15,9 +17,11 @@ RDoc::Task.new do |rdoc|
|
|
15
17
|
rdoc.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
16
18
|
end
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
require 'rspec/core/rake_task'
|
21
|
+
|
22
|
+
desc 'Default: run specs.'
|
23
|
+
task :default => :spec
|
24
|
+
|
25
|
+
desc "Run specs"
|
26
|
+
RSpec::Core::RakeTask.new do |t|
|
23
27
|
end
|
data/prawnto.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = "prawnto_2"
|
4
|
-
s.version = '0.2.
|
4
|
+
s.version = '0.2.2'
|
5
5
|
s.author = ["Forrest"]
|
6
6
|
s.email = ["development@forrestzeisler.com"]
|
7
7
|
s.date = Time.now.utc.strftime("%Y-%m-%d")
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.required_rubygems_version = ">= 1.3.6"
|
16
16
|
s.platform = Gem::Platform::RUBY
|
17
17
|
s.add_dependency('rails', '>= 3.1')
|
18
|
-
s.add_dependency('prawn', '>= 0.
|
18
|
+
s.add_dependency('prawn', '>= 0.6.0')
|
19
19
|
|
20
20
|
s.files = `git ls-files`.split("\n")
|
21
21
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
File without changes
|
@@ -0,0 +1,85 @@
|
|
1
|
+
%PDF-1.3
|
2
|
+
%����
|
3
|
+
1 0 obj
|
4
|
+
<< /Creator (Prawn)
|
5
|
+
/Producer (Prawn)
|
6
|
+
>>
|
7
|
+
endobj
|
8
|
+
2 0 obj
|
9
|
+
<< /Type /Pages
|
10
|
+
/Count 1
|
11
|
+
/Kids [5 0 R]
|
12
|
+
>>
|
13
|
+
endobj
|
14
|
+
3 0 obj
|
15
|
+
<< /Type /Catalog
|
16
|
+
/Pages 2 0 R
|
17
|
+
>>
|
18
|
+
endobj
|
19
|
+
4 0 obj
|
20
|
+
<< /Length 407
|
21
|
+
>>
|
22
|
+
stream
|
23
|
+
0.000 0.000 0.000 rg
|
24
|
+
0.000 0.000 0.000 RG
|
25
|
+
q
|
26
|
+
|
27
|
+
BT
|
28
|
+
36 747.384 Td
|
29
|
+
/F1.0 12 Tf
|
30
|
+
[<48656c6c6f20> 40 <57> 30 <6f72> -15 <6c6421>] TJ
|
31
|
+
ET
|
32
|
+
|
33
|
+
|
34
|
+
BT
|
35
|
+
36 733.5120000000001 Td
|
36
|
+
/F1.0 12 Tf
|
37
|
+
[<696e7374616e63652076> 25 <6172> -15 <696162> 20 <6c65204078203d2031>] TJ
|
38
|
+
ET
|
39
|
+
|
40
|
+
|
41
|
+
BT
|
42
|
+
36 719.6400000000001 Td
|
43
|
+
/F1.0 12 Tf
|
44
|
+
[<68656c706572206d6574686f64732077> 10 <6f72> -15 <6b203a> 50 <20746869732069732066726f6d20612068656c706572>] TJ
|
45
|
+
ET
|
46
|
+
|
47
|
+
Q
|
48
|
+
|
49
|
+
endstream
|
50
|
+
endobj
|
51
|
+
5 0 obj
|
52
|
+
<< /Type /Page
|
53
|
+
/Parent 2 0 R
|
54
|
+
/MediaBox [0 0 612.0 792.0]
|
55
|
+
/Contents 4 0 R
|
56
|
+
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
57
|
+
/Font << /F1.0 6 0 R
|
58
|
+
>>
|
59
|
+
>>
|
60
|
+
>>
|
61
|
+
endobj
|
62
|
+
6 0 obj
|
63
|
+
<< /Type /Font
|
64
|
+
/Subtype /Type1
|
65
|
+
/BaseFont /Helvetica
|
66
|
+
/Encoding /WinAnsiEncoding
|
67
|
+
>>
|
68
|
+
endobj
|
69
|
+
xref
|
70
|
+
0 7
|
71
|
+
0000000000 65535 f
|
72
|
+
0000000015 00000 n
|
73
|
+
0000000071 00000 n
|
74
|
+
0000000128 00000 n
|
75
|
+
0000000177 00000 n
|
76
|
+
0000000635 00000 n
|
77
|
+
0000000813 00000 n
|
78
|
+
trailer
|
79
|
+
<< /Size 7
|
80
|
+
/Root 3 0 R
|
81
|
+
/Info 1 0 R
|
82
|
+
>>
|
83
|
+
startxref
|
84
|
+
910
|
85
|
+
%%EOF
|
File without changes
|
@@ -0,0 +1,85 @@
|
|
1
|
+
%PDF-1.3
|
2
|
+
%����
|
3
|
+
1 0 obj
|
4
|
+
<< /Creator (Prawn)
|
5
|
+
/Producer (Prawn)
|
6
|
+
>>
|
7
|
+
endobj
|
8
|
+
2 0 obj
|
9
|
+
<< /Type /Pages
|
10
|
+
/Count 1
|
11
|
+
/Kids [5 0 R]
|
12
|
+
>>
|
13
|
+
endobj
|
14
|
+
3 0 obj
|
15
|
+
<< /Type /Catalog
|
16
|
+
/Pages 2 0 R
|
17
|
+
>>
|
18
|
+
endobj
|
19
|
+
4 0 obj
|
20
|
+
<< /Length 419
|
21
|
+
>>
|
22
|
+
stream
|
23
|
+
0.000 0.000 0.000 rg
|
24
|
+
0.000 0.000 0.000 RG
|
25
|
+
q
|
26
|
+
|
27
|
+
BT
|
28
|
+
36 747.384 Td
|
29
|
+
/F1.0 12 Tf
|
30
|
+
[<48656c6c6f20> 40 <57> 30 <6f72> -15 <6c6421202d2044534c>] TJ
|
31
|
+
ET
|
32
|
+
|
33
|
+
|
34
|
+
BT
|
35
|
+
36 733.5120000000001 Td
|
36
|
+
/F1.0 12 Tf
|
37
|
+
[<696e7374616e63652076> 25 <6172> -15 <696162> 20 <6c65204078203d2031>] TJ
|
38
|
+
ET
|
39
|
+
|
40
|
+
|
41
|
+
BT
|
42
|
+
36 719.6400000000001 Td
|
43
|
+
/F1.0 12 Tf
|
44
|
+
[<68656c706572206d6574686f64732077> 10 <6f72> -15 <6b203a> 50 <20746869732069732066726f6d20612068656c706572>] TJ
|
45
|
+
ET
|
46
|
+
|
47
|
+
Q
|
48
|
+
|
49
|
+
endstream
|
50
|
+
endobj
|
51
|
+
5 0 obj
|
52
|
+
<< /Type /Page
|
53
|
+
/Parent 2 0 R
|
54
|
+
/MediaBox [0 0 612.0 792.0]
|
55
|
+
/Contents 4 0 R
|
56
|
+
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
57
|
+
/Font << /F1.0 6 0 R
|
58
|
+
>>
|
59
|
+
>>
|
60
|
+
>>
|
61
|
+
endobj
|
62
|
+
6 0 obj
|
63
|
+
<< /Type /Font
|
64
|
+
/Subtype /Type1
|
65
|
+
/BaseFont /Helvetica
|
66
|
+
/Encoding /WinAnsiEncoding
|
67
|
+
>>
|
68
|
+
endobj
|
69
|
+
xref
|
70
|
+
0 7
|
71
|
+
0000000000 65535 f
|
72
|
+
0000000015 00000 n
|
73
|
+
0000000071 00000 n
|
74
|
+
0000000128 00000 n
|
75
|
+
0000000177 00000 n
|
76
|
+
0000000647 00000 n
|
77
|
+
0000000825 00000 n
|
78
|
+
trailer
|
79
|
+
<< /Size 7
|
80
|
+
/Root 3 0 R
|
81
|
+
/Info 1 0 R
|
82
|
+
>>
|
83
|
+
startxref
|
84
|
+
922
|
85
|
+
%%EOF
|
File without changes
|
@@ -0,0 +1,78 @@
|
|
1
|
+
%PDF-1.3
|
2
|
+
%����
|
3
|
+
1 0 obj
|
4
|
+
<< /Creator (Prawn)
|
5
|
+
/Producer (Prawn)
|
6
|
+
>>
|
7
|
+
endobj
|
8
|
+
2 0 obj
|
9
|
+
<< /Type /Pages
|
10
|
+
/Count 1
|
11
|
+
/Kids [5 0 R]
|
12
|
+
>>
|
13
|
+
endobj
|
14
|
+
3 0 obj
|
15
|
+
<< /Type /Catalog
|
16
|
+
/Pages 2 0 R
|
17
|
+
>>
|
18
|
+
endobj
|
19
|
+
4 0 obj
|
20
|
+
<< /Length 164
|
21
|
+
>>
|
22
|
+
stream
|
23
|
+
0.000 0.000 0.000 rg
|
24
|
+
0.000 0.000 0.000 RG
|
25
|
+
q
|
26
|
+
|
27
|
+
BT
|
28
|
+
36 747.384 Td
|
29
|
+
/F1.0 12 Tf
|
30
|
+
[<746573742031>] TJ
|
31
|
+
ET
|
32
|
+
|
33
|
+
|
34
|
+
BT
|
35
|
+
36 733.5120000000001 Td
|
36
|
+
/F1.0 12 Tf
|
37
|
+
[<746573742032>] TJ
|
38
|
+
ET
|
39
|
+
|
40
|
+
Q
|
41
|
+
|
42
|
+
endstream
|
43
|
+
endobj
|
44
|
+
5 0 obj
|
45
|
+
<< /Type /Page
|
46
|
+
/Parent 2 0 R
|
47
|
+
/MediaBox [0 0 612.0 792.0]
|
48
|
+
/Contents 4 0 R
|
49
|
+
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
50
|
+
/Font << /F1.0 6 0 R
|
51
|
+
>>
|
52
|
+
>>
|
53
|
+
>>
|
54
|
+
endobj
|
55
|
+
6 0 obj
|
56
|
+
<< /Type /Font
|
57
|
+
/Subtype /Type1
|
58
|
+
/BaseFont /Helvetica
|
59
|
+
/Encoding /WinAnsiEncoding
|
60
|
+
>>
|
61
|
+
endobj
|
62
|
+
xref
|
63
|
+
0 7
|
64
|
+
0000000000 65535 f
|
65
|
+
0000000015 00000 n
|
66
|
+
0000000071 00000 n
|
67
|
+
0000000128 00000 n
|
68
|
+
0000000177 00000 n
|
69
|
+
0000000392 00000 n
|
70
|
+
0000000570 00000 n
|
71
|
+
trailer
|
72
|
+
<< /Size 7
|
73
|
+
/Root 3 0 R
|
74
|
+
/Info 1 0 R
|
75
|
+
>>
|
76
|
+
startxref
|
77
|
+
667
|
78
|
+
%%EOF
|
@@ -7,7 +7,7 @@ describe TestController do
|
|
7
7
|
get "/default_render.pdf"
|
8
8
|
response.should be_success
|
9
9
|
|
10
|
-
asset_binary = File.open(
|
10
|
+
asset_binary = File.open(asset_path("default_render")).read.bytes.to_a
|
11
11
|
body_binary = response.body.bytes.to_a
|
12
12
|
body_binary.should == asset_binary
|
13
13
|
end
|
@@ -19,7 +19,7 @@ describe TestController do
|
|
19
19
|
|
20
20
|
it "should render items in a block passed to a helper" do
|
21
21
|
get "/yield_block_in_helper_test.pdf"
|
22
|
-
asset_binary = File.open(
|
22
|
+
asset_binary = File.open(asset_path("yield_block_in_helper_test")).read.bytes.to_a
|
23
23
|
body_binary = response.body.bytes.to_a
|
24
24
|
body_binary.should == asset_binary
|
25
25
|
end
|
@@ -31,10 +31,10 @@ describe TestController do
|
|
31
31
|
get "/dsl_render.pdf"
|
32
32
|
response.should be_success
|
33
33
|
|
34
|
-
asset_binary = File.open(
|
34
|
+
asset_binary = File.open(asset_path("dsl_render")).read.bytes.to_a
|
35
35
|
body_binary = response.body.bytes.to_a
|
36
36
|
body_binary.should == asset_binary
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
end
|
40
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -27,3 +27,11 @@ Spork.each_run do
|
|
27
27
|
# This code will be run each time you run your specs.
|
28
28
|
|
29
29
|
end
|
30
|
+
|
31
|
+
# Helper to provide asset path given the "base name" of the file.
|
32
|
+
# For example, if +file+ is "default_render", asset_path returns
|
33
|
+
# "/path/to/prawnto/spec/assets/default_render-#{prawn version}.pdf"
|
34
|
+
def asset_path(file)
|
35
|
+
prawn_version = Gem.loaded_specs["prawn"].version.to_s.inspect
|
36
|
+
TEST_ASSETS + "/#{file}-#{prawn_version.gsub('"','')}.pdf"
|
37
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawnto_2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01
|
12
|
+
date: 2012-02-01 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70280935433780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,18 +21,18 @@ dependencies:
|
|
21
21
|
version: '3.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70280935433780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: prawn
|
27
|
-
requirement: &
|
27
|
+
requirement: &70280935422940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: 0.6.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70280935422940
|
36
36
|
description: Simple PDF generation using the prawn library.
|
37
37
|
email:
|
38
38
|
- development@forrestzeisler.com
|
@@ -43,6 +43,7 @@ extra_rdoc_files:
|
|
43
43
|
files:
|
44
44
|
- .gitignore
|
45
45
|
- .travis.yml
|
46
|
+
- Appraisals
|
46
47
|
- Gemfile
|
47
48
|
- MIT-LICENSE
|
48
49
|
- README.rdoc
|
@@ -58,9 +59,12 @@ files:
|
|
58
59
|
- prawnto.gemspec
|
59
60
|
- rails/init.rb
|
60
61
|
- script/rails
|
61
|
-
- spec/assets/default_render.pdf
|
62
|
-
- spec/assets/
|
63
|
-
- spec/assets/
|
62
|
+
- spec/assets/default_render-0.12.0.pdf
|
63
|
+
- spec/assets/default_render-0.6.3.pdf
|
64
|
+
- spec/assets/dsl_render-0.12.0.pdf
|
65
|
+
- spec/assets/dsl_render-0.6.3.pdf
|
66
|
+
- spec/assets/yield_block_in_helper_test-0.12.0.pdf
|
67
|
+
- spec/assets/yield_block_in_helper_test-0.6.3.pdf
|
64
68
|
- spec/dummy/.rspec
|
65
69
|
- spec/dummy/.sass-cache/387f7b3fde13680ae5a79212c089f81d2d418f1e/application.css.scssc
|
66
70
|
- spec/dummy/.sass-cache/6a18c557e07dbc07a14d0809be02d4f21f1dbe91/_shared.css.scssc
|
@@ -140,9 +144,12 @@ specification_version: 3
|
|
140
144
|
summary: This gem allows you to use the PDF mime-type and the simple prawn syntax
|
141
145
|
to generate impressive looking PDFs.
|
142
146
|
test_files:
|
143
|
-
- spec/assets/default_render.pdf
|
144
|
-
- spec/assets/
|
145
|
-
- spec/assets/
|
147
|
+
- spec/assets/default_render-0.12.0.pdf
|
148
|
+
- spec/assets/default_render-0.6.3.pdf
|
149
|
+
- spec/assets/dsl_render-0.12.0.pdf
|
150
|
+
- spec/assets/dsl_render-0.6.3.pdf
|
151
|
+
- spec/assets/yield_block_in_helper_test-0.12.0.pdf
|
152
|
+
- spec/assets/yield_block_in_helper_test-0.6.3.pdf
|
146
153
|
- spec/dummy/.rspec
|
147
154
|
- spec/dummy/.sass-cache/387f7b3fde13680ae5a79212c089f81d2d418f1e/application.css.scssc
|
148
155
|
- spec/dummy/.sass-cache/6a18c557e07dbc07a14d0809be02d4f21f1dbe91/_shared.css.scssc
|