prawn_plus 9.1.4 → 10.4.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 +2 -1
- data.tar.gz.sig +0 -0
- data/{LICENSE.md → LICENSE.adoc} +29 -30
- data/README.adoc +176 -0
- data/lib/prawn_plus/identity.rb +4 -15
- data/lib/prawn_plus/template_handlers/prawn.rb +1 -1
- metadata +62 -117
- metadata.gz.sig +0 -0
- data/README.md +0 -155
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abbb251e62d10a8899e59e7463221e77079a5196bb22d3bd2a523bfccdb50992
|
4
|
+
data.tar.gz: 2d137894a79bb5cceac9752656a9d0f5cacfd36103055657daf12595d0dc6a0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04a5b4a6b1263f0ca704402bfd405c0d15e499fc344ea22b9d216a4dc708d8a486513db4edf8cd2a5716fe313b7e20ae092ab10494c346b81f2f36839130a985
|
7
|
+
data.tar.gz: 53032243777371405396947a9e8f9856d028143f44265a2b178ec2adc7808347ad92e3c57d83ba3994c958ae7bdf2342d9aa1cc0d482f8be7d9bb2b1b0fe105a
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
0�۞�����W#ť�fL��\.
|
2
|
+
�bOE�r��^��Byg��12 pWk;8Aml}ޅ�y<e���=�Kn�x��y�nEJ�cHqb�������^�+-��\]�� v*7�kSl��?�� ['W��,\V���[�x\i�&�m�q[�NH�<�(�
|
data.tar.gz.sig
CHANGED
Binary file
|
data/{LICENSE.md → LICENSE.adoc}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
= Apache License
|
2
2
|
|
3
3
|
Version 2.0, January 2004
|
4
4
|
|
@@ -6,7 +6,7 @@ http://www.apache.org/licenses
|
|
6
6
|
|
7
7
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
8
8
|
|
9
|
-
|
9
|
+
== 1. Definitions
|
10
10
|
|
11
11
|
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by
|
12
12
|
Sections 1 through 9 of this document.
|
@@ -54,14 +54,14 @@ Contribution."
|
|
54
54
|
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a
|
55
55
|
Contribution has been received by Licensor and subsequently incorporated within the Work.
|
56
56
|
|
57
|
-
|
57
|
+
== 2. Grant of Copyright License
|
58
58
|
|
59
59
|
Subject to the terms and conditions of this License, each Contributor hereby grants to You a
|
60
60
|
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to
|
61
61
|
reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and
|
62
62
|
distribute the Work and such Derivative Works in Source or Object form.
|
63
63
|
|
64
|
-
|
64
|
+
== 3. Grant of Patent License
|
65
65
|
|
66
66
|
Subject to the terms and conditions of this License, each Contributor hereby grants to You a
|
67
67
|
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
|
@@ -74,39 +74,38 @@ a Contribution incorporated within the Work constitutes direct or contributory p
|
|
74
74
|
then any patent licenses granted to You under this License for that Work shall terminate as of the
|
75
75
|
date such litigation is filed.
|
76
76
|
|
77
|
-
|
77
|
+
== 4. Redistribution
|
78
78
|
|
79
79
|
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with
|
80
80
|
or without modifications, and in Source or Object form, provided that You meet the following
|
81
81
|
conditions:
|
82
82
|
|
83
|
-
|
83
|
+
. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
84
84
|
|
85
|
-
|
86
|
-
|
85
|
+
. You must cause any modified files to carry prominent notices stating that You changed the files;
|
86
|
+
and
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
88
|
+
. You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
|
89
|
+
patent, trademark, and attribution notices from the Source form of the Work, excluding those
|
90
|
+
notices that do not pertain to any part of the Derivative Works; and
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
construed as modifying the License.
|
92
|
+
. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works
|
93
|
+
that You distribute must include a readable copy of the attribution notices contained within such
|
94
|
+
NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in
|
95
|
+
at least one of the following places: within a NOTICE text file distributed as part of the
|
96
|
+
Derivative Works; within the Source form or documentation, if provided along with the Derivative
|
97
|
+
Works; or, within a display generated by the Derivative Works, if and wherever such third-party
|
98
|
+
notices normally appear. The contents of the NOTICE file are for informational purposes only and
|
99
|
+
do not modify the License. You may add Your own attribution notices within Derivative Works that
|
100
|
+
You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such
|
101
|
+
additional attribution notices cannot be construed as modifying the License.
|
103
102
|
|
104
103
|
You may add Your own copyright statement to Your modifications and may provide additional or
|
105
104
|
different license terms and conditions for use, reproduction, or distribution of Your modifications,
|
106
105
|
or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of
|
107
106
|
the Work otherwise complies with the conditions stated in this License.
|
108
107
|
|
109
|
-
|
108
|
+
== 5. Submission of Contributions
|
110
109
|
|
111
110
|
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the
|
112
111
|
Work by You to the Licensor shall be under the terms and conditions of this License, without any
|
@@ -114,13 +113,13 @@ additional terms or conditions. Notwithstanding the above, nothing herein shall
|
|
114
113
|
the terms of any separate license agreement you may have executed with Licensor regarding such
|
115
114
|
Contributions.
|
116
115
|
|
117
|
-
|
116
|
+
== 6. Trademarks
|
118
117
|
|
119
118
|
This License does not grant permission to use the trade names, trademarks, service marks, or product
|
120
119
|
names of the Licensor, except as required for reasonable and customary use in describing the origin
|
121
120
|
of the Work and reproducing the content of the NOTICE file.
|
122
121
|
|
123
|
-
|
122
|
+
== 7. Disclaimer of Warranty
|
124
123
|
|
125
124
|
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each
|
126
125
|
Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
@@ -129,7 +128,7 @@ TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. Y
|
|
129
128
|
responsible for determining the appropriateness of using or redistributing the Work and assume any
|
130
129
|
risks associated with Your exercise of permissions under this License.
|
131
130
|
|
132
|
-
|
131
|
+
== 8. Limitation of Liability
|
133
132
|
|
134
133
|
In no event and under no legal theory, whether in tort (including negligence), contract, or
|
135
134
|
otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or
|
@@ -139,7 +138,7 @@ License or out of the use or inability to use the Work (including but not limite
|
|
139
138
|
loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial
|
140
139
|
damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
141
140
|
|
142
|
-
|
141
|
+
== 9. Accepting Warranty or Additional Liability
|
143
142
|
|
144
143
|
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee
|
145
144
|
for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights
|
@@ -151,11 +150,11 @@ additional liability.
|
|
151
150
|
|
152
151
|
END OF TERMS AND CONDITIONS
|
153
152
|
|
154
|
-
Copyright 2012
|
153
|
+
Copyright 2012 link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
|
155
154
|
|
156
155
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
157
|
-
compliance with the License. You may obtain a
|
158
|
-
the License.
|
156
|
+
compliance with the License. You may obtain a link:https://www.apache.org/licenses/LICENSE-2.0[copy]
|
157
|
+
of the License.
|
159
158
|
|
160
159
|
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
161
160
|
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
data/README.adoc
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
:toc: macro
|
2
|
+
:toclevels: 5
|
3
|
+
:figure-caption!:
|
4
|
+
|
5
|
+
= Prawn+
|
6
|
+
|
7
|
+
[link=http://badge.fury.io/rb/prawn_plus]
|
8
|
+
image::https://badge.fury.io/rb/prawn_plus.svg[Gem Version]
|
9
|
+
[link=https://www.alchemists.io/projects/code_quality]
|
10
|
+
image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchemists Style Guide]
|
11
|
+
[link=https://circleci.com/gh/bkuhlmann/prawn_plus]
|
12
|
+
image::https://circleci.com/gh/bkuhlmann/prawn_plus.svg?style=svg[Circle CI Status]
|
13
|
+
|
14
|
+
toc::[]
|
15
|
+
|
16
|
+
== Features
|
17
|
+
|
18
|
+
* Loads the https://github.com/prawnpdf/prawn[Prawn] gem by default (no Gemfile entry necessary).
|
19
|
+
* Registers PDF as a MIME type.
|
20
|
+
* Registers a template handler for rendering "`.prawn`" template view files.
|
21
|
+
|
22
|
+
== Requirements
|
23
|
+
|
24
|
+
. https://www.ruby-lang.org[Ruby]
|
25
|
+
. https://rubyonrails.org[Ruby on Rails]
|
26
|
+
. https://github.com/prawnpdf/prawn[Prawn]
|
27
|
+
|
28
|
+
== Setup
|
29
|
+
|
30
|
+
To install, run:
|
31
|
+
|
32
|
+
[source,bash]
|
33
|
+
----
|
34
|
+
gem install prawn_plus
|
35
|
+
----
|
36
|
+
|
37
|
+
Add the following to your Gemfile:
|
38
|
+
|
39
|
+
[source,ruby]
|
40
|
+
----
|
41
|
+
gem "prawn_plus"
|
42
|
+
----
|
43
|
+
|
44
|
+
== Usage
|
45
|
+
|
46
|
+
=== Views
|
47
|
+
|
48
|
+
Within your views you can craft Prawn templates using Ruby code. For example, assuming there are
|
49
|
+
document resources, then the following structure might exist:
|
50
|
+
|
51
|
+
....
|
52
|
+
/views/documents/show.html.slim
|
53
|
+
/views/documents/show.pdf.prawn
|
54
|
+
....
|
55
|
+
|
56
|
+
The `show.html.slim` could have a link to the PDF download. Example:
|
57
|
+
|
58
|
+
....
|
59
|
+
= link_to "PDF Download", action: "show", id: @document.id, format: "pdf"
|
60
|
+
....
|
61
|
+
|
62
|
+
The `show.pdf.prawn` file would contain the Prawn syntax for crafting the PDF. A simple example
|
63
|
+
might look like this:
|
64
|
+
|
65
|
+
[source,ruby]
|
66
|
+
----
|
67
|
+
pdf.text "Hello, I'm a PDF!"
|
68
|
+
----
|
69
|
+
|
70
|
+
...which would render the following output:
|
71
|
+
|
72
|
+
image::https://www.alchemists.io/images/projects/prawn_plus/screenshots/basic.png[Basic Example]
|
73
|
+
|
74
|
+
You could also render a more complex PDF with tabular information, for example:
|
75
|
+
|
76
|
+
[source,ruby]
|
77
|
+
----
|
78
|
+
pdf.text "Metals"
|
79
|
+
pdf.move_down 10
|
80
|
+
pdf.font_size = 10
|
81
|
+
|
82
|
+
data = [
|
83
|
+
["Name", "Atomic Number", "Price"],
|
84
|
+
["Mercury", "80", number_to_currency(10)],
|
85
|
+
["Platinum", "78", number_to_currency(25)],
|
86
|
+
["Titanium", "22", number_to_currency(50)]
|
87
|
+
]
|
88
|
+
|
89
|
+
pdf.table data, header: true, column_widths: [100, 50, 50], row_colors: ["FFFFFF", "E5ECF9"] do
|
90
|
+
columns(0).align = :left
|
91
|
+
columns(1..2).align = :right
|
92
|
+
row(0).text_color = "FFFFFF"
|
93
|
+
row(0).background_color = "000000"
|
94
|
+
row(0).columns(0..2).font_style = :bold
|
95
|
+
row(0).columns(0..2).align = :center
|
96
|
+
end
|
97
|
+
----
|
98
|
+
|
99
|
+
...which would render the following output:
|
100
|
+
|
101
|
+
image::https://www.alchemists.io/images/projects/prawn_plus/screenshots/complex.png[Complex Example]
|
102
|
+
|
103
|
+
_NOTE: The `pdf` object must always be referenced when making using of the Prawn syntax - it is
|
104
|
+
initialized for you as a Prawn::Document instance._
|
105
|
+
|
106
|
+
=== Controllers
|
107
|
+
|
108
|
+
Within your controller, only the `respond_to` method is required. Example:
|
109
|
+
|
110
|
+
[source,ruby]
|
111
|
+
----
|
112
|
+
class DocumentsController < ApplicationController
|
113
|
+
respond_to :pdf
|
114
|
+
|
115
|
+
def show
|
116
|
+
end
|
117
|
+
end
|
118
|
+
----
|
119
|
+
|
120
|
+
That’s it!
|
121
|
+
|
122
|
+
== Development
|
123
|
+
|
124
|
+
To contribute, run:
|
125
|
+
|
126
|
+
[source,bash]
|
127
|
+
----
|
128
|
+
git clone https://github.com/bkuhlmann/prawn_plus.git
|
129
|
+
cd prawn_plus
|
130
|
+
bin/setup
|
131
|
+
----
|
132
|
+
|
133
|
+
You can also use the IRB console for direct access to all objects:
|
134
|
+
|
135
|
+
[source,bash]
|
136
|
+
----
|
137
|
+
bin/console
|
138
|
+
----
|
139
|
+
|
140
|
+
== Tests
|
141
|
+
|
142
|
+
To test, run:
|
143
|
+
|
144
|
+
[source,bash]
|
145
|
+
----
|
146
|
+
bundle exec rake
|
147
|
+
----
|
148
|
+
|
149
|
+
== Versioning
|
150
|
+
|
151
|
+
Read link:https://semver.org[Semantic Versioning] for details. Briefly, it means:
|
152
|
+
|
153
|
+
* Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
154
|
+
* Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
155
|
+
* Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
156
|
+
|
157
|
+
== Code of Conduct
|
158
|
+
|
159
|
+
Please note that this project is released with a link:CODE_OF_CONDUCT.adoc[CODE OF CONDUCT]. By
|
160
|
+
participating in this project you agree to abide by its terms.
|
161
|
+
|
162
|
+
== Contributions
|
163
|
+
|
164
|
+
Read link:CONTRIBUTING.adoc[CONTRIBUTING] for details.
|
165
|
+
|
166
|
+
== License
|
167
|
+
|
168
|
+
Read link:LICENSE.adoc[LICENSE] for details.
|
169
|
+
|
170
|
+
== History
|
171
|
+
|
172
|
+
Read link:CHANGES.adoc[CHANGES] for details.
|
173
|
+
|
174
|
+
== Credits
|
175
|
+
|
176
|
+
Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
|
data/lib/prawn_plus/identity.rb
CHANGED
@@ -3,20 +3,9 @@
|
|
3
3
|
module PrawnPlus
|
4
4
|
# Gem identity information.
|
5
5
|
module Identity
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
def self.label
|
11
|
-
"Prawn+"
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.version
|
15
|
-
"9.1.4"
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.version_label
|
19
|
-
"#{label} #{version}"
|
20
|
-
end
|
6
|
+
NAME = "prawn_plus"
|
7
|
+
LABEL = "Prawn+"
|
8
|
+
VERSION = "10.4.0"
|
9
|
+
VERSION_LABEL = "#{LABEL} #{VERSION}"
|
21
10
|
end
|
22
11
|
end
|
@@ -5,7 +5,7 @@ module PrawnPlus
|
|
5
5
|
# Renderer for a Prawn template. Assumes the template will reference a _pdf_ (a.k.a.
|
6
6
|
# Prawn:Document) instance.
|
7
7
|
class Prawn
|
8
|
-
def call template
|
8
|
+
def call template, _source
|
9
9
|
"pdf = ::Prawn::Document.new;" + template.source + ";pdf.render;"
|
10
10
|
end
|
11
11
|
end
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 10.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIC/
|
14
|
-
|
15
|
-
|
13
|
+
MIIC/jCCAeagAwIBAgIBAzANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
|
14
|
+
a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMDAzMTUxNDQ1MzJaFw0yMTAzMTUx
|
15
|
+
NDQ1MzJaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
|
16
16
|
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
|
17
17
|
xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
|
18
18
|
brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
|
@@ -20,15 +20,15 @@ cert_chain:
|
|
20
20
|
D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
|
21
21
|
3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
|
22
22
|
AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
|
23
|
-
2CdikiiE3fJhP/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAIHhAlD3po4sTYqacXaQ
|
24
|
+
XI9jIhrfMy//2PgbHWcETtlJPBeNUbbSNBABcllUHKqYsVDlSvSmss034KSWNR8F
|
25
|
+
bF1GcloicyvcCC4y6IoW4it0COAcdeaaxkxiBSgKdQFpff9REnDlIKK4uQ9lLxIo
|
26
|
+
Y2G5xubiziKZkyfWFuSr67PIjW3Bu673D1JVBArhA1qbgQmYQcy1CkGOjo+iO8Nf
|
27
|
+
7u/QSfBHb+r/bXhKscDgPpnKwbUmvgO2+94zJG9KsrmIydlzYfsD09aXKx0t6Xy4
|
28
|
+
2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
|
29
|
+
QWc=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date:
|
31
|
+
date: 2020-11-15 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: prawn
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '2.
|
39
|
+
version: '2.3'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '2.
|
46
|
+
version: '2.3'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: prawn-table
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,56 +64,42 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '6.0'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '6.0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '1.8'
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '1.8'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: bond
|
76
|
+
name: bundler-audit
|
91
77
|
requirement: !ruby/object:Gem::Requirement
|
92
78
|
requirements:
|
93
79
|
- - "~>"
|
94
80
|
- !ruby/object:Gem::Version
|
95
|
-
version: '0.
|
81
|
+
version: '0.7'
|
96
82
|
type: :development
|
97
83
|
prerelease: false
|
98
84
|
version_requirements: !ruby/object:Gem::Requirement
|
99
85
|
requirements:
|
100
86
|
- - "~>"
|
101
87
|
- !ruby/object:Gem::Version
|
102
|
-
version: '0.
|
88
|
+
version: '0.7'
|
103
89
|
- !ruby/object:Gem::Dependency
|
104
|
-
name: bundler-
|
90
|
+
name: bundler-leak
|
105
91
|
requirement: !ruby/object:Gem::Requirement
|
106
92
|
requirements:
|
107
93
|
- - "~>"
|
108
94
|
- !ruby/object:Gem::Version
|
109
|
-
version: '0.
|
95
|
+
version: '0.2'
|
110
96
|
type: :development
|
111
97
|
prerelease: false
|
112
98
|
version_requirements: !ruby/object:Gem::Requirement
|
113
99
|
requirements:
|
114
100
|
- - "~>"
|
115
101
|
- !ruby/object:Gem::Version
|
116
|
-
version: '0.
|
102
|
+
version: '0.2'
|
117
103
|
- !ruby/object:Gem::Dependency
|
118
104
|
name: capybara
|
119
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,28 +120,28 @@ dependencies:
|
|
134
120
|
requirements:
|
135
121
|
- - "~>"
|
136
122
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
123
|
+
version: '14.8'
|
138
124
|
type: :development
|
139
125
|
prerelease: false
|
140
126
|
version_requirements: !ruby/object:Gem::Requirement
|
141
127
|
requirements:
|
142
128
|
- - "~>"
|
143
129
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
130
|
+
version: '14.8'
|
145
131
|
- !ruby/object:Gem::Dependency
|
146
|
-
name: git-
|
132
|
+
name: git-lint
|
147
133
|
requirement: !ruby/object:Gem::Requirement
|
148
134
|
requirements:
|
149
135
|
- - "~>"
|
150
136
|
- !ruby/object:Gem::Version
|
151
|
-
version: '3
|
137
|
+
version: '1.3'
|
152
138
|
type: :development
|
153
139
|
prerelease: false
|
154
140
|
version_requirements: !ruby/object:Gem::Requirement
|
155
141
|
requirements:
|
156
142
|
- - "~>"
|
157
143
|
- !ruby/object:Gem::Version
|
158
|
-
version: '3
|
144
|
+
version: '1.3'
|
159
145
|
- !ruby/object:Gem::Dependency
|
160
146
|
name: guard-rspec
|
161
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,62 +156,48 @@ dependencies:
|
|
170
156
|
- - "~>"
|
171
157
|
- !ruby/object:Gem::Version
|
172
158
|
version: '4.7'
|
173
|
-
- !ruby/object:Gem::Dependency
|
174
|
-
name: hirb
|
175
|
-
requirement: !ruby/object:Gem::Requirement
|
176
|
-
requirements:
|
177
|
-
- - "~>"
|
178
|
-
- !ruby/object:Gem::Version
|
179
|
-
version: '0.7'
|
180
|
-
type: :development
|
181
|
-
prerelease: false
|
182
|
-
version_requirements: !ruby/object:Gem::Requirement
|
183
|
-
requirements:
|
184
|
-
- - "~>"
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
version: '0.7'
|
187
159
|
- !ruby/object:Gem::Dependency
|
188
160
|
name: pg
|
189
161
|
requirement: !ruby/object:Gem::Requirement
|
190
162
|
requirements:
|
191
163
|
- - "~>"
|
192
164
|
- !ruby/object:Gem::Version
|
193
|
-
version: '1.
|
165
|
+
version: '1.2'
|
194
166
|
type: :development
|
195
167
|
prerelease: false
|
196
168
|
version_requirements: !ruby/object:Gem::Requirement
|
197
169
|
requirements:
|
198
170
|
- - "~>"
|
199
171
|
- !ruby/object:Gem::Version
|
200
|
-
version: '1.
|
172
|
+
version: '1.2'
|
201
173
|
- !ruby/object:Gem::Dependency
|
202
174
|
name: pry
|
203
175
|
requirement: !ruby/object:Gem::Requirement
|
204
176
|
requirements:
|
205
177
|
- - "~>"
|
206
178
|
- !ruby/object:Gem::Version
|
207
|
-
version: '0.
|
179
|
+
version: '0.13'
|
208
180
|
type: :development
|
209
181
|
prerelease: false
|
210
182
|
version_requirements: !ruby/object:Gem::Requirement
|
211
183
|
requirements:
|
212
184
|
- - "~>"
|
213
185
|
- !ruby/object:Gem::Version
|
214
|
-
version: '0.
|
186
|
+
version: '0.13'
|
215
187
|
- !ruby/object:Gem::Dependency
|
216
188
|
name: pry-byebug
|
217
189
|
requirement: !ruby/object:Gem::Requirement
|
218
190
|
requirements:
|
219
191
|
- - "~>"
|
220
192
|
- !ruby/object:Gem::Version
|
221
|
-
version: '3.
|
193
|
+
version: '3.9'
|
222
194
|
type: :development
|
223
195
|
prerelease: false
|
224
196
|
version_requirements: !ruby/object:Gem::Requirement
|
225
197
|
requirements:
|
226
198
|
- - "~>"
|
227
199
|
- !ruby/object:Gem::Version
|
228
|
-
version: '3.
|
200
|
+
version: '3.9'
|
229
201
|
- !ruby/object:Gem::Dependency
|
230
202
|
name: rake
|
231
203
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,149 +218,122 @@ dependencies:
|
|
246
218
|
requirements:
|
247
219
|
- - "~>"
|
248
220
|
- !ruby/object:Gem::Version
|
249
|
-
version: '
|
221
|
+
version: '6.0'
|
250
222
|
type: :development
|
251
223
|
prerelease: false
|
252
224
|
version_requirements: !ruby/object:Gem::Requirement
|
253
225
|
requirements:
|
254
226
|
- - "~>"
|
255
227
|
- !ruby/object:Gem::Version
|
256
|
-
version: '
|
228
|
+
version: '6.0'
|
257
229
|
- !ruby/object:Gem::Dependency
|
258
230
|
name: rspec-rails
|
259
231
|
requirement: !ruby/object:Gem::Requirement
|
260
232
|
requirements:
|
261
233
|
- - "~>"
|
262
234
|
- !ruby/object:Gem::Version
|
263
|
-
version: '
|
235
|
+
version: '4.0'
|
264
236
|
type: :development
|
265
237
|
prerelease: false
|
266
238
|
version_requirements: !ruby/object:Gem::Requirement
|
267
239
|
requirements:
|
268
240
|
- - "~>"
|
269
241
|
- !ruby/object:Gem::Version
|
270
|
-
version: '
|
242
|
+
version: '4.0'
|
271
243
|
- !ruby/object:Gem::Dependency
|
272
244
|
name: rubocop
|
273
245
|
requirement: !ruby/object:Gem::Requirement
|
274
246
|
requirements:
|
275
247
|
- - "~>"
|
276
248
|
- !ruby/object:Gem::Version
|
277
|
-
version: '
|
249
|
+
version: '1.3'
|
278
250
|
type: :development
|
279
251
|
prerelease: false
|
280
252
|
version_requirements: !ruby/object:Gem::Requirement
|
281
253
|
requirements:
|
282
254
|
- - "~>"
|
283
255
|
- !ruby/object:Gem::Version
|
284
|
-
version: '
|
256
|
+
version: '1.3'
|
285
257
|
- !ruby/object:Gem::Dependency
|
286
258
|
name: rubocop-performance
|
287
259
|
requirement: !ruby/object:Gem::Requirement
|
288
260
|
requirements:
|
289
261
|
- - "~>"
|
290
262
|
- !ruby/object:Gem::Version
|
291
|
-
version: '1.
|
263
|
+
version: '1.8'
|
292
264
|
type: :development
|
293
265
|
prerelease: false
|
294
266
|
version_requirements: !ruby/object:Gem::Requirement
|
295
267
|
requirements:
|
296
268
|
- - "~>"
|
297
269
|
- !ruby/object:Gem::Version
|
298
|
-
version: '1.
|
270
|
+
version: '1.8'
|
299
271
|
- !ruby/object:Gem::Dependency
|
300
272
|
name: rubocop-rake
|
301
273
|
requirement: !ruby/object:Gem::Requirement
|
302
274
|
requirements:
|
303
275
|
- - "~>"
|
304
276
|
- !ruby/object:Gem::Version
|
305
|
-
version: '0.
|
277
|
+
version: '0.5'
|
306
278
|
type: :development
|
307
279
|
prerelease: false
|
308
280
|
version_requirements: !ruby/object:Gem::Requirement
|
309
281
|
requirements:
|
310
282
|
- - "~>"
|
311
283
|
- !ruby/object:Gem::Version
|
312
|
-
version: '0.
|
284
|
+
version: '0.5'
|
313
285
|
- !ruby/object:Gem::Dependency
|
314
286
|
name: rubocop-rspec
|
315
287
|
requirement: !ruby/object:Gem::Requirement
|
316
288
|
requirements:
|
317
289
|
- - "~>"
|
318
290
|
- !ruby/object:Gem::Version
|
319
|
-
version: '
|
291
|
+
version: '2.0'
|
320
292
|
type: :development
|
321
293
|
prerelease: false
|
322
294
|
version_requirements: !ruby/object:Gem::Requirement
|
323
295
|
requirements:
|
324
296
|
- - "~>"
|
325
297
|
- !ruby/object:Gem::Version
|
326
|
-
version: '
|
298
|
+
version: '2.0'
|
327
299
|
- !ruby/object:Gem::Dependency
|
328
300
|
name: simplecov
|
329
301
|
requirement: !ruby/object:Gem::Requirement
|
330
302
|
requirements:
|
331
303
|
- - "~>"
|
332
304
|
- !ruby/object:Gem::Version
|
333
|
-
version: '0.
|
334
|
-
type: :development
|
335
|
-
prerelease: false
|
336
|
-
version_requirements: !ruby/object:Gem::Requirement
|
337
|
-
requirements:
|
338
|
-
- - "~>"
|
339
|
-
- !ruby/object:Gem::Version
|
340
|
-
version: '0.13'
|
341
|
-
- !ruby/object:Gem::Dependency
|
342
|
-
name: sqlite3
|
343
|
-
requirement: !ruby/object:Gem::Requirement
|
344
|
-
requirements:
|
345
|
-
- - "~>"
|
346
|
-
- !ruby/object:Gem::Version
|
347
|
-
version: '1.3'
|
305
|
+
version: '0.19'
|
348
306
|
type: :development
|
349
307
|
prerelease: false
|
350
308
|
version_requirements: !ruby/object:Gem::Requirement
|
351
309
|
requirements:
|
352
310
|
- - "~>"
|
353
311
|
- !ruby/object:Gem::Version
|
354
|
-
version: '
|
355
|
-
|
356
|
-
name: wirb
|
357
|
-
requirement: !ruby/object:Gem::Requirement
|
358
|
-
requirements:
|
359
|
-
- - "~>"
|
360
|
-
- !ruby/object:Gem::Version
|
361
|
-
version: '2.1'
|
362
|
-
type: :development
|
363
|
-
prerelease: false
|
364
|
-
version_requirements: !ruby/object:Gem::Requirement
|
365
|
-
requirements:
|
366
|
-
- - "~>"
|
367
|
-
- !ruby/object:Gem::Version
|
368
|
-
version: '2.1'
|
369
|
-
description:
|
312
|
+
version: '0.19'
|
313
|
+
description:
|
370
314
|
email:
|
371
315
|
- brooke@alchemists.io
|
372
316
|
executables: []
|
373
317
|
extensions: []
|
374
318
|
extra_rdoc_files:
|
375
|
-
- README.
|
376
|
-
- LICENSE.
|
319
|
+
- README.adoc
|
320
|
+
- LICENSE.adoc
|
377
321
|
files:
|
378
|
-
- LICENSE.
|
379
|
-
- README.
|
322
|
+
- LICENSE.adoc
|
323
|
+
- README.adoc
|
380
324
|
- lib/prawn_plus.rb
|
381
325
|
- lib/prawn_plus/identity.rb
|
382
326
|
- lib/prawn_plus/railtie.rb
|
383
327
|
- lib/prawn_plus/template_handlers/prawn.rb
|
384
|
-
homepage: https://
|
328
|
+
homepage: https://www.alchemists.io/projects/prawn_plus
|
385
329
|
licenses:
|
386
330
|
- Apache-2.0
|
387
331
|
metadata:
|
388
|
-
source_code_uri: https://github.com/bkuhlmann/prawn_plus
|
389
|
-
changelog_uri: https://github.com/bkuhlmann/prawn_plus/blob/master/CHANGES.md
|
390
332
|
bug_tracker_uri: https://github.com/bkuhlmann/prawn_plus/issues
|
391
|
-
|
333
|
+
changelog_uri: https://www.alchemists.io/projects/prawn_plus/changes.html
|
334
|
+
documentation_uri: https://www.alchemists.io/projects/prawn_plus
|
335
|
+
source_code_uri: https://github.com/bkuhlmann/prawn_plus
|
336
|
+
post_install_message:
|
392
337
|
rdoc_options: []
|
393
338
|
require_paths:
|
394
339
|
- lib
|
@@ -396,15 +341,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
396
341
|
requirements:
|
397
342
|
- - "~>"
|
398
343
|
- !ruby/object:Gem::Version
|
399
|
-
version: '2.
|
344
|
+
version: '2.7'
|
400
345
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
401
346
|
requirements:
|
402
347
|
- - ">="
|
403
348
|
- !ruby/object:Gem::Version
|
404
349
|
version: '0'
|
405
350
|
requirements: []
|
406
|
-
rubygems_version: 3.
|
407
|
-
signing_key:
|
351
|
+
rubygems_version: 3.1.4
|
352
|
+
signing_key:
|
408
353
|
specification_version: 4
|
409
|
-
summary:
|
354
|
+
summary: A Rails renderer for Prawn PDFs.
|
410
355
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
data/README.md
DELETED
@@ -1,155 +0,0 @@
|
|
1
|
-
<p align="center">
|
2
|
-
<img src="prawn_plus.png" alt="Prawn+ Icon"/>
|
3
|
-
</p>
|
4
|
-
|
5
|
-
# Prawn+
|
6
|
-
|
7
|
-
[![Gem Version](https://badge.fury.io/rb/prawn_plus.svg)](http://badge.fury.io/rb/prawn_plus)
|
8
|
-
[![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/11437f0567f0cd96d04e/maintainability)](https://codeclimate.com/github/bkuhlmann/prawn_plus/maintainability)
|
9
|
-
[![Code Climate Test Coverage](https://api.codeclimate.com/v1/badges/11437f0567f0cd96d04e/test_coverage)](https://codeclimate.com/github/bkuhlmann/prawn_plus/test_coverage)
|
10
|
-
[![Circle CI Status](https://circleci.com/gh/bkuhlmann/prawn_plus.svg?style=svg)](https://circleci.com/gh/bkuhlmann/prawn_plus)
|
11
|
-
|
12
|
-
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
13
|
-
|
14
|
-
## Table of Contents
|
15
|
-
|
16
|
-
- [Features](#features)
|
17
|
-
- [Requirements](#requirements)
|
18
|
-
- [Setup](#setup)
|
19
|
-
- [Usage](#usage)
|
20
|
-
- [Views](#views)
|
21
|
-
- [Controllers](#controllers)
|
22
|
-
- [Tests](#tests)
|
23
|
-
- [Versioning](#versioning)
|
24
|
-
- [Code of Conduct](#code-of-conduct)
|
25
|
-
- [Contributions](#contributions)
|
26
|
-
- [License](#license)
|
27
|
-
- [History](#history)
|
28
|
-
- [Credits](#credits)
|
29
|
-
|
30
|
-
<!-- Tocer[finish]: Auto-generated, don't remove. -->
|
31
|
-
|
32
|
-
## Features
|
33
|
-
|
34
|
-
- Loads the [Prawn](https://github.com/prawnpdf/prawn) gem by default (no Gemfile entry necessary).
|
35
|
-
- Registers PDF as a MIME type.
|
36
|
-
- Registers a template handler for rendering ".prawn" template view files.
|
37
|
-
|
38
|
-
## Requirements
|
39
|
-
|
40
|
-
1. [Ruby 2.6.x](https://www.ruby-lang.org).
|
41
|
-
1. [Ruby on Rails 5.x.x](http://rubyonrails.org).
|
42
|
-
1. [Prawn](https://github.com/prawnpdf/prawn).
|
43
|
-
|
44
|
-
## Setup
|
45
|
-
|
46
|
-
Type the following to install:
|
47
|
-
|
48
|
-
gem install prawn_plus
|
49
|
-
|
50
|
-
Add the following to your Gemfile:
|
51
|
-
|
52
|
-
gem "prawn_plus"
|
53
|
-
|
54
|
-
## Usage
|
55
|
-
|
56
|
-
### Views
|
57
|
-
|
58
|
-
Within your views you can craft Prawn templates using Ruby code. For example, assuming there are
|
59
|
-
document resources, then the following structure might exist:
|
60
|
-
|
61
|
-
/views/documents/show.html.slim
|
62
|
-
/views/documents/show.pdf.prawn
|
63
|
-
|
64
|
-
The `show.html.slim` could have a link to the PDF download. Example:
|
65
|
-
|
66
|
-
= link_to "PDF Download", action: "show", id: @document.id, format: "pdf"
|
67
|
-
|
68
|
-
The `show.pdf.prawn` file would contain the Prawn syntax for crafting the PDF. A simple example
|
69
|
-
might look like this:
|
70
|
-
|
71
|
-
pdf.text "Hello, I'm a PDF!"
|
72
|
-
|
73
|
-
...which would render the following output:
|
74
|
-
|
75
|
-
[![Basic Example](https://github.com/bkuhlmann/prawn_plus/raw/master/doc/examples/basic.png)](https://github.com/bkuhlmann/prawn_plus)
|
76
|
-
|
77
|
-
You could also render a more complex PDF with tabular information, for example:
|
78
|
-
|
79
|
-
pdf.text "Metals"
|
80
|
-
pdf.move_down 10
|
81
|
-
pdf.font_size = 10
|
82
|
-
|
83
|
-
data = [
|
84
|
-
["Name", "Atomic Number", "Price"],
|
85
|
-
["Mercury", "80", number_to_currency(10)],
|
86
|
-
["Platinum", "78", number_to_currency(25)],
|
87
|
-
["Titanium", "22", number_to_currency(50)]
|
88
|
-
]
|
89
|
-
|
90
|
-
pdf.table data, header: true, column_widths: [100, 50, 50], row_colors: ["FFFFFF", "E5ECF9"] do
|
91
|
-
columns(0).align = :left
|
92
|
-
columns(1..2).align = :right
|
93
|
-
row(0).text_color = "FFFFFF"
|
94
|
-
row(0).background_color = "000000"
|
95
|
-
row(0).columns(0..2).font_style = :bold
|
96
|
-
row(0).columns(0..2).align = :center
|
97
|
-
end
|
98
|
-
|
99
|
-
...which would render the following output:
|
100
|
-
|
101
|
-
[![Complex Example](https://github.com/bkuhlmann/prawn_plus/raw/master/doc/examples/complex.png)](https://github.com/bkuhlmann/prawn_plus)
|
102
|
-
|
103
|
-
*NOTE: The `pdf` object must always be referenced when making using of the Prawn syntax - it is
|
104
|
-
initialized for you as a Prawn::Document instance.*
|
105
|
-
|
106
|
-
### Controllers
|
107
|
-
|
108
|
-
Within your controller, only the `respond_to` method is required. Example:
|
109
|
-
|
110
|
-
class DocumentsController < ApplicationController
|
111
|
-
respond_to :pdf
|
112
|
-
|
113
|
-
def show
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
That's it!
|
118
|
-
|
119
|
-
## Tests
|
120
|
-
|
121
|
-
To test, run:
|
122
|
-
|
123
|
-
bundle exec rake
|
124
|
-
|
125
|
-
## Versioning
|
126
|
-
|
127
|
-
Read [Semantic Versioning](https://semver.org) for details. Briefly, it means:
|
128
|
-
|
129
|
-
- Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
130
|
-
- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
131
|
-
- Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
132
|
-
|
133
|
-
## Code of Conduct
|
134
|
-
|
135
|
-
Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
|
136
|
-
participating in this project you agree to abide by its terms.
|
137
|
-
|
138
|
-
## Contributions
|
139
|
-
|
140
|
-
Read [CONTRIBUTING](CONTRIBUTING.md) for details.
|
141
|
-
|
142
|
-
## License
|
143
|
-
|
144
|
-
Copyright 2012 [Alchemists](https://www.alchemists.io).
|
145
|
-
Read [LICENSE](LICENSE.md) for details.
|
146
|
-
|
147
|
-
## History
|
148
|
-
|
149
|
-
Read [CHANGES](CHANGES.md) for details.
|
150
|
-
Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
|
151
|
-
|
152
|
-
## Credits
|
153
|
-
|
154
|
-
Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
|
155
|
-
[Alchemists](https://www.alchemists.io).
|