wicked_pdf 1.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/.rubocop_todo.yml +158 -28
- data/.travis.yml +15 -16
- data/CHANGELOG.md +20 -19
- data/README.md +1 -1
- data/Rakefile +7 -1
- data/gemfiles/4.0.gemfile +1 -0
- data/gemfiles/4.1.gemfile +1 -0
- data/gemfiles/4.2.gemfile +3 -0
- data/gemfiles/5.0.gemfile +2 -0
- data/gemfiles/5.1.gemfile +2 -0
- data/gemfiles/5.2.gemfile +1 -0
- data/gemfiles/6.0.gemfile +11 -0
- data/gemfiles/rails_edge.gemfile +1 -1
- data/lib/generators/wicked_pdf_generator.rb +5 -9
- data/lib/wicked_pdf.rb +3 -17
- data/lib/wicked_pdf/railtie.rb +3 -28
- data/lib/wicked_pdf/version.rb +1 -1
- data/lib/wicked_pdf/wicked_pdf_helper/assets.rb +2 -1
- data/test/fixtures/manifest.js +3 -0
- data/test/test_helper.rb +11 -8
- data/wicked_pdf.gemspec +7 -3
- metadata +17 -17
- data/gemfiles/2.3.gemfile +0 -10
- data/gemfiles/3.0.gemfile +0 -12
- data/gemfiles/3.1.gemfile +0 -12
- data/gemfiles/3.2.gemfile +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 004c0d2f24e32de9bb05f1051cd558cbaa21862fe683f684cfd2a628c2ffa14b
|
4
|
+
data.tar.gz: '08b6f7e975378e81178b0a113dfa6355c2f8beceaa143b28d662245abf4afd90'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a94bb4dadf206925dee886de69063d0712cf7cbb85270c0564f0cbe744442c4f654b6b47fb2e26b21bc26e885a04f74be4e674b9b0b0b763a2192ba394fa97c
|
7
|
+
data.tar.gz: 16637963dc81ac3b1bd5a661fbcb8d69f134a97bf0cf891b7060fb64df302d76610ed82ee066298ce7a22c76a562c932258b3a436dcb6bb4ad203b99c3c0feee
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,63 +1,193 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
#
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2019-10-02 17:54:14 +0200 using RuboCop version 0.68.1.
|
3
4
|
# The point is for the user to remove these configuration records
|
4
5
|
# one by one as the offenses are removed from the code base.
|
5
6
|
# Note that changes in the inspected code, or installation of new
|
6
7
|
# versions of RuboCop, may require this file to be generated again.
|
7
8
|
|
8
|
-
|
9
9
|
# Offense count: 9
|
10
|
-
|
11
|
-
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, Include.
|
12
|
+
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
13
|
+
Bundler/OrderedGems:
|
14
|
+
Exclude:
|
15
|
+
- 'gemfiles/4.0.gemfile'
|
16
|
+
- 'gemfiles/4.1.gemfile'
|
17
|
+
- 'gemfiles/4.2.gemfile'
|
18
|
+
- 'gemfiles/5.0.gemfile'
|
19
|
+
- 'gemfiles/5.1.gemfile'
|
20
|
+
- 'gemfiles/5.2.gemfile'
|
21
|
+
- 'gemfiles/6.0.gemfile'
|
22
|
+
- 'gemfiles/rails_edge.gemfile'
|
12
23
|
|
13
24
|
# Offense count: 2
|
14
|
-
|
15
|
-
|
25
|
+
# Cop supports --auto-correct.
|
26
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, Include.
|
27
|
+
# Include: **/*.gemspec
|
28
|
+
Gemspec/OrderedDependencies:
|
29
|
+
Exclude:
|
30
|
+
- 'wicked_pdf.gemspec'
|
31
|
+
|
32
|
+
# Offense count: 16
|
33
|
+
# Cop supports --auto-correct.
|
34
|
+
Layout/EmptyLineAfterGuardClause:
|
35
|
+
Exclude:
|
36
|
+
- 'Rakefile'
|
37
|
+
- 'lib/wicked_pdf.rb'
|
38
|
+
- 'lib/wicked_pdf/pdf_helper.rb'
|
39
|
+
- 'lib/wicked_pdf/wicked_pdf_helper/assets.rb'
|
40
|
+
|
41
|
+
# Offense count: 2
|
42
|
+
# Cop supports --auto-correct.
|
43
|
+
Layout/LeadingBlankLines:
|
44
|
+
Exclude:
|
45
|
+
- 'test/unit/wkhtmltopdf_location_test.rb'
|
46
|
+
- 'wicked_pdf.gemspec'
|
47
|
+
|
48
|
+
# Offense count: 1
|
49
|
+
# Cop supports --auto-correct.
|
50
|
+
Layout/RescueEnsureAlignment:
|
51
|
+
Exclude:
|
52
|
+
- 'lib/wicked_pdf.rb'
|
53
|
+
|
54
|
+
# Offense count: 1
|
55
|
+
# Cop supports --auto-correct.
|
56
|
+
# Configuration parameters: EnforcedStyle.
|
57
|
+
# SupportedStyles: final_newline, final_blank_line
|
58
|
+
Layout/TrailingBlankLines:
|
59
|
+
Exclude:
|
60
|
+
- 'gemfiles/4.0.gemfile'
|
61
|
+
|
62
|
+
# Offense count: 11
|
63
|
+
Metrics/AbcSize:
|
64
|
+
Max: 45
|
16
65
|
|
17
66
|
# Offense count: 2
|
18
67
|
# Configuration parameters: CountComments.
|
19
68
|
Metrics/ClassLength:
|
20
|
-
Max:
|
69
|
+
Max: 292
|
21
70
|
|
22
|
-
|
23
|
-
Max: 160
|
24
|
-
|
25
|
-
# Offense count: 5
|
71
|
+
# Offense count: 7
|
26
72
|
Metrics/CyclomaticComplexity:
|
27
73
|
Max: 11
|
28
74
|
|
29
|
-
# Offense count:
|
30
|
-
# Configuration parameters:
|
31
|
-
Metrics/LineLength:
|
32
|
-
Max: 563
|
33
|
-
|
34
|
-
# Offense count: 14
|
35
|
-
# Configuration parameters: CountComments.
|
75
|
+
# Offense count: 17
|
76
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
36
77
|
Metrics/MethodLength:
|
37
78
|
Max: 30
|
38
79
|
|
39
|
-
# Offense count:
|
80
|
+
# Offense count: 2
|
81
|
+
# Configuration parameters: CountComments.
|
82
|
+
Metrics/ModuleLength:
|
83
|
+
Max: 147
|
84
|
+
|
85
|
+
# Offense count: 6
|
40
86
|
Metrics/PerceivedComplexity:
|
41
87
|
Max: 12
|
42
88
|
|
43
89
|
# Offense count: 2
|
44
90
|
Naming/AccessorMethodName:
|
45
|
-
|
91
|
+
Exclude:
|
92
|
+
- 'lib/wicked_pdf/middleware.rb'
|
93
|
+
- 'lib/wicked_pdf/pdf_helper.rb'
|
94
|
+
|
95
|
+
# Offense count: 1
|
96
|
+
Security/Open:
|
97
|
+
Exclude:
|
98
|
+
- 'lib/wicked_pdf/wicked_pdf_helper/assets.rb'
|
46
99
|
|
47
100
|
# Offense count: 1
|
48
101
|
Style/CaseEquality:
|
49
|
-
|
102
|
+
Exclude:
|
103
|
+
- 'lib/wicked_pdf/wicked_pdf_helper.rb'
|
50
104
|
|
51
105
|
# Offense count: 1
|
52
106
|
Style/ClassVars:
|
53
|
-
|
107
|
+
Exclude:
|
108
|
+
- 'lib/wicked_pdf.rb'
|
54
109
|
|
55
|
-
# Offense count:
|
110
|
+
# Offense count: 10
|
56
111
|
Style/Documentation:
|
57
|
-
|
112
|
+
Exclude:
|
113
|
+
- 'spec/**/*'
|
114
|
+
- 'test/**/*'
|
115
|
+
- 'generators/wicked_pdf/wicked_pdf_generator.rb'
|
116
|
+
- 'lib/wicked_pdf.rb'
|
117
|
+
- 'lib/wicked_pdf/middleware.rb'
|
118
|
+
- 'lib/wicked_pdf/pdf_helper.rb'
|
119
|
+
- 'lib/wicked_pdf/progress.rb'
|
120
|
+
- 'lib/wicked_pdf/railtie.rb'
|
121
|
+
- 'lib/wicked_pdf/tempfile.rb'
|
122
|
+
- 'lib/wicked_pdf/wicked_pdf_helper.rb'
|
123
|
+
- 'lib/wicked_pdf/wicked_pdf_helper/assets.rb'
|
58
124
|
|
59
|
-
# Offense count:
|
125
|
+
# Offense count: 2
|
60
126
|
# Cop supports --auto-correct.
|
61
|
-
|
127
|
+
Style/ExpandPathArguments:
|
128
|
+
Exclude:
|
129
|
+
- 'test/test_helper.rb'
|
130
|
+
- 'wicked_pdf.gemspec'
|
131
|
+
|
132
|
+
# Offense count: 8
|
133
|
+
# Cop supports --auto-correct.
|
134
|
+
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
135
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
136
|
+
Style/HashSyntax:
|
137
|
+
Exclude:
|
138
|
+
- 'gemfiles/4.0.gemfile'
|
139
|
+
- 'gemfiles/4.1.gemfile'
|
140
|
+
- 'gemfiles/4.2.gemfile'
|
141
|
+
- 'gemfiles/5.0.gemfile'
|
142
|
+
- 'gemfiles/5.1.gemfile'
|
143
|
+
- 'gemfiles/5.2.gemfile'
|
144
|
+
- 'gemfiles/6.0.gemfile'
|
145
|
+
- 'gemfiles/rails_edge.gemfile'
|
146
|
+
|
147
|
+
# Offense count: 3
|
148
|
+
# Cop supports --auto-correct.
|
149
|
+
Style/IfUnlessModifier:
|
150
|
+
Exclude:
|
151
|
+
- 'Rakefile'
|
152
|
+
- 'lib/wicked_pdf.rb'
|
153
|
+
- 'lib/wicked_pdf/railtie.rb'
|
154
|
+
|
155
|
+
# Offense count: 2
|
156
|
+
# Cop supports --auto-correct.
|
157
|
+
# Configuration parameters: EnforcedStyle.
|
158
|
+
# SupportedStyles: literals, strict
|
159
|
+
Style/MutableConstant:
|
160
|
+
Exclude:
|
161
|
+
- 'lib/wicked_pdf/wicked_pdf_helper/assets.rb'
|
162
|
+
|
163
|
+
# Offense count: 6
|
164
|
+
# Cop supports --auto-correct.
|
165
|
+
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
|
166
|
+
# SupportedStyles: slashes, percent_r, mixed
|
62
167
|
Style/RegexpLiteral:
|
63
|
-
|
168
|
+
Exclude:
|
169
|
+
- 'lib/wicked_pdf/middleware.rb'
|
170
|
+
- 'lib/wicked_pdf/wicked_pdf_helper/assets.rb'
|
171
|
+
- 'test/unit/wicked_pdf_test.rb'
|
172
|
+
|
173
|
+
# Offense count: 1
|
174
|
+
# Cop supports --auto-correct.
|
175
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
176
|
+
# SupportedStyles: single_quotes, double_quotes
|
177
|
+
Style/StringLiterals:
|
178
|
+
Exclude:
|
179
|
+
- 'gemfiles/4.0.gemfile'
|
180
|
+
|
181
|
+
# Offense count: 29
|
182
|
+
# Cop supports --auto-correct.
|
183
|
+
# Configuration parameters: MinSize.
|
184
|
+
# SupportedStyles: percent, brackets
|
185
|
+
Style/SymbolArray:
|
186
|
+
EnforcedStyle: brackets
|
187
|
+
|
188
|
+
# Offense count: 111
|
189
|
+
# Cop supports --auto-correct.
|
190
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
191
|
+
# URISchemes: http, https
|
192
|
+
Metrics/LineLength:
|
193
|
+
Max: 563
|
data/.travis.yml
CHANGED
@@ -7,31 +7,19 @@ before_install:
|
|
7
7
|
- sudo apt-get update -qq
|
8
8
|
bundler_args: --verbose
|
9
9
|
sudo: required
|
10
|
+
services:
|
11
|
+
- xvfb
|
10
12
|
before_script:
|
11
13
|
- bundle list
|
12
14
|
- sudo apt-get install -y wkhtmltopdf
|
13
|
-
- "export DISPLAY=:99.0"
|
14
|
-
- "sh -e /etc/init.d/xvfb start"
|
15
15
|
env: WKHTMLTOPDF_BIN=/usr/bin/wkhtmltopdf
|
16
16
|
script:
|
17
17
|
- bundle exec rake
|
18
18
|
matrix:
|
19
19
|
include:
|
20
|
-
- rvm:
|
21
|
-
before_install:
|
22
|
-
- sudo apt-get update -qq
|
23
|
-
- gem update --system 1.8.25
|
24
|
-
- gem --version
|
25
|
-
gemfile: gemfiles/2.3.gemfile
|
26
|
-
- rvm: 1.9.2
|
27
|
-
gemfile: gemfiles/3.0.gemfile
|
28
|
-
- rvm: 1.9.3
|
29
|
-
gemfile: gemfiles/3.1.gemfile
|
30
|
-
- rvm: 2.0
|
31
|
-
gemfile: gemfiles/3.2.gemfile
|
32
|
-
- rvm: 2.0
|
20
|
+
- rvm: 2.2
|
33
21
|
gemfile: gemfiles/4.0.gemfile
|
34
|
-
- rvm: 2.
|
22
|
+
- rvm: 2.2
|
35
23
|
gemfile: gemfiles/4.1.gemfile
|
36
24
|
- rvm: 2.2
|
37
25
|
gemfile: gemfiles/4.2.gemfile
|
@@ -50,13 +38,24 @@ matrix:
|
|
50
38
|
- gem install bundler -v '< 2'
|
51
39
|
- rvm: 2.5
|
52
40
|
gemfile: gemfiles/5.2.gemfile
|
41
|
+
before_install:
|
42
|
+
- gem update --system
|
43
|
+
- gem install bundler
|
53
44
|
- rvm: 2.5
|
54
45
|
gemfile: gemfiles/rails_edge.gemfile
|
46
|
+
before_install:
|
47
|
+
- gem update --system
|
48
|
+
- gem install bundler
|
55
49
|
- rvm: 2.6
|
56
50
|
gemfile: gemfiles/5.2.gemfile
|
57
51
|
before_install:
|
58
52
|
- gem update --system
|
59
53
|
- gem install bundler
|
54
|
+
- rvm: 2.6
|
55
|
+
gemfile: gemfiles/6.0.gemfile
|
56
|
+
before_install:
|
57
|
+
- gem update --system
|
58
|
+
- gem install bundler
|
60
59
|
- rvm: 2.6
|
61
60
|
gemfile: gemfiles/rails_edge.gemfile
|
62
61
|
before_install:
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
10
10
|
### Fixes
|
11
11
|
- None
|
12
12
|
|
13
|
+
## [2.0.0] - 2020-02-22
|
14
|
+
### Breaking changes
|
15
|
+
- [Remove support for older Ruby and Rails versions](https://github.com/mileszs/wicked_pdf/pull/854) - This project no longer supports Ruby < 2.2 and Rails < 4. It may work for you, but we are no longer worrying about breaking backwards compatibility for versions older than these. If you are on an affected version, you can continue to use the 1.x releases. Patches to fix broken behavior on old versions may not be accepted unless they are highly decoupled from the rest of the code base.
|
16
|
+
|
17
|
+
### New Features
|
18
|
+
- [Add Rubygems metadata hash to gemspec](https://github.com/mileszs/wicked_pdf/pull/856)
|
19
|
+
- [Add support for Rails 6](https://github.com/mileszs/wicked_pdf/pull/869)
|
20
|
+
|
21
|
+
### Fixes
|
22
|
+
- [Fix Webpacker helpers in production environment](https://github.com/mileszs/wicked_pdf/pull/837)
|
23
|
+
- [Fix unit tests](https://github.com/mileszs/wicked_pdf/pull/852)
|
24
|
+
|
13
25
|
## [1.4.0] - 2019-05-23
|
14
26
|
### New Features
|
15
27
|
- [Add support for `log_level` and `quiet` options](https://github.com/mileszs/wicked_pdf/pull/834)
|
@@ -74,7 +86,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
74
86
|
|
75
87
|
## [1.0.6] - 2016-04-04
|
76
88
|
### Fixes
|
77
|
-
- Revert
|
89
|
+
- Revert shell escaping of options. The fix was causing more issues than it solved (like "[page] of [topage]" being escaped, and thus not parsed by `wkhtmltopdf`). See #514 for details.
|
78
90
|
|
79
91
|
## [1.0.5] - 2016-03-28
|
80
92
|
### Fixes
|
@@ -110,13 +122,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
110
122
|
|
111
123
|
### New Features
|
112
124
|
- Check version of `wkhtmltopdf` before deciding to pass arguments with or without dashes
|
113
|
-
- New arguments and options for the table of contents supported in newer versions of
|
125
|
+
- New arguments and options for the table of contents supported in newer versions of wkhtmltopdf: `text_size_shrink`, `level_indentation`, `disable_dotted_lines`, `disable_toc_links`, `xsl_style_sheet`
|
114
126
|
- Merge in global options to `pdf_from_html_file` and `pdf_from_string`
|
115
127
|
- Add ability to generate pdf from a web resource: `pdf_from_url(url)`
|
116
128
|
- Removed explicit dependency on [Rails](https://github.com/rails/rails), since parts of this library may be used without it.
|
117
129
|
|
118
130
|
### Fixes
|
119
|
-
- Comment out the `:exe_path` option in the generated
|
131
|
+
- Comment out the `:exe_path` option in the generated initializer by default (since many systems won't have `wkthmltopdf` installed in that specific location)
|
120
132
|
- Issues with `file://` paths on Windows-based systems
|
121
133
|
- Issues with parsed options/argument ordering on versions of `wkthmltopdf` > 0.9
|
122
134
|
- Issues with middleware headers when running Rails app mounted in a subdirectory
|
@@ -125,24 +137,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
125
137
|
- Issue with header/footer `:content` being deleted after the first page
|
126
138
|
- Issues with options being modified during processing (including global config options)
|
127
139
|
- Issues with asset helpers recognizing assets specified without a protocol
|
128
|
-
- Issues with `url()` references and embedded `data:base64`
|
140
|
+
- Issues with `url()` references and embedded `data:base64` assets in stylesheets rendered with `wicked_pdf_stylesheet_link_tag`
|
129
141
|
- Asset helpers no longer add a file extension if it already is specified with one
|
130
142
|
|
131
143
|
# Compare Releases
|
132
|
-
- [1.
|
133
|
-
- [1.
|
134
|
-
- [1.2.
|
135
|
-
- [1.2.0...1.2.1](https://github.com/mileszs/wicked_pdf/compare/1.1.0...1.2.0)
|
144
|
+
- [1.4.0...HEAD](https://github.com/mileszs/wicked_pdf/compare/1.2.2...HEAD)
|
145
|
+
- [1.3.0...1.4.0](https://github.com/mileszs/wicked_pdf/compare/1.3.0...1.4.0)
|
146
|
+
- [1.2.0...1.3.0](https://github.com/mileszs/wicked_pdf/compare/1.2.0...1.3.0)
|
136
147
|
- [1.1.0...1.2.0](https://github.com/mileszs/wicked_pdf/compare/1.1.0...1.2.0)
|
137
|
-
- [1.0.
|
138
|
-
- [1.0.5...1.0.6](https://github.com/mileszs/wicked_pdf/compare/1.0.5...1.0.6)
|
139
|
-
- [1.0.4...1.0.5](https://github.com/mileszs/wicked_pdf/compare/1.0.4...1.0.5)
|
140
|
-
- [1.0.3...1.0.4](https://github.com/mileszs/wicked_pdf/compare/1.0.3...1.0.4)
|
141
|
-
- [1.0.2...1.0.3](https://github.com/mileszs/wicked_pdf/compare/1.0.2...1.0.3)
|
142
|
-
- [1.0.1...1.0.2](https://github.com/mileszs/wicked_pdf/compare/1.0.1...1.0.2)
|
143
|
-
- [1.0.0...1.0.1](https://github.com/mileszs/wicked_pdf/compare/1.0.0...1.0.1)
|
148
|
+
- [1.0.0...1.1.0](https://github.com/mileszs/wicked_pdf/compare/1.0.0...1.0.0)
|
144
149
|
- [0.11.0...1.0.0](https://github.com/mileszs/wicked_pdf/compare/0.11.0...1.0.0)
|
145
|
-
- [0.10.2...0.11.0](https://github.com/mileszs/wicked_pdf/compare/0.10.2...0.11.0)
|
146
|
-
- [0.10.1...0.10.2](https://github.com/mileszs/wicked_pdf/compare/0.10.1...0.10.2)
|
147
|
-
- [0.10.0...0.10.1](https://github.com/mileszs/wicked_pdf/compare/0.10.0...0.10.1)
|
148
|
-
- [0.9.10...0.10.0](https://github.com/mileszs/wicked_pdf/compare/0.9.10...0.10.0)
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Wicked PDF uses the shell utility [wkhtmltopdf](http://wkhtmltopdf.org) to serve a PDF file to a user from HTML. In other words, rather than dealing with a PDF generation DSL of some sort, you simply write an HTML view as you would normally, then let Wicked PDF take care of the hard stuff.
|
6
6
|
|
7
|
-
_Wicked PDF has been verified to work on Ruby versions
|
7
|
+
_Wicked PDF has been verified to work on Ruby versions 2.2 through 2.6; Rails 4 through 6.1_
|
8
8
|
|
9
9
|
### Installation
|
10
10
|
|
data/Rakefile
CHANGED
@@ -42,11 +42,17 @@ task :dummy_generate do
|
|
42
42
|
system('touch test/dummy/db/schema.rb')
|
43
43
|
FileUtils.cp 'test/fixtures/database.yml', 'test/dummy/config/'
|
44
44
|
FileUtils.rm_r Dir.glob('test/dummy/test/*')
|
45
|
+
|
46
|
+
# rails 6 needs this to be present before start:
|
47
|
+
FileUtils.mkdir_p('test/dummy/app/assets/config')
|
48
|
+
FileUtils.mkdir_p('test/dummy/app/assets/javascripts')
|
49
|
+
FileUtils.cp 'test/fixtures/manifest.js', 'test/dummy/app/assets/config/'
|
50
|
+
FileUtils.cp 'test/fixtures/wicked.js', 'test/dummy/app/assets/javascripts/'
|
45
51
|
end
|
46
52
|
|
47
53
|
desc 'Remove dummy application'
|
48
54
|
task :dummy_remove do
|
49
|
-
FileUtils.rm_r Dir.glob('test/dummy
|
55
|
+
FileUtils.rm_r Dir.glob('test/dummy/')
|
50
56
|
end
|
51
57
|
|
52
58
|
desc 'Generate documentation for the wicked_pdf gem.'
|
data/gemfiles/4.0.gemfile
CHANGED
data/gemfiles/4.1.gemfile
CHANGED
data/gemfiles/4.2.gemfile
CHANGED
data/gemfiles/5.0.gemfile
CHANGED
data/gemfiles/5.1.gemfile
CHANGED
data/gemfiles/5.2.gemfile
CHANGED
@@ -3,6 +3,7 @@ source 'https://rubygems.org'
|
|
3
3
|
gem 'rdoc'
|
4
4
|
gem 'rails', '~> 5.2'
|
5
5
|
gem 'sqlite3', '~> 1.3.6'
|
6
|
+
gem 'sprockets', '~>3.0' # v4 strips newlines from assets causing tests to fail
|
6
7
|
gem 'bootsnap' # required to run `rake test` in Rails 5.2
|
7
8
|
gem 'mocha', '= 1.3' # newer versions blow up
|
8
9
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'bundler', '~>2'
|
4
|
+
gem 'rdoc'
|
5
|
+
gem 'rails', '~>6.0.1'
|
6
|
+
gem 'sqlite3', '~> 1.4'
|
7
|
+
gem 'sprockets', '~>3.0'
|
8
|
+
gem 'bootsnap' # required to run `rake test` in Rails 6.0
|
9
|
+
gem 'mocha', '= 1.3' # newer versions blow up
|
10
|
+
|
11
|
+
gemspec path: '../'
|
data/gemfiles/rails_edge.gemfile
CHANGED
@@ -1,11 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
def copy_initializer
|
7
|
-
copy_file 'wicked_pdf.rb', 'config/initializers/wicked_pdf.rb'
|
8
|
-
end
|
1
|
+
# Rails generator invoked with 'rails generate wicked_pdf'
|
2
|
+
class WickedPdfGenerator < Rails::Generators::Base
|
3
|
+
source_root(File.expand_path(File.dirname(__FILE__) + '/../../generators/wicked_pdf/templates'))
|
4
|
+
def copy_initializer
|
5
|
+
copy_file 'wicked_pdf.rb', 'config/initializers/wicked_pdf.rb'
|
9
6
|
end
|
10
|
-
|
11
7
|
end
|
data/lib/wicked_pdf.rb
CHANGED
@@ -4,24 +4,10 @@
|
|
4
4
|
require 'logger'
|
5
5
|
require 'digest/md5'
|
6
6
|
require 'rbconfig'
|
7
|
+
require 'open3'
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
else
|
11
|
-
require 'open3'
|
12
|
-
end
|
13
|
-
|
14
|
-
begin
|
15
|
-
require 'active_support/core_ext/module/attribute_accessors'
|
16
|
-
rescue LoadError
|
17
|
-
require 'active_support/core_ext/class/attribute_accessors'
|
18
|
-
end
|
19
|
-
|
20
|
-
begin
|
21
|
-
require 'active_support/core_ext/object/blank'
|
22
|
-
rescue LoadError
|
23
|
-
require 'active_support/core_ext/blank'
|
24
|
-
end
|
9
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
10
|
+
require 'active_support/core_ext/object/blank'
|
25
11
|
|
26
12
|
require 'wicked_pdf/version'
|
27
13
|
require 'wicked_pdf/railtie'
|
data/lib/wicked_pdf/railtie.rb
CHANGED
@@ -4,11 +4,9 @@ require 'wicked_pdf/wicked_pdf_helper/assets'
|
|
4
4
|
|
5
5
|
class WickedPdf
|
6
6
|
if defined?(Rails.env)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
class WickedRailtie < Rails::Railtie
|
11
|
-
initializer 'wicked_pdf.register', :after => 'remotipart.controller_helper' do |_app|
|
7
|
+
class WickedRailtie < Rails::Railtie
|
8
|
+
initializer 'wicked_pdf.register', :after => 'remotipart.controller_helper' do |_app|
|
9
|
+
ActiveSupport.on_load(:action_controller) do
|
12
10
|
if ActionController::Base.respond_to?(:prepend) &&
|
13
11
|
Object.method(:new).respond_to?(:super_method)
|
14
12
|
ActionController::Base.send :prepend, PdfHelper
|
@@ -18,29 +16,6 @@ class WickedPdf
|
|
18
16
|
ActionView::Base.send :include, WickedPdfHelper::Assets
|
19
17
|
end
|
20
18
|
end
|
21
|
-
|
22
|
-
elsif Rails::VERSION::MAJOR == 3
|
23
|
-
|
24
|
-
class WickedRailtie < Rails::Railtie
|
25
|
-
initializer 'wicked_pdf.register' do |_app|
|
26
|
-
ActionController::Base.send :include, PdfHelper
|
27
|
-
if Rails::VERSION::MINOR > 0 && Rails.configuration.assets.enabled
|
28
|
-
ActionView::Base.send :include, WickedPdfHelper::Assets
|
29
|
-
else
|
30
|
-
ActionView::Base.send :include, WickedPdfHelper
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
elsif Rails::VERSION::MAJOR == 2
|
36
|
-
|
37
|
-
unless ActionController::Base.instance_methods.include? 'render_with_wicked_pdf'
|
38
|
-
ActionController::Base.send :include, PdfHelper
|
39
|
-
end
|
40
|
-
unless ActionView::Base.instance_methods.include? 'wicked_pdf_stylesheet_link_tag'
|
41
|
-
ActionView::Base.send :include, WickedPdfHelper
|
42
|
-
end
|
43
|
-
|
44
19
|
end
|
45
20
|
|
46
21
|
if Mime::Type.lookup_by_extension(:pdf).nil?
|
data/lib/wicked_pdf/version.rb
CHANGED
@@ -126,7 +126,8 @@ class WickedPdf
|
|
126
126
|
end
|
127
127
|
|
128
128
|
def precompiled_or_absolute_asset?(source)
|
129
|
-
Rails.configuration.assets
|
129
|
+
!Rails.configuration.respond_to?(:assets) ||
|
130
|
+
Rails.configuration.assets.compile == false ||
|
130
131
|
source.to_s[0] == '/' ||
|
131
132
|
source.to_s.match(/\Ahttps?\:\/\//)
|
132
133
|
end
|
data/test/test_helper.rb
CHANGED
@@ -5,13 +5,8 @@ require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
|
5
5
|
|
6
6
|
require 'test/unit'
|
7
7
|
require 'mocha'
|
8
|
-
|
9
|
-
|
10
|
-
require 'test_help'
|
11
|
-
else
|
12
|
-
require 'rails/test_help'
|
13
|
-
require 'mocha/test_unit'
|
14
|
-
end
|
8
|
+
require 'rails/test_help'
|
9
|
+
require 'mocha/test_unit'
|
15
10
|
|
16
11
|
require 'wicked_pdf'
|
17
12
|
|
@@ -24,7 +19,15 @@ if (assets_dir = Rails.root.join('app/assets')) && File.directory?(assets_dir)
|
|
24
19
|
File.open(destination, 'w') { |f| f.write(source) }
|
25
20
|
|
26
21
|
# Copy JS file
|
27
|
-
|
22
|
+
js_dir = assets_dir.join('javascripts')
|
23
|
+
Dir.mkdir(js_dir) unless File.directory?(js_dir)
|
24
|
+
destination = js_dir.join('wicked.js')
|
28
25
|
source = File.read('test/fixtures/wicked.js')
|
29
26
|
File.open(destination, 'w') { |f| f.write(source) }
|
27
|
+
|
28
|
+
config_dir = assets_dir.join('config')
|
29
|
+
Dir.mkdir(config_dir) unless File.directory?(config_dir)
|
30
|
+
source = File.read('test/fixtures/manifest.js')
|
31
|
+
destination = config_dir.join('manifest.js')
|
32
|
+
File.open(destination, 'w') { |f| f.write(source) }
|
30
33
|
end
|
data/wicked_pdf.gemspec
CHANGED
@@ -18,7 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
In other words, rather than dealing with a PDF generation DSL of some sort,
|
19
19
|
you simply write an HTML view as you would normally, and let Wicked take care of the hard stuff.
|
20
20
|
DESC
|
21
|
+
spec.metadata = {
|
22
|
+
'changelog_uri' => 'https://github.com/mileszs/wicked_pdf/blob/master/CHANGELOG.md'
|
23
|
+
}
|
21
24
|
|
25
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.2')
|
22
26
|
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
23
27
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
28
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
@@ -29,10 +33,10 @@ DESC
|
|
29
33
|
spec.add_dependency 'activesupport'
|
30
34
|
|
31
35
|
spec.add_development_dependency 'rails'
|
32
|
-
spec.add_development_dependency 'bundler'
|
36
|
+
spec.add_development_dependency 'bundler'
|
33
37
|
spec.add_development_dependency 'rake'
|
34
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
35
|
-
spec.add_development_dependency 'sqlite3', '~> 1.3
|
38
|
+
spec.add_development_dependency 'rubocop', '~> 0.68.0'
|
39
|
+
spec.add_development_dependency 'sqlite3', '~> 1.3'
|
36
40
|
spec.add_development_dependency 'mocha', '= 1.3'
|
37
41
|
spec.add_development_dependency 'test-unit'
|
38
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wicked_pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Z. Sterrett
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-02-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -43,16 +43,16 @@ dependencies:
|
|
43
43
|
name: bundler
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
48
|
+
version: '0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,28 +73,28 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.
|
76
|
+
version: 0.68.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.
|
83
|
+
version: 0.68.0
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: sqlite3
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 1.3
|
90
|
+
version: '1.3'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 1.3
|
97
|
+
version: '1.3'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: mocha
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,16 +144,13 @@ files:
|
|
144
144
|
- LICENSE.txt
|
145
145
|
- README.md
|
146
146
|
- Rakefile
|
147
|
-
- gemfiles/2.3.gemfile
|
148
|
-
- gemfiles/3.0.gemfile
|
149
|
-
- gemfiles/3.1.gemfile
|
150
|
-
- gemfiles/3.2.gemfile
|
151
147
|
- gemfiles/4.0.gemfile
|
152
148
|
- gemfiles/4.1.gemfile
|
153
149
|
- gemfiles/4.2.gemfile
|
154
150
|
- gemfiles/5.0.gemfile
|
155
151
|
- gemfiles/5.1.gemfile
|
156
152
|
- gemfiles/5.2.gemfile
|
153
|
+
- gemfiles/6.0.gemfile
|
157
154
|
- gemfiles/rails_edge.gemfile
|
158
155
|
- generators/wicked_pdf/templates/wicked_pdf.rb
|
159
156
|
- generators/wicked_pdf/wicked_pdf_generator.rb
|
@@ -170,6 +167,7 @@ files:
|
|
170
167
|
- lib/wicked_pdf/wicked_pdf_helper/assets.rb
|
171
168
|
- test/fixtures/database.yml
|
172
169
|
- test/fixtures/document_with_long_line.html
|
170
|
+
- test/fixtures/manifest.js
|
173
171
|
- test/fixtures/wicked.css
|
174
172
|
- test/fixtures/wicked.js
|
175
173
|
- test/functional/pdf_helper_test.rb
|
@@ -182,7 +180,8 @@ files:
|
|
182
180
|
homepage: https://github.com/mileszs/wicked_pdf
|
183
181
|
licenses:
|
184
182
|
- MIT
|
185
|
-
metadata:
|
183
|
+
metadata:
|
184
|
+
changelog_uri: https://github.com/mileszs/wicked_pdf/blob/master/CHANGELOG.md
|
186
185
|
post_install_message:
|
187
186
|
rdoc_options: []
|
188
187
|
require_paths:
|
@@ -191,7 +190,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
191
190
|
requirements:
|
192
191
|
- - ">="
|
193
192
|
- !ruby/object:Gem::Version
|
194
|
-
version: '
|
193
|
+
version: '2.2'
|
195
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
195
|
requirements:
|
197
196
|
- - ">="
|
@@ -199,13 +198,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
198
|
version: '0'
|
200
199
|
requirements:
|
201
200
|
- wkhtmltopdf
|
202
|
-
rubygems_version: 3.0.
|
201
|
+
rubygems_version: 3.0.6
|
203
202
|
signing_key:
|
204
203
|
specification_version: 4
|
205
204
|
summary: PDF generator (from HTML) gem for Ruby on Rails
|
206
205
|
test_files:
|
207
206
|
- test/fixtures/database.yml
|
208
207
|
- test/fixtures/document_with_long_line.html
|
208
|
+
- test/fixtures/manifest.js
|
209
209
|
- test/fixtures/wicked.css
|
210
210
|
- test/fixtures/wicked.js
|
211
211
|
- test/functional/pdf_helper_test.rb
|
data/gemfiles/2.3.gemfile
DELETED
data/gemfiles/3.0.gemfile
DELETED
data/gemfiles/3.1.gemfile
DELETED