wicked_pdf 1.0.6 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/issue_template.md +15 -0
- data/.github/workflows/ci.yml +56 -0
- data/.rubocop.yml +60 -0
- data/.rubocop_todo.yml +83 -29
- data/CHANGELOG.md +182 -35
- data/README.md +188 -30
- data/Rakefile +13 -10
- data/gemfiles/5.0.gemfile +8 -0
- data/gemfiles/5.1.gemfile +8 -0
- data/gemfiles/5.2.gemfile +9 -0
- data/gemfiles/6.0.gemfile +10 -0
- data/gemfiles/6.1.gemfile +12 -0
- data/gemfiles/7.0.gemfile +12 -0
- data/generators/wicked_pdf/templates/wicked_pdf.rb +9 -0
- data/lib/generators/wicked_pdf_generator.rb +5 -9
- data/lib/wicked_pdf/binary.rb +65 -0
- data/lib/wicked_pdf/middleware.rb +1 -1
- data/lib/wicked_pdf/option_parser.rb +229 -0
- data/lib/wicked_pdf/pdf_helper.rb +99 -85
- data/lib/wicked_pdf/progress.rb +33 -0
- data/lib/wicked_pdf/railtie.rb +6 -33
- data/lib/wicked_pdf/tempfile.rb +38 -7
- data/lib/wicked_pdf/version.rb +1 -1
- data/lib/wicked_pdf/wicked_pdf_helper/assets.rb +213 -91
- data/lib/wicked_pdf/wicked_pdf_helper.rb +29 -26
- data/lib/wicked_pdf.rb +37 -272
- data/test/fixtures/database.yml +4 -0
- data/test/fixtures/manifest.js +3 -0
- data/test/fixtures/wicked.js +1 -0
- data/test/functional/pdf_helper_test.rb +74 -5
- data/test/functional/wicked_pdf_helper_assets_test.rb +27 -9
- data/test/functional/wicked_pdf_helper_test.rb +15 -13
- data/test/test_helper.rb +16 -7
- data/test/unit/wicked_pdf_binary_test.rb +26 -0
- data/test/unit/wicked_pdf_option_parser_test.rb +128 -0
- data/test/unit/wicked_pdf_test.rb +11 -149
- data/test/unit/wkhtmltopdf_location_test.rb +48 -0
- data/wicked_pdf.gemspec +21 -14
- metadata +68 -37
- data/.travis.yml +0 -66
- data/gemfiles/2.3.gemfile +0 -10
- data/gemfiles/3.0.gemfile +0 -7
- data/gemfiles/3.1.gemfile +0 -8
- data/gemfiles/3.2.gemfile +0 -7
- data/gemfiles/4.0.gemfile +0 -6
- data/gemfiles/4.1.gemfile +0 -6
- data/gemfiles/4.2.gemfile +0 -6
- data/gemfiles/rails_edge.gemfile +0 -6
@@ -0,0 +1,128 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class WickedPdfOptionParserTest < ActiveSupport::TestCase
|
4
|
+
test 'should parse header and footer options' do
|
5
|
+
%i[header footer].each do |hf|
|
6
|
+
%i[center font_name left right].each do |o|
|
7
|
+
assert_equal "--#{hf}-#{o.to_s.tr('_', '-')} header_footer",
|
8
|
+
parse_options(hf => { o => 'header_footer' }).strip
|
9
|
+
end
|
10
|
+
|
11
|
+
%i[font_size spacing].each do |o|
|
12
|
+
assert_equal "--#{hf}-#{o.to_s.tr('_', '-')} 12",
|
13
|
+
parse_options(hf => { o => '12' }).strip
|
14
|
+
end
|
15
|
+
|
16
|
+
assert_equal "--#{hf}-line",
|
17
|
+
parse_options(hf => { :line => true }).strip
|
18
|
+
assert_equal "--#{hf}-html http://www.abc.com",
|
19
|
+
parse_options(hf => { :html => { :url => 'http://www.abc.com' } }).strip
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
test 'should parse toc options' do
|
24
|
+
toc_option = option_parser.valid_option('toc')
|
25
|
+
|
26
|
+
%i[font_name header_text].each do |o|
|
27
|
+
assert_equal "#{toc_option} --toc-#{o.to_s.tr('_', '-')} toc",
|
28
|
+
parse_options(:toc => { o => 'toc' }).strip
|
29
|
+
end
|
30
|
+
|
31
|
+
%i[
|
32
|
+
depth header_fs l1_font_size l2_font_size l3_font_size l4_font_size
|
33
|
+
l5_font_size l6_font_size l7_font_size l1_indentation l2_indentation
|
34
|
+
l3_indentation l4_indentation l5_indentation l6_indentation l7_indentation
|
35
|
+
].each do |o|
|
36
|
+
assert_equal "#{toc_option} --toc-#{o.to_s.tr('_', '-')} 5",
|
37
|
+
parse_options(:toc => { o => 5 }).strip
|
38
|
+
end
|
39
|
+
|
40
|
+
%i[no_dots disable_links disable_back_links].each do |o|
|
41
|
+
assert_equal "#{toc_option} --toc-#{o.to_s.tr('_', '-')}",
|
42
|
+
parse_options(:toc => { o => true }).strip
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
test 'should parse outline options' do
|
47
|
+
assert_equal '--outline', parse_options(:outline => { :outline => true }).strip
|
48
|
+
assert_equal '--outline-depth 5', parse_options(:outline => { :outline_depth => 5 }).strip
|
49
|
+
end
|
50
|
+
|
51
|
+
test 'should parse no_images option' do
|
52
|
+
assert_equal '--no-images', parse_options(:no_images => true).strip
|
53
|
+
assert_equal '--images', parse_options(:images => true).strip
|
54
|
+
end
|
55
|
+
|
56
|
+
test 'should parse margins options' do
|
57
|
+
%i[top bottom left right].each do |o|
|
58
|
+
assert_equal "--margin-#{o} 12", parse_options(:margin => { o => '12' }).strip
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
test 'should parse cover' do
|
63
|
+
cover_option = option_parser.valid_option('cover')
|
64
|
+
|
65
|
+
pathname = Rails.root.join('app', 'views', 'pdf', 'file.html')
|
66
|
+
assert_equal "#{cover_option} http://example.org", parse_options(:cover => 'http://example.org').strip, 'URL'
|
67
|
+
assert_equal "#{cover_option} #{pathname}", parse_options(:cover => pathname).strip, 'Pathname'
|
68
|
+
assert_match(/#{cover_option} .+wicked_cover_pdf.+\.html/, parse_options(:cover => '<html><body>HELLO</body></html>').strip, 'HTML')
|
69
|
+
end
|
70
|
+
|
71
|
+
test 'should parse other options' do
|
72
|
+
%i[
|
73
|
+
orientation page_size proxy username password dpi
|
74
|
+
encoding user_style_sheet
|
75
|
+
].each do |o|
|
76
|
+
assert_equal "--#{o.to_s.tr('_', '-')} opts", parse_options(o => 'opts').strip
|
77
|
+
end
|
78
|
+
|
79
|
+
%i[cookie post].each do |o|
|
80
|
+
assert_equal "--#{o.to_s.tr('_', '-')} name value", parse_options(o => 'name value').strip
|
81
|
+
|
82
|
+
nv_formatter = proc { |number| "--#{o.to_s.tr('_', '-')} par#{number} val#{number}" }
|
83
|
+
assert_equal "#{nv_formatter.call(1)} #{nv_formatter.call(2)}", parse_options(o => ['par1 val1', 'par2 val2']).strip
|
84
|
+
end
|
85
|
+
|
86
|
+
%i[redirect_delay zoom page_offset].each do |o|
|
87
|
+
assert_equal "--#{o.to_s.tr('_', '-')} 5", parse_options(o => 5).strip
|
88
|
+
end
|
89
|
+
|
90
|
+
%i[
|
91
|
+
book default_header disable_javascript grayscale lowquality
|
92
|
+
enable_plugins disable_internal_links disable_external_links
|
93
|
+
print_media_type disable_smart_shrinking use_xserver no_background
|
94
|
+
].each do |o|
|
95
|
+
assert_equal "--#{o.to_s.tr('_', '-')}", parse_options(o => true).strip
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
test 'should not use double dash options for version without dashes' do
|
100
|
+
op = option_parser(WickedPdf::OptionParser::BINARY_VERSION_WITHOUT_DASHES)
|
101
|
+
|
102
|
+
%w[toc cover].each do |name|
|
103
|
+
assert_equal op.valid_option(name), name
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
test 'should use double dash options for version with dashes' do
|
108
|
+
op = option_parser(Gem::Version.new('0.11.0'))
|
109
|
+
|
110
|
+
%w[toc cover].each do |name|
|
111
|
+
assert_equal op.valid_option(name), "--#{name}"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
test '-- options should not be given after object' do
|
116
|
+
options = { :header => { :center => 3 }, :cover => 'http://example.org', :disable_javascript => true }
|
117
|
+
cover_option = option_parser.valid_option('cover')
|
118
|
+
assert_equal parse_options(options), "--disable-javascript --header-center 3 #{cover_option} http://example.org"
|
119
|
+
end
|
120
|
+
|
121
|
+
def parse_options(options, version = WickedPdf::DEFAULT_BINARY_VERSION)
|
122
|
+
option_parser(version).parse(options).join(' ')
|
123
|
+
end
|
124
|
+
|
125
|
+
def option_parser(version = WickedPdf::DEFAULT_BINARY_VERSION)
|
126
|
+
WickedPdf::OptionParser.new(version)
|
127
|
+
end
|
128
|
+
end
|
@@ -1,22 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
|
3
2
|
WickedPdf.config = { :exe_path => ENV['WKHTMLTOPDF_BIN'] || '/usr/local/bin/wkhtmltopdf' }
|
4
3
|
HTML_DOCUMENT = '<html><body>Hello World</body></html>'.freeze
|
5
4
|
|
6
|
-
# Provide a public accessor to the normally-private parse_options function.
|
7
|
-
# Also, smash the returned array of options into a single string for
|
8
|
-
# convenience in testing below.
|
9
|
-
class WickedPdf
|
10
|
-
attr_accessor :binary_version
|
11
|
-
def get_parsed_options(opts)
|
12
|
-
parse_options(opts).join(' ')
|
13
|
-
end
|
14
|
-
|
15
|
-
def get_valid_option(name)
|
16
|
-
valid_option(name)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
5
|
class WickedPdfTest < ActiveSupport::TestCase
|
21
6
|
def setup
|
22
7
|
@wp = WickedPdf.new
|
@@ -61,7 +46,7 @@ class WickedPdfTest < ActiveSupport::TestCase
|
|
61
46
|
begin
|
62
47
|
tmp = Tempfile.new('wkhtmltopdf')
|
63
48
|
fp = tmp.path
|
64
|
-
File.chmod
|
49
|
+
File.chmod 0o000, fp
|
65
50
|
assert_raise RuntimeError do
|
66
51
|
WickedPdf.new fp
|
67
52
|
end
|
@@ -74,7 +59,7 @@ class WickedPdfTest < ActiveSupport::TestCase
|
|
74
59
|
begin
|
75
60
|
tmp = Tempfile.new('wkhtmltopdf')
|
76
61
|
fp = tmp.path
|
77
|
-
File.chmod
|
62
|
+
File.chmod 0o777, fp
|
78
63
|
wp = WickedPdf.new fp
|
79
64
|
assert_raise RuntimeError do
|
80
65
|
wp.pdf_from_string HTML_DOCUMENT
|
@@ -84,138 +69,15 @@ class WickedPdfTest < ActiveSupport::TestCase
|
|
84
69
|
end
|
85
70
|
end
|
86
71
|
|
87
|
-
test 'should
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
@wp.get_parsed_options(hf => { o => '12' }).strip
|
97
|
-
end
|
98
|
-
|
99
|
-
assert_equal "--#{hf}-line",
|
100
|
-
@wp.get_parsed_options(hf => { :line => true }).strip
|
101
|
-
assert_equal "--#{hf}-html http://www.abc.com",
|
102
|
-
@wp.get_parsed_options(hf => { :html => { :url => 'http://www.abc.com' } }).strip
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
test 'should parse toc options' do
|
107
|
-
toc_option = @wp.get_valid_option('toc')
|
108
|
-
|
109
|
-
[:font_name, :header_text].each do |o|
|
110
|
-
assert_equal "#{toc_option} --toc-#{o.to_s.tr('_', '-')} toc",
|
111
|
-
@wp.get_parsed_options(:toc => { o => 'toc' }).strip
|
112
|
-
end
|
113
|
-
|
114
|
-
[
|
115
|
-
:depth, :header_fs, :l1_font_size, :l2_font_size, :l3_font_size, :l4_font_size,
|
116
|
-
:l5_font_size, :l6_font_size, :l7_font_size, :l1_indentation, :l2_indentation,
|
117
|
-
:l3_indentation, :l4_indentation, :l5_indentation, :l6_indentation, :l7_indentation
|
118
|
-
].each do |o|
|
119
|
-
assert_equal "#{toc_option} --toc-#{o.to_s.tr('_', '-')} 5",
|
120
|
-
@wp.get_parsed_options(:toc => { o => 5 }).strip
|
121
|
-
end
|
122
|
-
|
123
|
-
[:no_dots, :disable_links, :disable_back_links].each do |o|
|
124
|
-
assert_equal "#{toc_option} --toc-#{o.to_s.tr('_', '-')}",
|
125
|
-
@wp.get_parsed_options(:toc => { o => true }).strip
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
test 'should parse outline options' do
|
130
|
-
assert_equal '--outline', @wp.get_parsed_options(:outline => { :outline => true }).strip
|
131
|
-
assert_equal '--outline-depth 5', @wp.get_parsed_options(:outline => { :outline_depth => 5 }).strip
|
132
|
-
end
|
133
|
-
|
134
|
-
test 'should parse margins options' do
|
135
|
-
[:top, :bottom, :left, :right].each do |o|
|
136
|
-
assert_equal "--margin-#{o} 12", @wp.get_parsed_options(:margin => { o => '12' }).strip
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
test 'should parse cover' do
|
141
|
-
cover_option = @wp.get_valid_option('cover')
|
142
|
-
|
143
|
-
pathname = Rails.root.join('app', 'views', 'pdf', 'file.html')
|
144
|
-
assert_equal "#{cover_option} http://example.org", @wp.get_parsed_options(:cover => 'http://example.org').strip, 'URL'
|
145
|
-
assert_equal "#{cover_option} #{pathname}", @wp.get_parsed_options(:cover => pathname).strip, 'Pathname'
|
146
|
-
assert_match %r(#{cover_option} .+wicked_cover_pdf.+\.html), @wp.get_parsed_options(:cover => '<html><body>HELLO</body></html>').strip, 'HTML'
|
147
|
-
end
|
148
|
-
|
149
|
-
test 'should parse other options' do
|
150
|
-
[
|
151
|
-
:orientation, :page_size, :proxy, :username, :password, :dpi,
|
152
|
-
:encoding, :user_style_sheet
|
153
|
-
].each do |o|
|
154
|
-
assert_equal "--#{o.to_s.tr('_', '-')} opts", @wp.get_parsed_options(o => 'opts').strip
|
155
|
-
end
|
156
|
-
|
157
|
-
[:cookie, :post].each do |o|
|
158
|
-
assert_equal "--#{o.to_s.tr('_', '-')} name value", @wp.get_parsed_options(o => 'name value').strip
|
159
|
-
|
160
|
-
nv_formatter = proc { |number| "--#{o.to_s.tr('_', '-')} par#{number} val#{number}" }
|
161
|
-
assert_equal "#{nv_formatter.call(1)} #{nv_formatter.call(2)}", @wp.get_parsed_options(o => ['par1 val1', 'par2 val2']).strip
|
162
|
-
end
|
163
|
-
|
164
|
-
[:redirect_delay, :zoom, :page_offset].each do |o|
|
165
|
-
assert_equal "--#{o.to_s.tr('_', '-')} 5", @wp.get_parsed_options(o => 5).strip
|
166
|
-
end
|
167
|
-
|
168
|
-
[
|
169
|
-
:book, :default_header, :disable_javascript, :grayscale, :lowquality,
|
170
|
-
:enable_plugins, :disable_internal_links, :disable_external_links,
|
171
|
-
:print_media_type, :disable_smart_shrinking, :use_xserver, :no_background
|
172
|
-
].each do |o|
|
173
|
-
assert_equal "--#{o.to_s.tr('_', '-')}", @wp.get_parsed_options(o => true).strip
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
test 'should extract old wkhtmltopdf version' do
|
178
|
-
version_info_sample = "Name:\n wkhtmltopdf 0.9.9\n\nLicense:\n Copyright (C) 2008,2009 Wkhtmltopdf Authors.\n\n\n\n License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n This is free software: you are free to change and redistribute it. There is NO\n WARRANTY, to the extent permitted by law.\n\nAuthors:\n Written by Jakob Truelsen. Patches by Mrio Silva, Benoit Garret and Emmanuel\n Bouthenot.\n"
|
179
|
-
assert_equal WickedPdf::DEFAULT_BINARY_VERSION, @wp.send(:parse_version, version_info_sample)
|
180
|
-
end
|
181
|
-
|
182
|
-
test 'should extract new wkhtmltopdf version' do
|
183
|
-
version_info_sample = "Name:\n wkhtmltopdf 0.11.0 rc2\n\nLicense:\n Copyright (C) 2010 wkhtmltopdf/wkhtmltoimage Authors.\n\n\n\n License LGPLv3+: GNU Lesser General Public License version 3 or later\n <http://gnu.org/licenses/lgpl.html>. This is free software: you are free to\n change and redistribute it. There is NO WARRANTY, to the extent permitted by\n law.\n\nAuthors:\n Written by Jan Habermann, Christian Sciberras and Jakob Truelsen. Patches by\n Mehdi Abbad, Lyes Amazouz, Pascal Bach, Emmanuel Bouthenot, Benoit Garret and\n Mario Silva."
|
184
|
-
assert_equal Gem::Version.new('0.11.0'), @wp.send(:parse_version, version_info_sample)
|
185
|
-
end
|
186
|
-
|
187
|
-
test 'should extract wkhtmltopdf version with nondigit symbols' do
|
188
|
-
version_info_sample = "Name:\n wkhtmltopdf 0.10.4b\n\nLicense:\n Copyright (C) 2008,2009 Wkhtmltopdf Authors.\n\n\n\n License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n This is free software: you are free to change and redistribute it. There is NO\n WARRANTY, to the extent permitted by law.\n\nAuthors:\n Written by Jakob Truelsen. Patches by Mrio Silva, Benoit Garret and Emmanuel\n Bouthenot.\n"
|
189
|
-
assert_equal Gem::Version.new('0.10.4b'), @wp.send(:parse_version, version_info_sample)
|
190
|
-
end
|
191
|
-
|
192
|
-
test 'should fallback to default version on parse error' do
|
193
|
-
assert_equal WickedPdf::DEFAULT_BINARY_VERSION, @wp.send(:parse_version, '')
|
194
|
-
end
|
195
|
-
|
196
|
-
test 'should set version on initialize' do
|
197
|
-
assert_not_equal @wp.send(:binary_version), ''
|
198
|
-
end
|
199
|
-
|
200
|
-
test 'should not use double dash options for version without dashes' do
|
201
|
-
@wp.binary_version = WickedPdf::BINARY_VERSION_WITHOUT_DASHES
|
202
|
-
|
203
|
-
%w(toc cover).each do |name|
|
204
|
-
assert_equal @wp.get_valid_option(name), name
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
test 'should use double dash options for version with dashes' do
|
209
|
-
@wp.binary_version = Gem::Version.new('0.11.0')
|
210
|
-
|
211
|
-
%w(toc cover).each do |name|
|
212
|
-
assert_equal @wp.get_valid_option(name), "--#{name}"
|
72
|
+
test 'should output progress when creating pdfs on compatible hosts' do
|
73
|
+
wp = WickedPdf.new
|
74
|
+
output = []
|
75
|
+
options = { :progress => proc { |o| output << o } }
|
76
|
+
wp.pdf_from_string HTML_DOCUMENT, options
|
77
|
+
if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/
|
78
|
+
assert_empty output
|
79
|
+
else
|
80
|
+
assert(output.collect { |l| !l.match(/Loading/).nil? }.include?(true)) # should output something like "Loading pages (1/5)"
|
213
81
|
end
|
214
82
|
end
|
215
|
-
|
216
|
-
test '-- options should not be given after object' do
|
217
|
-
options = { :header => { :center => 3 }, :cover => 'http://example.org', :disable_javascript => true }
|
218
|
-
cover_option = @wp.get_valid_option('cover')
|
219
|
-
assert_equal @wp.get_parsed_options(options), "--disable-javascript --header-center 3 #{cover_option} http://example.org"
|
220
|
-
end
|
221
83
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class WkhtmltopdfLocationTest < ActiveSupport::TestCase
|
2
|
+
setup do
|
3
|
+
@saved_config = WickedPdf.config
|
4
|
+
WickedPdf.config = {}
|
5
|
+
end
|
6
|
+
|
7
|
+
teardown do
|
8
|
+
WickedPdf.config = @saved_config
|
9
|
+
end
|
10
|
+
|
11
|
+
test 'should correctly locate wkhtmltopdf without bundler' do
|
12
|
+
bundler_module = Bundler
|
13
|
+
Object.send(:remove_const, :Bundler)
|
14
|
+
|
15
|
+
assert_nothing_raised do
|
16
|
+
WickedPdf.new
|
17
|
+
end
|
18
|
+
|
19
|
+
Object.const_set(:Bundler, bundler_module)
|
20
|
+
end
|
21
|
+
|
22
|
+
test 'should correctly locate wkhtmltopdf with bundler' do
|
23
|
+
assert_nothing_raised do
|
24
|
+
WickedPdf.new
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class LocationNonWritableTest < ActiveSupport::TestCase
|
29
|
+
setup do
|
30
|
+
@saved_config = WickedPdf.config
|
31
|
+
WickedPdf.config = {}
|
32
|
+
|
33
|
+
@old_home = ENV['HOME']
|
34
|
+
ENV['HOME'] = '/not/a/writable/directory'
|
35
|
+
end
|
36
|
+
|
37
|
+
teardown do
|
38
|
+
WickedPdf.config = @saved_config
|
39
|
+
ENV['HOME'] = @old_home
|
40
|
+
end
|
41
|
+
|
42
|
+
test 'should correctly locate wkhtmltopdf with bundler while HOME is set to a non-writable directory' do
|
43
|
+
assert_nothing_raised do
|
44
|
+
WickedPdf.new
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/wicked_pdf.gemspec
CHANGED
@@ -1,33 +1,40 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'wicked_pdf/version'
|
4
|
+
require 'English'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'wicked_pdf'
|
8
8
|
spec.version = WickedPdf::VERSION
|
9
|
-
spec.authors = ['Miles Z. Sterrett']
|
10
|
-
spec.email = 'miles.sterrett@gmail.com'
|
9
|
+
spec.authors = ['Miles Z. Sterrett', 'David Jones']
|
10
|
+
spec.email = ['miles.sterrett@gmail.com', 'unixmonkey1@gmail.com']
|
11
11
|
spec.summary = 'PDF generator (from HTML) gem for Ruby on Rails'
|
12
12
|
spec.homepage = 'https://github.com/mileszs/wicked_pdf'
|
13
13
|
spec.license = 'MIT'
|
14
14
|
spec.date = Time.now.strftime('%Y-%m-%d')
|
15
|
-
spec.description = <<
|
16
|
-
Wicked PDF uses the shell utility wkhtmltopdf to serve a PDF file to a user from HTML.
|
17
|
-
In other words, rather than dealing with a PDF generation DSL of some sort,
|
18
|
-
you simply write an HTML view as you would normally, and let Wicked take care of the hard stuff.
|
19
|
-
|
15
|
+
spec.description = <<DESC.gsub(/^\s+/, '')
|
16
|
+
Wicked PDF uses the shell utility wkhtmltopdf to serve a PDF file to a user from HTML.
|
17
|
+
In other words, rather than dealing with a PDF generation DSL of some sort,
|
18
|
+
you simply write an HTML view as you would normally, and let Wicked take care of the hard stuff.
|
19
|
+
DESC
|
20
|
+
spec.metadata = {
|
21
|
+
'changelog_uri' => 'https://github.com/mileszs/wicked_pdf/blob/master/CHANGELOG.md'
|
22
|
+
}
|
20
23
|
|
21
|
-
spec.
|
22
|
-
spec.
|
24
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.2')
|
25
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
23
26
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
24
27
|
spec.require_paths = ['lib']
|
25
28
|
|
29
|
+
spec.requirements << 'wkhtmltopdf'
|
30
|
+
|
31
|
+
spec.add_dependency 'activesupport'
|
32
|
+
|
33
|
+
spec.add_development_dependency 'bundler'
|
34
|
+
spec.add_development_dependency 'mocha', '= 1.3'
|
26
35
|
spec.add_development_dependency 'rails'
|
27
|
-
spec.add_development_dependency 'bundler', '~> 1.3'
|
28
36
|
spec.add_development_dependency 'rake'
|
29
|
-
spec.add_development_dependency 'rubocop'
|
30
|
-
spec.add_development_dependency 'sqlite3'
|
31
|
-
spec.add_development_dependency 'mocha'
|
37
|
+
spec.add_development_dependency 'rubocop', '~> 1.24'
|
38
|
+
spec.add_development_dependency 'sqlite3', '~> 1.3'
|
32
39
|
spec.add_development_dependency 'test-unit'
|
33
40
|
end
|
metadata
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wicked_pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Z. Sterrett
|
8
|
-
|
8
|
+
- David Jones
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2022-05-19 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
+
name: activesupport
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
18
|
- - ">="
|
18
19
|
- !ruby/object:Gem::Version
|
19
20
|
version: '0'
|
20
|
-
type: :
|
21
|
+
type: :runtime
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
@@ -28,18 +29,32 @@ dependencies:
|
|
28
29
|
name: bundler
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
|
-
- - "
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: mocha
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '='
|
32
47
|
- !ruby/object:Gem::Version
|
33
48
|
version: '1.3'
|
34
49
|
type: :development
|
35
50
|
prerelease: false
|
36
51
|
version_requirements: !ruby/object:Gem::Requirement
|
37
52
|
requirements:
|
38
|
-
- -
|
53
|
+
- - '='
|
39
54
|
- !ruby/object:Gem::Version
|
40
55
|
version: '1.3'
|
41
56
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
57
|
+
name: rails
|
43
58
|
requirement: !ruby/object:Gem::Requirement
|
44
59
|
requirements:
|
45
60
|
- - ">="
|
@@ -53,7 +68,7 @@ dependencies:
|
|
53
68
|
- !ruby/object:Gem::Version
|
54
69
|
version: '0'
|
55
70
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
71
|
+
name: rake
|
57
72
|
requirement: !ruby/object:Gem::Requirement
|
58
73
|
requirements:
|
59
74
|
- - ">="
|
@@ -67,33 +82,33 @@ dependencies:
|
|
67
82
|
- !ruby/object:Gem::Version
|
68
83
|
version: '0'
|
69
84
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
85
|
+
name: rubocop
|
71
86
|
requirement: !ruby/object:Gem::Requirement
|
72
87
|
requirements:
|
73
|
-
- - "
|
88
|
+
- - "~>"
|
74
89
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
90
|
+
version: '1.24'
|
76
91
|
type: :development
|
77
92
|
prerelease: false
|
78
93
|
version_requirements: !ruby/object:Gem::Requirement
|
79
94
|
requirements:
|
80
|
-
- - "
|
95
|
+
- - "~>"
|
81
96
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
97
|
+
version: '1.24'
|
83
98
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
99
|
+
name: sqlite3
|
85
100
|
requirement: !ruby/object:Gem::Requirement
|
86
101
|
requirements:
|
87
|
-
- - "
|
102
|
+
- - "~>"
|
88
103
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
104
|
+
version: '1.3'
|
90
105
|
type: :development
|
91
106
|
prerelease: false
|
92
107
|
version_requirements: !ruby/object:Gem::Requirement
|
93
108
|
requirements:
|
94
|
-
- - "
|
109
|
+
- - "~>"
|
95
110
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
111
|
+
version: '1.3'
|
97
112
|
- !ruby/object:Gem::Dependency
|
98
113
|
name: test-unit
|
99
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,53 +127,64 @@ description: |
|
|
112
127
|
Wicked PDF uses the shell utility wkhtmltopdf to serve a PDF file to a user from HTML.
|
113
128
|
In other words, rather than dealing with a PDF generation DSL of some sort,
|
114
129
|
you simply write an HTML view as you would normally, and let Wicked take care of the hard stuff.
|
115
|
-
email:
|
130
|
+
email:
|
131
|
+
- miles.sterrett@gmail.com
|
132
|
+
- unixmonkey1@gmail.com
|
116
133
|
executables: []
|
117
134
|
extensions: []
|
118
135
|
extra_rdoc_files: []
|
119
136
|
files:
|
137
|
+
- ".github/issue_template.md"
|
138
|
+
- ".github/workflows/ci.yml"
|
120
139
|
- ".gitignore"
|
121
140
|
- ".rubocop.yml"
|
122
141
|
- ".rubocop_todo.yml"
|
123
|
-
- ".travis.yml"
|
124
142
|
- CHANGELOG.md
|
125
143
|
- Gemfile
|
126
144
|
- LICENSE.txt
|
127
145
|
- README.md
|
128
146
|
- Rakefile
|
129
|
-
- gemfiles/
|
130
|
-
- gemfiles/
|
131
|
-
- gemfiles/
|
132
|
-
- gemfiles/
|
133
|
-
- gemfiles/
|
134
|
-
- gemfiles/
|
135
|
-
- gemfiles/4.2.gemfile
|
136
|
-
- gemfiles/rails_edge.gemfile
|
147
|
+
- gemfiles/5.0.gemfile
|
148
|
+
- gemfiles/5.1.gemfile
|
149
|
+
- gemfiles/5.2.gemfile
|
150
|
+
- gemfiles/6.0.gemfile
|
151
|
+
- gemfiles/6.1.gemfile
|
152
|
+
- gemfiles/7.0.gemfile
|
137
153
|
- generators/wicked_pdf/templates/wicked_pdf.rb
|
138
154
|
- generators/wicked_pdf/wicked_pdf_generator.rb
|
139
155
|
- init.rb
|
140
156
|
- lib/generators/wicked_pdf_generator.rb
|
141
157
|
- lib/wicked_pdf.rb
|
158
|
+
- lib/wicked_pdf/binary.rb
|
142
159
|
- lib/wicked_pdf/middleware.rb
|
160
|
+
- lib/wicked_pdf/option_parser.rb
|
143
161
|
- lib/wicked_pdf/pdf_helper.rb
|
162
|
+
- lib/wicked_pdf/progress.rb
|
144
163
|
- lib/wicked_pdf/railtie.rb
|
145
164
|
- lib/wicked_pdf/tempfile.rb
|
146
165
|
- lib/wicked_pdf/version.rb
|
147
166
|
- lib/wicked_pdf/wicked_pdf_helper.rb
|
148
167
|
- lib/wicked_pdf/wicked_pdf_helper/assets.rb
|
168
|
+
- test/fixtures/database.yml
|
149
169
|
- test/fixtures/document_with_long_line.html
|
170
|
+
- test/fixtures/manifest.js
|
150
171
|
- test/fixtures/wicked.css
|
172
|
+
- test/fixtures/wicked.js
|
151
173
|
- test/functional/pdf_helper_test.rb
|
152
174
|
- test/functional/wicked_pdf_helper_assets_test.rb
|
153
175
|
- test/functional/wicked_pdf_helper_test.rb
|
154
176
|
- test/test_helper.rb
|
177
|
+
- test/unit/wicked_pdf_binary_test.rb
|
178
|
+
- test/unit/wicked_pdf_option_parser_test.rb
|
155
179
|
- test/unit/wicked_pdf_test.rb
|
180
|
+
- test/unit/wkhtmltopdf_location_test.rb
|
156
181
|
- wicked_pdf.gemspec
|
157
182
|
homepage: https://github.com/mileszs/wicked_pdf
|
158
183
|
licenses:
|
159
184
|
- MIT
|
160
|
-
metadata:
|
161
|
-
|
185
|
+
metadata:
|
186
|
+
changelog_uri: https://github.com/mileszs/wicked_pdf/blob/master/CHANGELOG.md
|
187
|
+
post_install_message:
|
162
188
|
rdoc_options: []
|
163
189
|
require_paths:
|
164
190
|
- lib
|
@@ -166,24 +192,29 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
192
|
requirements:
|
167
193
|
- - ">="
|
168
194
|
- !ruby/object:Gem::Version
|
169
|
-
version: '
|
195
|
+
version: '2.2'
|
170
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
197
|
requirements:
|
172
198
|
- - ">="
|
173
199
|
- !ruby/object:Gem::Version
|
174
200
|
version: '0'
|
175
|
-
requirements:
|
176
|
-
|
177
|
-
rubygems_version: 2.
|
178
|
-
signing_key:
|
201
|
+
requirements:
|
202
|
+
- wkhtmltopdf
|
203
|
+
rubygems_version: 3.2.3
|
204
|
+
signing_key:
|
179
205
|
specification_version: 4
|
180
206
|
summary: PDF generator (from HTML) gem for Ruby on Rails
|
181
207
|
test_files:
|
208
|
+
- test/fixtures/database.yml
|
182
209
|
- test/fixtures/document_with_long_line.html
|
210
|
+
- test/fixtures/manifest.js
|
183
211
|
- test/fixtures/wicked.css
|
212
|
+
- test/fixtures/wicked.js
|
184
213
|
- test/functional/pdf_helper_test.rb
|
185
214
|
- test/functional/wicked_pdf_helper_assets_test.rb
|
186
215
|
- test/functional/wicked_pdf_helper_test.rb
|
187
216
|
- test/test_helper.rb
|
217
|
+
- test/unit/wicked_pdf_binary_test.rb
|
218
|
+
- test/unit/wicked_pdf_option_parser_test.rb
|
188
219
|
- test/unit/wicked_pdf_test.rb
|
189
|
-
|
220
|
+
- test/unit/wkhtmltopdf_location_test.rb
|