prawn_plus 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +4 -0
- data/{LICENSE.rdoc → LICENSE.md} +1 -1
- data/README.md +132 -0
- data/lib/prawn_plus/version.rb +1 -1
- data.tar.gz.sig +3 -0
- metadata +47 -13
- metadata.gz.sig +0 -0
- data/CHANGELOG.rdoc +0 -15
- data/README.rdoc +0 -119
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17be6af811f4f3dfe3412c090bde2f639095a2f8
|
4
|
+
data.tar.gz: d898989f7c231bdf15612a0570bcfe2b47c5e435
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13fe4f67d03f414235d35a4ea4900617bd0ba928f65a86d6dfe7b03e74c53c090f1625ec35e308c289d06e9e2ca55016217a3b4856a167302d799ec8fa3dfc7f
|
7
|
+
data.tar.gz: ab1e2d3508b86b540bc73d0a3d586437596f65c25579cead2ccfab628792e0932a804e8d227c9fdc1706ac341c63cea826f4743850e5dc434fffdc74d379002b
|
checksums.yaml.gz.sig
ADDED
data/{LICENSE.rdoc → LICENSE.md}
RENAMED
data/README.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Overview
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/prawn_plus.png)](http://badge.fury.io/rb/prawn_plus)
|
4
|
+
[![Code Climate GPA](https://codeclimate.com/github/bkuhlmann/prawn_plus.png)](https://codeclimate.com/github/bkuhlmann/prawn_plus)
|
5
|
+
[![Travis CI Status](https://secure.travis-ci.org/bkuhlmann/prawn_plus.png)](http://travis-ci.org/bkuhlmann/prawn_plus)
|
6
|
+
|
7
|
+
# Features
|
8
|
+
|
9
|
+
* Loads the [Prawn](https://github.com/prawnpdf/prawn) gem by default (no Gemfile entry necessary).
|
10
|
+
* Registers PDF as a MIME type.
|
11
|
+
* Registers a template handler for rendering ".prawn" template view files.
|
12
|
+
|
13
|
+
# Requirements
|
14
|
+
|
15
|
+
0. [Ruby 2.0.x](http://www.ruby-lang.org).
|
16
|
+
0. [Ruby on Rails 4.0.x](http://rubyonrails.org).
|
17
|
+
0. [Prawn](https://github.com/prawnpdf/prawn).
|
18
|
+
|
19
|
+
# Setup
|
20
|
+
|
21
|
+
Type the following from the command line to securely install (recommended):
|
22
|
+
|
23
|
+
gem cert --add <(curl -Ls https://raw.github.com/bkuhlmann/prawn_plus/master/gem-public.pem)
|
24
|
+
gem install prawn_plus -P HighSecurity
|
25
|
+
|
26
|
+
...or type the following to insecurely install (not recommended):
|
27
|
+
|
28
|
+
gem install prawn_plus
|
29
|
+
|
30
|
+
Add the following to your Gemfile:
|
31
|
+
|
32
|
+
gem "prawn_plus"
|
33
|
+
|
34
|
+
# Usage
|
35
|
+
|
36
|
+
## Views
|
37
|
+
|
38
|
+
Within your views you can craft Prawn templates using Ruby code. For example, assuming there are document resources, then
|
39
|
+
the following structure might exist:
|
40
|
+
|
41
|
+
/views/documents/show.html.erb
|
42
|
+
/views/documents/show.pdf.prawn
|
43
|
+
|
44
|
+
The show.html.erb could have a link to the PDF download. Example:
|
45
|
+
|
46
|
+
<%= link_to "PDF Download", action: "show", id: @document.id, format: "pdf" %>
|
47
|
+
|
48
|
+
The show.pdf.prawn file would contain the Prawn syntax for crafting the PDF. A simple example
|
49
|
+
might look like this:
|
50
|
+
|
51
|
+
pdf.text "Hello, I'm a PDF!"
|
52
|
+
|
53
|
+
...which would render the following output:
|
54
|
+
|
55
|
+
[![Basic Example](https://github.com/bkuhlmann/prawn_plus/raw/master/doc/examples/basic.png)](https://github.com/bkuhlmann/prawn_plus)
|
56
|
+
|
57
|
+
You could also render a more complex PDF with tabular information, for example:
|
58
|
+
|
59
|
+
pdf.text "Metals"
|
60
|
+
pdf.move_down 10
|
61
|
+
pdf.font_size = 10
|
62
|
+
|
63
|
+
data = [
|
64
|
+
["Name", "Atomic Number", "Price"],
|
65
|
+
["Mercury", "80", number_to_currency(10)],
|
66
|
+
["Platinum", "78", number_to_currency(25)],
|
67
|
+
["Titanium", "22", number_to_currency(50)]
|
68
|
+
]
|
69
|
+
|
70
|
+
pdf.table data, header: true, column_widths: [100, 50, 50], row_colors: ["FFFFFF", "E5ECF9"] do
|
71
|
+
columns(0).align = :left
|
72
|
+
columns(1..2).align = :right
|
73
|
+
row(0).text_color = "FFFFFF"
|
74
|
+
row(0).background_color = "000000"
|
75
|
+
row(0).columns(0..2).font_style = :bold
|
76
|
+
row(0).columns(0..2).align = :center
|
77
|
+
end
|
78
|
+
|
79
|
+
...which would render the following output:
|
80
|
+
|
81
|
+
[![Complex Example](https://github.com/bkuhlmann/prawn_plus/raw/master/doc/examples/complex.png)](https://github.com/bkuhlmann/prawn_plus)
|
82
|
+
|
83
|
+
NOTE: The _pdf_ object must always be referenced when making using of the Prawn syntax - it is initialized for you
|
84
|
+
as a Prawn::Document instance.
|
85
|
+
|
86
|
+
## Controllers
|
87
|
+
|
88
|
+
Within your controller, only the respond_to method is required. Using the same example above, only the following
|
89
|
+
would be necessary:
|
90
|
+
|
91
|
+
class DocumentsController < ApplicationController
|
92
|
+
respond_to :pdf
|
93
|
+
|
94
|
+
def show
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
That's it!
|
99
|
+
|
100
|
+
# Tests
|
101
|
+
|
102
|
+
To test, do the following:
|
103
|
+
|
104
|
+
0. cd to the gem root.
|
105
|
+
0. bundle install
|
106
|
+
0. bundle exec rspec spec
|
107
|
+
|
108
|
+
# Versioning
|
109
|
+
|
110
|
+
Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
|
111
|
+
|
112
|
+
* Patch (x.y.Z) - Incremented for small, backwards compatible bug fixes.
|
113
|
+
* Minor (x.Y.z) - Incremented for new, backwards compatible public API enhancements and/or bug fixes.
|
114
|
+
* Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
115
|
+
|
116
|
+
# Contributions
|
117
|
+
|
118
|
+
Read CONTRIBUTING for details.
|
119
|
+
|
120
|
+
# Credits
|
121
|
+
|
122
|
+
Developed by [Brooke Kuhlmann](http://www.redalchemist.com) at [Red Alchemist](http://www.redalchemist.com)
|
123
|
+
|
124
|
+
# License
|
125
|
+
|
126
|
+
Copyright (c) 2012 [Red Alchemist](http://www.redalchemist.com).
|
127
|
+
Read the LICENSE for details.
|
128
|
+
|
129
|
+
# History
|
130
|
+
|
131
|
+
Read the CHANGELOG for details.
|
132
|
+
Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
|
data/lib/prawn_plus/version.rb
CHANGED
data.tar.gz.sig
ADDED
metadata
CHANGED
@@ -1,14 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDhTCCAm2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQ8wDQYDVQQDDAZicm9v
|
14
|
+
a2UxHDAaBgoJkiaJk/IsZAEZFgxyZWRhbGNoZW1pc3QxEzARBgoJkiaJk/IsZAEZ
|
15
|
+
FgNjb20wHhcNMTMwNjI1MDEzOTUyWhcNMTQwNjI1MDEzOTUyWjBEMQ8wDQYDVQQD
|
16
|
+
DAZicm9va2UxHDAaBgoJkiaJk/IsZAEZFgxyZWRhbGNoZW1pc3QxEzARBgoJkiaJ
|
17
|
+
k/IsZAEZFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCoICuy
|
18
|
+
DEfASTa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dependencies:
|
13
35
|
- !ruby/object:Gem::Dependency
|
14
36
|
name: rails
|
@@ -16,14 +38,14 @@ dependencies:
|
|
16
38
|
requirements:
|
17
39
|
- - ~>
|
18
40
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
41
|
+
version: '4.0'
|
20
42
|
type: :runtime
|
21
43
|
prerelease: false
|
22
44
|
version_requirements: !ruby/object:Gem::Requirement
|
23
45
|
requirements:
|
24
46
|
- - ~>
|
25
47
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
48
|
+
version: '4.0'
|
27
49
|
- !ruby/object:Gem::Dependency
|
28
50
|
name: prawn
|
29
51
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +89,21 @@ dependencies:
|
|
67
89
|
- !ruby/object:Gem::Version
|
68
90
|
version: '0'
|
69
91
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: pry-
|
92
|
+
name: pry-byebug
|
93
|
+
requirement: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
type: :development
|
99
|
+
prerelease: false
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: pry-rescue
|
71
107
|
requirement: !ruby/object:Gem::Requirement
|
72
108
|
requirements:
|
73
109
|
- - '>='
|
@@ -198,17 +234,15 @@ email: brooke@redalchemist.com
|
|
198
234
|
executables: []
|
199
235
|
extensions: []
|
200
236
|
extra_rdoc_files:
|
201
|
-
- README.
|
202
|
-
-
|
203
|
-
- LICENSE.rdoc
|
237
|
+
- README.md
|
238
|
+
- LICENSE.md
|
204
239
|
files:
|
205
240
|
- lib/prawn_plus/railtie.rb
|
206
241
|
- lib/prawn_plus/template_handlers/prawn.rb
|
207
242
|
- lib/prawn_plus/version.rb
|
208
243
|
- lib/prawn_plus.rb
|
209
|
-
- README.
|
210
|
-
-
|
211
|
-
- LICENSE.rdoc
|
244
|
+
- README.md
|
245
|
+
- LICENSE.md
|
212
246
|
homepage: http://www.redalchemist.com
|
213
247
|
licenses:
|
214
248
|
- MIT
|
@@ -229,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
263
|
version: '0'
|
230
264
|
requirements: []
|
231
265
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.0.
|
266
|
+
rubygems_version: 2.0.6
|
233
267
|
signing_key:
|
234
268
|
specification_version: 4
|
235
269
|
summary: Enhances default Prawn PDF functionality.
|
metadata.gz.sig
ADDED
Binary file
|
data/CHANGELOG.rdoc
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
= v2.0.0
|
2
|
-
|
3
|
-
* Upgraded to Ruby 2.0.0.
|
4
|
-
* Converted/detailed the CONTRIBUTING guidelines per GitHub requirements.
|
5
|
-
* Added Gem Badge support.
|
6
|
-
* Added Code Climate support.
|
7
|
-
* Added Campfire notification support.
|
8
|
-
* Switched from HTTP to HTTPS when sourcing from RubyGems.
|
9
|
-
* Added Pry development support.
|
10
|
-
* Added 'tmp' directory to .gitignore.
|
11
|
-
* Cleaned up requirement path syntax.
|
12
|
-
|
13
|
-
= v1.0.0
|
14
|
-
|
15
|
-
* Initial version.
|
data/README.rdoc
DELETED
@@ -1,119 +0,0 @@
|
|
1
|
-
= Overview
|
2
|
-
|
3
|
-
{<img src="https://badge.fury.io/rb/prawn_plus.png" alt="Gem Version" />}[http://badge.fury.io/rb/prawn_plus]
|
4
|
-
{<img src="https://codeclimate.com/github/bkuhlmann/prawn_plus.png" alt="Code Climate GPA" />}[https://codeclimate.com/github/bkuhlmann/prawn_plus]
|
5
|
-
{<img src="https://secure.travis-ci.org/bkuhlmann/prawn_plus.png" alt="Travis CI Status" />}[http://travis-ci.org/bkuhlmann/prawn_plus]
|
6
|
-
|
7
|
-
= Features
|
8
|
-
|
9
|
-
* Loads the Prawn[https://github.com/prawnpdf/prawn] gem by default (no Gemfile entry necessary).
|
10
|
-
* Registers PDF as a MIME type.
|
11
|
-
* Registers a template handler for rendering ".prawn" template view files.
|
12
|
-
|
13
|
-
= Requirements
|
14
|
-
|
15
|
-
1. {Ruby 2.0.x}[http://www.ruby-lang.org].
|
16
|
-
2. {Ruby on Rails 3.2.x}[http://rubyonrails.org].
|
17
|
-
3. Prawn[https://github.com/prawnpdf/prawn].
|
18
|
-
|
19
|
-
= Setup
|
20
|
-
|
21
|
-
Type the following from the command line to install:
|
22
|
-
|
23
|
-
gem install prawn_plus
|
24
|
-
|
25
|
-
Add the following to your Gemfile:
|
26
|
-
|
27
|
-
gem "prawn_plus"
|
28
|
-
|
29
|
-
= Usage
|
30
|
-
|
31
|
-
== Views
|
32
|
-
|
33
|
-
Within your views you can craft Prawn templates using Ruby code. For example, assuming there are document resources, then
|
34
|
-
the following structure might exist:
|
35
|
-
|
36
|
-
/views/documents/show.html.erb
|
37
|
-
/views/documents/show.pdf.prawn
|
38
|
-
|
39
|
-
The show.html.erb could have a link to the PDF download. Example:
|
40
|
-
|
41
|
-
<%= link_to "PDF Download", action: "show", id: @document.id, format: "pdf" %>
|
42
|
-
|
43
|
-
The show.pdf.prawn file would contain the Prawn syntax for crafting the PDF. A simple example
|
44
|
-
might look like this:
|
45
|
-
|
46
|
-
pdf.text "Hello, I'm a PDF!"
|
47
|
-
|
48
|
-
...which would render the following output:
|
49
|
-
|
50
|
-
{<img src="https://github.com/bkuhlmann/prawn_plus/raw/master/doc/examples/basic.png" />}[https://github.com/bkuhlmann/prawn_plus]
|
51
|
-
|
52
|
-
You could also render a more complex PDF with tabular information, for example:
|
53
|
-
|
54
|
-
pdf.text "Metals"
|
55
|
-
pdf.move_down 10
|
56
|
-
pdf.font_size = 10
|
57
|
-
|
58
|
-
data = [
|
59
|
-
["Name", "Atomic Number", "Price"],
|
60
|
-
["Mercury", "80", number_to_currency(10)],
|
61
|
-
["Platinum", "78", number_to_currency(25)],
|
62
|
-
["Titanium", "22", number_to_currency(50)]
|
63
|
-
]
|
64
|
-
|
65
|
-
pdf.table data, header: true, column_widths: [100, 50, 50], row_colors: ["FFFFFF", "E5ECF9"] do
|
66
|
-
columns(0).align = :left
|
67
|
-
columns(1..2).align = :right
|
68
|
-
row(0).text_color = "FFFFFF"
|
69
|
-
row(0).background_color = "000000"
|
70
|
-
row(0).columns(0..2).font_style = :bold
|
71
|
-
row(0).columns(0..2).align = :center
|
72
|
-
end
|
73
|
-
|
74
|
-
...which would render the following output:
|
75
|
-
|
76
|
-
{<img src="https://github.com/bkuhlmann/prawn_plus/raw/master/doc/examples/complex.png" />}[https://github.com/bkuhlmann/prawn_plus]
|
77
|
-
|
78
|
-
NOTE: The _pdf_ object must always be referenced when making using of the Prawn syntax - it is initialized for you
|
79
|
-
as a Prawn::Document instance.
|
80
|
-
|
81
|
-
== Controllers
|
82
|
-
|
83
|
-
Within your controller, only the respond_to method is required. Using the same example above, only the following
|
84
|
-
would be necessary:
|
85
|
-
|
86
|
-
class DocumentsController < ApplicationController
|
87
|
-
respond_to :pdf
|
88
|
-
|
89
|
-
def show
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
That's it!
|
94
|
-
|
95
|
-
= Tests
|
96
|
-
|
97
|
-
To test, do the following:
|
98
|
-
|
99
|
-
1. cd to the gem root.
|
100
|
-
2. bundle install
|
101
|
-
3. bundle exec rspec spec
|
102
|
-
|
103
|
-
= Contributions
|
104
|
-
|
105
|
-
Read CONTRIBUTING for details.
|
106
|
-
|
107
|
-
= Credits
|
108
|
-
|
109
|
-
Developed by {Brooke Kuhlmann}[http://www.redalchemist.com] at {Red Alchemist}[http://www.redalchemist.com]
|
110
|
-
|
111
|
-
= License
|
112
|
-
|
113
|
-
Copyright (c) 2012 {Red Alchemist}[http://www.redalchemist.com].
|
114
|
-
Read the LICENSE for details.
|
115
|
-
|
116
|
-
= History
|
117
|
-
|
118
|
-
Read the CHANGELOG for details.
|
119
|
-
Built with Gemsmith[https://github.com/bkuhlmann/gemsmith].
|