prawn_plus 9.1.2 → 10.2.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 +0 -0
- 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 +59 -114
- 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: c8eaa6803840714a3ff3038b4e5692df41fddc6cb5080e44dc9f42ccdc6cfe1f
|
4
|
+
data.tar.gz: cce397423f0fc8ba4225d92bf3b4f9e9bedfc63611593ea99a52d97eb45f7d95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 605045ee2a96e4069b56ddbee1993ef4e1ba35bbdfc1f15be05c3e866ab3317fbf3ff934665b3cd0a3d0ab3c5b41351a9994350be55ac61040c479660c8b0617
|
7
|
+
data.tar.gz: a3a91581144393d37b49b50519a9c2545c1e17bede54d49bb0e1e6898df0e55ddc27b81a36553f4330796f899ef4b22035879a41f7f0979898d4a5014af671ec
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
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
|
153
|
+
Copyright link:https://www.alchemists.io[Alchemists].
|
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://circleci.com/gh/bkuhlmann/prawn_plus]
|
10
|
+
image::https://circleci.com/gh/bkuhlmann/prawn_plus.svg?style=svg[Circle CI Status]
|
11
|
+
|
12
|
+
toc::[]
|
13
|
+
|
14
|
+
== Features
|
15
|
+
|
16
|
+
* Loads the https://github.com/prawnpdf/prawn[Prawn] gem by default (no Gemfile entry necessary).
|
17
|
+
* Registers PDF as a MIME type.
|
18
|
+
* Registers a template handler for rendering "`.prawn`" template view files.
|
19
|
+
|
20
|
+
== Requirements
|
21
|
+
|
22
|
+
. https://www.ruby-lang.org[Ruby]
|
23
|
+
. https://rubyonrails.org[Ruby on Rails]
|
24
|
+
. https://github.com/prawnpdf/prawn[Prawn]
|
25
|
+
|
26
|
+
== Setup
|
27
|
+
|
28
|
+
=== Production
|
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
|
+
=== Development
|
45
|
+
|
46
|
+
To contribute, run:
|
47
|
+
|
48
|
+
[source,bash]
|
49
|
+
----
|
50
|
+
git clone https://github.com/bkuhlmann/prawn_plus.git
|
51
|
+
cd prawn_plus
|
52
|
+
bin/setup
|
53
|
+
----
|
54
|
+
|
55
|
+
You can also use the IRB console for direct access to all objects:
|
56
|
+
|
57
|
+
[source,bash]
|
58
|
+
----
|
59
|
+
bin/console
|
60
|
+
----
|
61
|
+
|
62
|
+
== Usage
|
63
|
+
|
64
|
+
=== Views
|
65
|
+
|
66
|
+
Within your views you can craft Prawn templates using Ruby code. For example, assuming there are
|
67
|
+
document resources, then the following structure might exist:
|
68
|
+
|
69
|
+
....
|
70
|
+
/views/documents/show.html.slim
|
71
|
+
/views/documents/show.pdf.prawn
|
72
|
+
....
|
73
|
+
|
74
|
+
The `show.html.slim` could have a link to the PDF download. Example:
|
75
|
+
|
76
|
+
....
|
77
|
+
= link_to "PDF Download", action: "show", id: @document.id, format: "pdf"
|
78
|
+
....
|
79
|
+
|
80
|
+
The `show.pdf.prawn` file would contain the Prawn syntax for crafting the PDF. A simple example
|
81
|
+
might look like this:
|
82
|
+
|
83
|
+
[source,ruby]
|
84
|
+
----
|
85
|
+
pdf.text "Hello, I'm a PDF!"
|
86
|
+
----
|
87
|
+
|
88
|
+
...which would render the following output:
|
89
|
+
|
90
|
+
image::https://www.alchemists.io/images/projects/prawn_plus/screenshots/basic.png[Basic Example]
|
91
|
+
|
92
|
+
You could also render a more complex PDF with tabular information, for example:
|
93
|
+
|
94
|
+
[source,ruby]
|
95
|
+
----
|
96
|
+
pdf.text "Metals"
|
97
|
+
pdf.move_down 10
|
98
|
+
pdf.font_size = 10
|
99
|
+
|
100
|
+
data = [
|
101
|
+
["Name", "Atomic Number", "Price"],
|
102
|
+
["Mercury", "80", number_to_currency(10)],
|
103
|
+
["Platinum", "78", number_to_currency(25)],
|
104
|
+
["Titanium", "22", number_to_currency(50)]
|
105
|
+
]
|
106
|
+
|
107
|
+
pdf.table data, header: true, column_widths: [100, 50, 50], row_colors: ["FFFFFF", "E5ECF9"] do
|
108
|
+
columns(0).align = :left
|
109
|
+
columns(1..2).align = :right
|
110
|
+
row(0).text_color = "FFFFFF"
|
111
|
+
row(0).background_color = "000000"
|
112
|
+
row(0).columns(0..2).font_style = :bold
|
113
|
+
row(0).columns(0..2).align = :center
|
114
|
+
end
|
115
|
+
----
|
116
|
+
|
117
|
+
...which would render the following output:
|
118
|
+
|
119
|
+
image::https://www.alchemists.io/images/projects/prawn_plus/screenshots/complex.png[Complex Example]
|
120
|
+
|
121
|
+
_NOTE: The `pdf` object must always be referenced when making using of the Prawn syntax - it is
|
122
|
+
initialized for you as a Prawn::Document instance._
|
123
|
+
|
124
|
+
=== Controllers
|
125
|
+
|
126
|
+
Within your controller, only the `respond_to` method is required. Example:
|
127
|
+
|
128
|
+
[source,ruby]
|
129
|
+
----
|
130
|
+
class DocumentsController < ApplicationController
|
131
|
+
respond_to :pdf
|
132
|
+
|
133
|
+
def show
|
134
|
+
end
|
135
|
+
end
|
136
|
+
----
|
137
|
+
|
138
|
+
That’s it!
|
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.2"
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.version_label
|
19
|
-
"#{label} #{version}"
|
20
|
-
end
|
6
|
+
NAME = "prawn_plus"
|
7
|
+
LABEL = "Prawn+"
|
8
|
+
VERSION = "10.2.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.2.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-07-23 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: prawn
|
@@ -64,42 +64,14 @@ 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: '
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: awesome_print
|
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
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '0.5'
|
96
|
-
type: :development
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0.5'
|
74
|
+
version: '6.0'
|
103
75
|
- !ruby/object:Gem::Dependency
|
104
76
|
name: bundler-audit
|
105
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,28 +106,28 @@ dependencies:
|
|
134
106
|
requirements:
|
135
107
|
- - "~>"
|
136
108
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
109
|
+
version: '14.2'
|
138
110
|
type: :development
|
139
111
|
prerelease: false
|
140
112
|
version_requirements: !ruby/object:Gem::Requirement
|
141
113
|
requirements:
|
142
114
|
- - "~>"
|
143
115
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
116
|
+
version: '14.2'
|
145
117
|
- !ruby/object:Gem::Dependency
|
146
|
-
name: git-
|
118
|
+
name: git-lint
|
147
119
|
requirement: !ruby/object:Gem::Requirement
|
148
120
|
requirements:
|
149
121
|
- - "~>"
|
150
122
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
123
|
+
version: '1.0'
|
152
124
|
type: :development
|
153
125
|
prerelease: false
|
154
126
|
version_requirements: !ruby/object:Gem::Requirement
|
155
127
|
requirements:
|
156
128
|
- - "~>"
|
157
129
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
130
|
+
version: '1.0'
|
159
131
|
- !ruby/object:Gem::Dependency
|
160
132
|
name: guard-rspec
|
161
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,211 +142,184 @@ dependencies:
|
|
170
142
|
- - "~>"
|
171
143
|
- !ruby/object:Gem::Version
|
172
144
|
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
145
|
- !ruby/object:Gem::Dependency
|
188
146
|
name: pg
|
189
147
|
requirement: !ruby/object:Gem::Requirement
|
190
148
|
requirements:
|
191
149
|
- - "~>"
|
192
150
|
- !ruby/object:Gem::Version
|
193
|
-
version: '1.
|
151
|
+
version: '1.2'
|
194
152
|
type: :development
|
195
153
|
prerelease: false
|
196
154
|
version_requirements: !ruby/object:Gem::Requirement
|
197
155
|
requirements:
|
198
156
|
- - "~>"
|
199
157
|
- !ruby/object:Gem::Version
|
200
|
-
version: '1.
|
158
|
+
version: '1.2'
|
201
159
|
- !ruby/object:Gem::Dependency
|
202
160
|
name: pry
|
203
161
|
requirement: !ruby/object:Gem::Requirement
|
204
162
|
requirements:
|
205
163
|
- - "~>"
|
206
164
|
- !ruby/object:Gem::Version
|
207
|
-
version: '0.
|
165
|
+
version: '0.13'
|
208
166
|
type: :development
|
209
167
|
prerelease: false
|
210
168
|
version_requirements: !ruby/object:Gem::Requirement
|
211
169
|
requirements:
|
212
170
|
- - "~>"
|
213
171
|
- !ruby/object:Gem::Version
|
214
|
-
version: '0.
|
172
|
+
version: '0.13'
|
215
173
|
- !ruby/object:Gem::Dependency
|
216
174
|
name: pry-byebug
|
217
175
|
requirement: !ruby/object:Gem::Requirement
|
218
176
|
requirements:
|
219
177
|
- - "~>"
|
220
178
|
- !ruby/object:Gem::Version
|
221
|
-
version: '3.
|
179
|
+
version: '3.9'
|
222
180
|
type: :development
|
223
181
|
prerelease: false
|
224
182
|
version_requirements: !ruby/object:Gem::Requirement
|
225
183
|
requirements:
|
226
184
|
- - "~>"
|
227
185
|
- !ruby/object:Gem::Version
|
228
|
-
version: '3.
|
186
|
+
version: '3.9'
|
229
187
|
- !ruby/object:Gem::Dependency
|
230
188
|
name: rake
|
231
189
|
requirement: !ruby/object:Gem::Requirement
|
232
190
|
requirements:
|
233
191
|
- - "~>"
|
234
192
|
- !ruby/object:Gem::Version
|
235
|
-
version: '
|
193
|
+
version: '13.0'
|
236
194
|
type: :development
|
237
195
|
prerelease: false
|
238
196
|
version_requirements: !ruby/object:Gem::Requirement
|
239
197
|
requirements:
|
240
198
|
- - "~>"
|
241
199
|
- !ruby/object:Gem::Version
|
242
|
-
version: '
|
200
|
+
version: '13.0'
|
243
201
|
- !ruby/object:Gem::Dependency
|
244
202
|
name: reek
|
245
203
|
requirement: !ruby/object:Gem::Requirement
|
246
204
|
requirements:
|
247
205
|
- - "~>"
|
248
206
|
- !ruby/object:Gem::Version
|
249
|
-
version: '
|
207
|
+
version: '6.0'
|
250
208
|
type: :development
|
251
209
|
prerelease: false
|
252
210
|
version_requirements: !ruby/object:Gem::Requirement
|
253
211
|
requirements:
|
254
212
|
- - "~>"
|
255
213
|
- !ruby/object:Gem::Version
|
256
|
-
version: '
|
214
|
+
version: '6.0'
|
257
215
|
- !ruby/object:Gem::Dependency
|
258
216
|
name: rspec-rails
|
259
217
|
requirement: !ruby/object:Gem::Requirement
|
260
218
|
requirements:
|
261
219
|
- - "~>"
|
262
220
|
- !ruby/object:Gem::Version
|
263
|
-
version: '
|
221
|
+
version: '4.0'
|
264
222
|
type: :development
|
265
223
|
prerelease: false
|
266
224
|
version_requirements: !ruby/object:Gem::Requirement
|
267
225
|
requirements:
|
268
226
|
- - "~>"
|
269
227
|
- !ruby/object:Gem::Version
|
270
|
-
version: '
|
228
|
+
version: '4.0'
|
271
229
|
- !ruby/object:Gem::Dependency
|
272
230
|
name: rubocop
|
273
231
|
requirement: !ruby/object:Gem::Requirement
|
274
232
|
requirements:
|
275
233
|
- - "~>"
|
276
234
|
- !ruby/object:Gem::Version
|
277
|
-
version: '0.
|
235
|
+
version: '0.83'
|
278
236
|
type: :development
|
279
237
|
prerelease: false
|
280
238
|
version_requirements: !ruby/object:Gem::Requirement
|
281
239
|
requirements:
|
282
240
|
- - "~>"
|
283
241
|
- !ruby/object:Gem::Version
|
284
|
-
version: '0.
|
242
|
+
version: '0.83'
|
285
243
|
- !ruby/object:Gem::Dependency
|
286
244
|
name: rubocop-performance
|
287
245
|
requirement: !ruby/object:Gem::Requirement
|
288
246
|
requirements:
|
289
247
|
- - "~>"
|
290
248
|
- !ruby/object:Gem::Version
|
291
|
-
version: '1.
|
249
|
+
version: '1.5'
|
292
250
|
type: :development
|
293
251
|
prerelease: false
|
294
252
|
version_requirements: !ruby/object:Gem::Requirement
|
295
253
|
requirements:
|
296
254
|
- - "~>"
|
297
255
|
- !ruby/object:Gem::Version
|
298
|
-
version: '1.
|
256
|
+
version: '1.5'
|
299
257
|
- !ruby/object:Gem::Dependency
|
300
|
-
name: rubocop-
|
258
|
+
name: rubocop-rake
|
301
259
|
requirement: !ruby/object:Gem::Requirement
|
302
260
|
requirements:
|
303
261
|
- - "~>"
|
304
262
|
- !ruby/object:Gem::Version
|
305
|
-
version: '
|
306
|
-
type: :development
|
307
|
-
prerelease: false
|
308
|
-
version_requirements: !ruby/object:Gem::Requirement
|
309
|
-
requirements:
|
310
|
-
- - "~>"
|
311
|
-
- !ruby/object:Gem::Version
|
312
|
-
version: '1.33'
|
313
|
-
- !ruby/object:Gem::Dependency
|
314
|
-
name: simplecov
|
315
|
-
requirement: !ruby/object:Gem::Requirement
|
316
|
-
requirements:
|
317
|
-
- - "~>"
|
318
|
-
- !ruby/object:Gem::Version
|
319
|
-
version: '0.13'
|
263
|
+
version: '0.5'
|
320
264
|
type: :development
|
321
265
|
prerelease: false
|
322
266
|
version_requirements: !ruby/object:Gem::Requirement
|
323
267
|
requirements:
|
324
268
|
- - "~>"
|
325
269
|
- !ruby/object:Gem::Version
|
326
|
-
version: '0.
|
270
|
+
version: '0.5'
|
327
271
|
- !ruby/object:Gem::Dependency
|
328
|
-
name:
|
272
|
+
name: rubocop-rspec
|
329
273
|
requirement: !ruby/object:Gem::Requirement
|
330
274
|
requirements:
|
331
275
|
- - "~>"
|
332
276
|
- !ruby/object:Gem::Version
|
333
|
-
version: '1.
|
277
|
+
version: '1.39'
|
334
278
|
type: :development
|
335
279
|
prerelease: false
|
336
280
|
version_requirements: !ruby/object:Gem::Requirement
|
337
281
|
requirements:
|
338
282
|
- - "~>"
|
339
283
|
- !ruby/object:Gem::Version
|
340
|
-
version: '1.
|
284
|
+
version: '1.39'
|
341
285
|
- !ruby/object:Gem::Dependency
|
342
|
-
name:
|
286
|
+
name: simplecov
|
343
287
|
requirement: !ruby/object:Gem::Requirement
|
344
288
|
requirements:
|
345
289
|
- - "~>"
|
346
290
|
- !ruby/object:Gem::Version
|
347
|
-
version: '
|
291
|
+
version: '0.18'
|
348
292
|
type: :development
|
349
293
|
prerelease: false
|
350
294
|
version_requirements: !ruby/object:Gem::Requirement
|
351
295
|
requirements:
|
352
296
|
- - "~>"
|
353
297
|
- !ruby/object:Gem::Version
|
354
|
-
version: '
|
355
|
-
description:
|
298
|
+
version: '0.18'
|
299
|
+
description:
|
356
300
|
email:
|
357
301
|
- brooke@alchemists.io
|
358
302
|
executables: []
|
359
303
|
extensions: []
|
360
304
|
extra_rdoc_files:
|
361
|
-
- README.
|
362
|
-
- LICENSE.
|
305
|
+
- README.adoc
|
306
|
+
- LICENSE.adoc
|
363
307
|
files:
|
364
|
-
- LICENSE.
|
365
|
-
- README.
|
308
|
+
- LICENSE.adoc
|
309
|
+
- README.adoc
|
366
310
|
- lib/prawn_plus.rb
|
367
311
|
- lib/prawn_plus/identity.rb
|
368
312
|
- lib/prawn_plus/railtie.rb
|
369
313
|
- lib/prawn_plus/template_handlers/prawn.rb
|
370
|
-
homepage: https://
|
314
|
+
homepage: https://www.alchemists.io/projects/prawn_plus
|
371
315
|
licenses:
|
372
316
|
- Apache-2.0
|
373
317
|
metadata:
|
374
|
-
source_code_uri: https://github.com/bkuhlmann/prawn_plus
|
375
|
-
changelog_uri: https://github.com/bkuhlmann/prawn_plus/blob/master/CHANGES.md
|
376
318
|
bug_tracker_uri: https://github.com/bkuhlmann/prawn_plus/issues
|
377
|
-
|
319
|
+
changelog_uri: https://www.alchemists.io/projects/prawn_plus/changes.html
|
320
|
+
documentation_uri: https://www.alchemists.io/projects/prawn_plus
|
321
|
+
source_code_uri: https://github.com/bkuhlmann/prawn_plus
|
322
|
+
post_install_message:
|
378
323
|
rdoc_options: []
|
379
324
|
require_paths:
|
380
325
|
- lib
|
@@ -382,15 +327,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
382
327
|
requirements:
|
383
328
|
- - "~>"
|
384
329
|
- !ruby/object:Gem::Version
|
385
|
-
version: '2.
|
330
|
+
version: '2.7'
|
386
331
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
387
332
|
requirements:
|
388
333
|
- - ">="
|
389
334
|
- !ruby/object:Gem::Version
|
390
335
|
version: '0'
|
391
336
|
requirements: []
|
392
|
-
rubygems_version: 3.
|
393
|
-
signing_key:
|
337
|
+
rubygems_version: 3.1.4
|
338
|
+
signing_key:
|
394
339
|
specification_version: 4
|
395
|
-
summary:
|
340
|
+
summary: A Rails renderer for Prawn PDFs.
|
396
341
|
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).
|