bidi2pdf-rails 0.0.1.pre.alpha โ 0.1.1
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 +4 -4
- data/.idea/bidi2pdf-rails.iml +68 -84
- data/.rubocop.yml +14 -0
- data/CHANGELOG.md +54 -0
- data/README.md +118 -28
- data/Rakefile +2 -0
- data/cliff.toml +126 -0
- data/lib/bidi2pdf_rails/browser_console_log_subscriber.rb +24 -0
- data/lib/bidi2pdf_rails/chromedriver_manager_singleton.rb +11 -11
- data/lib/bidi2pdf_rails/config.rb +137 -0
- data/lib/bidi2pdf_rails/configurable.rb +106 -0
- data/lib/bidi2pdf_rails/main_log_subscriber.rb +33 -0
- data/lib/bidi2pdf_rails/network_log_subscriber.rb +20 -0
- data/lib/bidi2pdf_rails/railtie.rb +13 -45
- data/lib/bidi2pdf_rails/services/html_renderer.rb +33 -0
- data/lib/bidi2pdf_rails/services/html_to_pdf_converter.rb +37 -0
- data/lib/bidi2pdf_rails/services/pdf_browser_session.rb +38 -0
- data/lib/bidi2pdf_rails/services/pdf_injection.rb +31 -0
- data/lib/bidi2pdf_rails/services/pdf_renderer.rb +94 -0
- data/lib/bidi2pdf_rails/services/url_to_pdf_converter.rb +91 -0
- data/lib/bidi2pdf_rails/version.rb +1 -1
- data/lib/bidi2pdf_rails.rb +41 -58
- data/lib/generators/bidi2pdf_rails/USAGE +12 -4
- data/lib/generators/bidi2pdf_rails/initializer_generator.rb +136 -30
- data/lib/generators/bidi2pdf_rails/templates/bidi2pdf_rails.rb.tt +25 -79
- data/spec/acceptance/user_can_download_report_pdf_spec.rb +133 -0
- data/spec/acceptance/user_can_generate_pdf_from_protected_remote_url_spec.rb +173 -0
- data/spec/acceptance/user_can_inject_css_before_pdf_printing_spec.rb +132 -0
- data/spec/acceptance/user_can_inject_js_before_pdf_printing_spec.rb +158 -0
- data/spec/dummy/app/assets/javascripts/simple.js +12 -0
- data/spec/dummy/app/assets/stylesheets/simple.css +3 -0
- data/spec/dummy/app/controllers/reports_controller.rb +47 -0
- data/spec/dummy/app/controllers/secure_controller.rb +52 -0
- data/spec/dummy/app/views/layouts/simple.html.erb +17 -0
- data/spec/dummy/app/views/reports/simple.html.erb +6 -0
- data/spec/dummy/app/views/secure/show.html.erb +10 -0
- data/spec/dummy/config/environments/production.rb +1 -1
- data/spec/dummy/config/initializers/bidi2pdf_rails.rb +72 -54
- data/spec/dummy/config/initializers/cors.rb +1 -1
- data/spec/dummy/config/routes.rb +14 -0
- data/spec/dummy/log/development.log +18331 -158
- data/spec/dummy/log/test.log +87874 -0
- data/spec/dummy/tmp/pids/server.pid +1 -1
- data/spec/integration/generators/bidi2pdf_rails/initializer_generator_spec.rb +64 -0
- data/spec/rails_helper.rb +8 -1
- data/spec/spec_helper.rb +47 -5
- data/spec/support/default_dirs_helper.rb +32 -0
- data/spec/support/pdf_helper.rb +12 -0
- data/spec/support/render_setting_helpers.rb +47 -0
- data/spec/support/request_server_bootstrap.rb +44 -0
- data/spec/{bidi2pdf_rails โ unit/bidi2pdf_rails}/bidi2pdf_rails_spec.rb +1 -1
- data/spec/unit/bidi2pdf_rails/configurable/base_nested_config_spec.rb +133 -0
- data/tasks/changelog.rake +29 -0
- data/tasks/coverage.rake +23 -0
- metadata +108 -27
- data/lib/bidi2pdf_rails/log_subscriber.rb +0 -13
- data/spec/dummy/spec/helpers/reports_helper_spec.rb +0 -15
- data/spec/dummy/spec/requests/reports_spec.rb +0 -10
- data/spec/dummy/spec/views/reports/show.html.erb_spec.rb +0 -5
- data/spec/generator/bidie2pdf_rails_initializer_generator_spec.rb +0 -5
- data/spec/generator/initializer_generator_spec.rb +0 -5
- data/spec/requests/reports_spec.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdc355a4443f528f48ebd21191833657a5460ee9bbbcc0ad0b9d78d33a8893c0
|
4
|
+
data.tar.gz: 7a51735017e0f853b64eac9de4174e42f5bdc087e85ab37e2b82f205492e556b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb4fae40d50dff4a550b50402511245f700a219d850db16d3d717da6243dc554d0aca260a0e2b37ba2f1f83c5235aac000f527fdd0834a989a19fc7d14f099e0
|
7
|
+
data.tar.gz: 6c1191ec15930b910f0b5558099996cdecf4b14bf613c0f9c979aee30b554a1a010ec9a98a27f405881b9f54595acf0ef60462534d7e3ad3bd3c3fde200a5581
|
data/.idea/bidi2pdf-rails.iml
CHANGED
@@ -28,80 +28,7 @@
|
|
28
28
|
</content>
|
29
29
|
<orderEntry type="jdk" jdkName="RVM: ruby-3.3.4 [bidi2pdf-rails]" jdkType="RUBY_SDK" />
|
30
30
|
<orderEntry type="sourceFolder" forTests="false" />
|
31
|
-
<orderEntry type="
|
32
|
-
<library name="bidi2pdf (v0.1.6) [path][gem]" type="rubylib">
|
33
|
-
<properties>
|
34
|
-
<option name="additionalInfo">
|
35
|
-
<AdditionalInfo>
|
36
|
-
<option name="authors" value="N/A" />
|
37
|
-
<option name="email" value="N/A" />
|
38
|
-
<option name="homepage" value="N/A" />
|
39
|
-
<option name="summary" value="N/A" />
|
40
|
-
</AdditionalInfo>
|
41
|
-
</option>
|
42
|
-
<option name="fromPath" value="true" />
|
43
|
-
<option name="git" value="true" />
|
44
|
-
<option name="name" value="bidi2pdf" />
|
45
|
-
<option name="requirePaths">
|
46
|
-
<list>
|
47
|
-
<option value="lib" />
|
48
|
-
</list>
|
49
|
-
</option>
|
50
|
-
<option name="url" value="file://$MODULE_DIR$/../bidi2pdf" />
|
51
|
-
<option name="version" value="0.1.6" />
|
52
|
-
</properties>
|
53
|
-
<CLASSES>
|
54
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/bin" />
|
55
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/exe" />
|
56
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/lib" />
|
57
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/pkg" />
|
58
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/sig" />
|
59
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/tmp" />
|
60
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/.git" />
|
61
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/spec" />
|
62
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/.idea" />
|
63
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/tasks" />
|
64
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/docker" />
|
65
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/output" />
|
66
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/.bundle" />
|
67
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/.github" />
|
68
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/coverage" />
|
69
|
-
</CLASSES>
|
70
|
-
<JAVADOC />
|
71
|
-
<SOURCES>
|
72
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/bin" />
|
73
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/exe" />
|
74
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/lib" />
|
75
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/pkg" />
|
76
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/sig" />
|
77
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/tmp" />
|
78
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/.git" />
|
79
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/spec" />
|
80
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/.idea" />
|
81
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/tasks" />
|
82
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/docker" />
|
83
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/output" />
|
84
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/.bundle" />
|
85
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/.github" />
|
86
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/coverage" />
|
87
|
-
</SOURCES>
|
88
|
-
<excluded>
|
89
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/bin" />
|
90
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/exe" />
|
91
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/pkg" />
|
92
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/tmp" />
|
93
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/.git" />
|
94
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/spec" />
|
95
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/.idea" />
|
96
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/tasks" />
|
97
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/docker" />
|
98
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/output" />
|
99
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/.bundle" />
|
100
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/.github" />
|
101
|
-
<root url="file://$MODULE_DIR$/../bidi2pdf/coverage" />
|
102
|
-
</excluded>
|
103
|
-
</library>
|
104
|
-
</orderEntry>
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="Ascii85 (v2.0.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
105
32
|
<orderEntry type="library" scope="PROVIDED" name="actioncable (v7.2.2.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
106
33
|
<orderEntry type="library" scope="PROVIDED" name="actionmailbox (v7.2.2.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
107
34
|
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v7.2.2.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
@@ -113,8 +40,11 @@
|
|
113
40
|
<orderEntry type="library" scope="PROVIDED" name="activerecord (v7.2.2.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
114
41
|
<orderEntry type="library" scope="PROVIDED" name="activestorage (v7.2.2.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
115
42
|
<orderEntry type="library" scope="PROVIDED" name="activesupport (v7.2.2.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
43
|
+
<orderEntry type="library" scope="PROVIDED" name="afm (v0.2.2, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
44
|
+
<orderEntry type="library" scope="PROVIDED" name="ammeter (v1.1.7, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
116
45
|
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.3, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
117
46
|
<orderEntry type="library" scope="PROVIDED" name="benchmark (v0.4.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
47
|
+
<orderEntry type="library" scope="PROVIDED" name="bidi2pdf (v0.1.8, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
118
48
|
<orderEntry type="library" scope="PROVIDED" name="bigdecimal (v3.1.9, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
119
49
|
<orderEntry type="library" scope="PROVIDED" name="builder (v3.3.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
120
50
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.5.11, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
@@ -128,8 +58,9 @@
|
|
128
58
|
<orderEntry type="library" scope="PROVIDED" name="drb (v2.2.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
129
59
|
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.13.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
130
60
|
<orderEntry type="library" scope="PROVIDED" name="event_emitter (v0.2.6, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
131
|
-
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.17.
|
61
|
+
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.17.2, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
132
62
|
<orderEntry type="library" scope="PROVIDED" name="globalid (v1.2.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
63
|
+
<orderEntry type="library" scope="PROVIDED" name="hashery (v2.1.2, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
133
64
|
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.14.7, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
134
65
|
<orderEntry type="library" scope="PROVIDED" name="io-console (v0.8.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
135
66
|
<orderEntry type="library" scope="PROVIDED" name="irb (v1.15.2, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
@@ -148,8 +79,9 @@
|
|
148
79
|
<orderEntry type="library" scope="PROVIDED" name="net-smtp (v0.5.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
149
80
|
<orderEntry type="library" scope="PROVIDED" name="nio4r (v2.7.4, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
150
81
|
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.18.7, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
151
|
-
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.
|
82
|
+
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.27.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
152
83
|
<orderEntry type="library" scope="PROVIDED" name="parser (v3.3.8.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
84
|
+
<orderEntry type="library" scope="PROVIDED" name="pdf-reader (v2.14.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
153
85
|
<orderEntry type="library" scope="PROVIDED" name="pp (v0.6.2, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
154
86
|
<orderEntry type="library" scope="PROVIDED" name="prism (v1.4.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
155
87
|
<orderEntry type="library" scope="PROVIDED" name="propshaft (v1.1.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
@@ -175,14 +107,15 @@
|
|
175
107
|
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.13.2, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
176
108
|
<orderEntry type="library" scope="PROVIDED" name="rspec-rails (v7.1.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
177
109
|
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.13.2, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
178
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.75.
|
110
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.75.3, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
179
111
|
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.44.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
180
112
|
<orderEntry type="library" scope="PROVIDED" name="rubocop-performance (v1.25.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
181
113
|
<orderEntry type="library" scope="PROVIDED" name="rubocop-rails (v2.31.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
182
114
|
<orderEntry type="library" scope="PROVIDED" name="rubocop-rails-omakase (v1.1.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
183
115
|
<orderEntry type="library" scope="PROVIDED" name="rubocop-rake (v0.7.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
184
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-rspec (v3.
|
116
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-rspec (v3.6.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
185
117
|
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
118
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-rc4 (v0.1.5, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
186
119
|
<orderEntry type="library" scope="PROVIDED" name="rubyzip (v2.4.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
187
120
|
<orderEntry type="library" scope="PROVIDED" name="securerandom (v0.4.1, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
188
121
|
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.22.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
@@ -192,14 +125,17 @@
|
|
192
125
|
<orderEntry type="library" scope="PROVIDED" name="sys-proctable (v1.3.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
193
126
|
<orderEntry type="library" scope="PROVIDED" name="thor (v1.3.2, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
194
127
|
<orderEntry type="library" scope="PROVIDED" name="timeout (v0.4.3, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
128
|
+
<orderEntry type="library" scope="PROVIDED" name="ttfunk (v1.8.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
195
129
|
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.6, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
196
130
|
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v3.1.4, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
197
131
|
<orderEntry type="library" scope="PROVIDED" name="unicode-emoji (v4.0.4, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
132
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode_utils (v1.4.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
198
133
|
<orderEntry type="library" scope="PROVIDED" name="useragent (v0.16.11, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
199
134
|
<orderEntry type="library" scope="PROVIDED" name="websocket (v1.2.11, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
200
135
|
<orderEntry type="library" scope="PROVIDED" name="websocket-client-simple (v0.9.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
201
136
|
<orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.7.7, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
202
137
|
<orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.5, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
138
|
+
<orderEntry type="library" scope="PROVIDED" name="websocket-native (v1.0.0, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
203
139
|
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.7.2, RVM: ruby-3.3.4 [bidi2pdf-rails]) [gem]" level="application" />
|
204
140
|
</component>
|
205
141
|
<component name="RailsGeneratorsCache">
|
@@ -338,9 +274,6 @@
|
|
338
274
|
<entry key="config">
|
339
275
|
<value>file://$MODULE_DIR$/config</value>
|
340
276
|
</entry>
|
341
|
-
<entry key="config/cable">
|
342
|
-
<value>file://$MODULE_DIR$/config/cable.yml</value>
|
343
|
-
</entry>
|
344
277
|
<entry key="config/database">
|
345
278
|
<value>file://$MODULE_DIR$/config/database.yml</value>
|
346
279
|
</entry>
|
@@ -362,9 +295,6 @@
|
|
362
295
|
<entry key="config/routes.rb">
|
363
296
|
<value>file://$MODULE_DIR$/config/routes.rb</value>
|
364
297
|
</entry>
|
365
|
-
<entry key="config/secrets">
|
366
|
-
<value>file://$MODULE_DIR$/config</value>
|
367
|
-
</entry>
|
368
298
|
<entry key="db">
|
369
299
|
<value>file://$MODULE_DIR$/db</value>
|
370
300
|
</entry>
|
@@ -398,6 +328,9 @@
|
|
398
328
|
<entry key="public/stylesheets">
|
399
329
|
<value>file://$MODULE_DIR$/public/stylesheets</value>
|
400
330
|
</entry>
|
331
|
+
<entry key="test/mailers/previews">
|
332
|
+
<value>file://$MODULE_DIR$/test/mailers/previews</value>
|
333
|
+
</entry>
|
401
334
|
<entry key="tmp">
|
402
335
|
<value>file://$MODULE_DIR$/tmp</value>
|
403
336
|
</entry>
|
@@ -408,4 +341,55 @@
|
|
408
341
|
<value>file://$MODULE_DIR$/vendor/assets</value>
|
409
342
|
</entry>
|
410
343
|
</component>
|
344
|
+
<component name="RakeTasksCache-v2">
|
345
|
+
<option name="myRootTask">
|
346
|
+
<RakeTaskImpl id="rake">
|
347
|
+
<subtasks>
|
348
|
+
<RakeTaskImpl description="Build bidi2pdf-rails-0.1.1.gem into the pkg directory" fullCommand="build" id="build" />
|
349
|
+
<RakeTaskImpl id="build">
|
350
|
+
<subtasks>
|
351
|
+
<RakeTaskImpl description="Generate SHA512 checksum of bidi2pdf-rails-0.1.1.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
352
|
+
</subtasks>
|
353
|
+
</RakeTaskImpl>
|
354
|
+
<RakeTaskImpl id="changelog">
|
355
|
+
<subtasks>
|
356
|
+
<RakeTaskImpl description="Generate unreleased section in CHANGELOG.md (requires git-cliff)" fullCommand="changelog:update_unreleased" id="update_unreleased" />
|
357
|
+
</subtasks>
|
358
|
+
</RakeTaskImpl>
|
359
|
+
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
360
|
+
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
361
|
+
<RakeTaskImpl id="coverage">
|
362
|
+
<subtasks>
|
363
|
+
<RakeTaskImpl description="Run tests with coverage" fullCommand="coverage:coverage" id="coverage" />
|
364
|
+
<RakeTaskImpl description="Merge simplecov coverage reports" fullCommand="coverage:merge_reports" id="merge_reports" />
|
365
|
+
</subtasks>
|
366
|
+
</RakeTaskImpl>
|
367
|
+
<RakeTaskImpl description="Build and install bidi2pdf-rails-0.1.1.gem into system gems" fullCommand="install" id="install" />
|
368
|
+
<RakeTaskImpl id="install">
|
369
|
+
<subtasks>
|
370
|
+
<RakeTaskImpl description="Build and install bidi2pdf-rails-0.1.1.gem into system gems without network access" fullCommand="install:local" id="local" />
|
371
|
+
</subtasks>
|
372
|
+
</RakeTaskImpl>
|
373
|
+
<RakeTaskImpl description="Create tag v0.1.1 and build and push bidi2pdf-rails-0.1.1.gem to https://rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
374
|
+
<RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
|
375
|
+
<RakeTaskImpl id="rubocop">
|
376
|
+
<subtasks>
|
377
|
+
<RakeTaskImpl description="Autocorrect RuboCop offenses (only when it's safe)" fullCommand="rubocop:autocorrect" id="autocorrect" />
|
378
|
+
<RakeTaskImpl description="Autocorrect RuboCop offenses (safe and unsafe)" fullCommand="rubocop:autocorrect_all" id="autocorrect_all" />
|
379
|
+
<RakeTaskImpl description="" fullCommand="rubocop:auto_correct" id="auto_correct" />
|
380
|
+
</subtasks>
|
381
|
+
</RakeTaskImpl>
|
382
|
+
<RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
|
383
|
+
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
384
|
+
<RakeTaskImpl id="release">
|
385
|
+
<subtasks>
|
386
|
+
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
387
|
+
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
388
|
+
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
389
|
+
</subtasks>
|
390
|
+
</RakeTaskImpl>
|
391
|
+
</subtasks>
|
392
|
+
</RakeTaskImpl>
|
393
|
+
</option>
|
394
|
+
</component>
|
411
395
|
</module>
|
data/.rubocop.yml
CHANGED
@@ -50,9 +50,18 @@ Layout/BeginEndAlignment:
|
|
50
50
|
Layout/ArrayAlignment:
|
51
51
|
Enabled: false
|
52
52
|
|
53
|
+
Layout/ElseAlignment:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
Layout/EndAlignment:
|
57
|
+
Enabled: false
|
58
|
+
|
53
59
|
Layout/LineLength:
|
54
60
|
Enabled: false
|
55
61
|
|
62
|
+
Layout/SpaceInsideArrayLiteralBrackets:
|
63
|
+
EnforcedStyle: no_space
|
64
|
+
|
56
65
|
RSpec/MultipleMemoizedHelpers:
|
57
66
|
Max: 10
|
58
67
|
|
@@ -85,6 +94,11 @@ RSpec/DescribeClass:
|
|
85
94
|
Exclude:
|
86
95
|
- 'spec/acceptance/**/*_spec.rb'
|
87
96
|
|
97
|
+
RSpec/MultipleExpectations:
|
98
|
+
Enabled: true
|
99
|
+
Exclude:
|
100
|
+
- 'spec/acceptance/**/*_spec.rb'
|
101
|
+
|
88
102
|
plugins:
|
89
103
|
- rubocop-rake
|
90
104
|
- rubocop-rspec
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
<!-- generated by git-cliff start -->
|
2
|
+
|
3
|
+
# Changelog
|
4
|
+
|
5
|
+
All notable changes to this project will be documented in this file.
|
6
|
+
|
7
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
8
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
9
|
+
|
10
|
+
[unreleased]: https://github.com/dieter-medium/bidi2pdf-rails/compare/v0.1.1..HEAD
|
11
|
+
|
12
|
+
<!-- generated by git-cliff end -->
|
13
|
+
|
14
|
+
## [0.1.1] - 2025-04-22
|
15
|
+
|
16
|
+
### ๐จ Refactored
|
17
|
+
|
18
|
+
- Streamline PDF generation in browser session by @dieter-medium
|
19
|
+
|
20
|
+
### ๐ Docs
|
21
|
+
|
22
|
+
- Update CHANGELOG formatting for releases by @dieter-medium
|
23
|
+
- Enhance README with usage and config examples by @dieter-medium
|
24
|
+
|
25
|
+
### ๐ Added
|
26
|
+
|
27
|
+
- Add support for injecting custom JS into PDFs by @dieter-medium
|
28
|
+
- Add support for injecting custom CSS into PDFs by @dieter-medium
|
29
|
+
|
30
|
+
## [0.1.0] - 2025-04-21
|
31
|
+
|
32
|
+
### ๐ Fixed
|
33
|
+
|
34
|
+
- Add PDF rendering from protected remote URLs by @dieter-medium
|
35
|
+
- Add acceptance tests for PDF generation with bidi2pdf-rails by @dieter-medium
|
36
|
+
- Allow forcing chromedriver manager initialization by @dieter-medium
|
37
|
+
- Add unit tests for BaseNestedConfig behavior by @dieter-medium
|
38
|
+
|
39
|
+
### ๐ Docs
|
40
|
+
|
41
|
+
- Enhance README with usage and config examples by @dieter-medium
|
42
|
+
- Add CORS configuration details for asset access by @dieter-medium
|
43
|
+
|
44
|
+
### ๐ Added
|
45
|
+
|
46
|
+
- Enhance configuration and logging for Bidi2pdfRails by @dieter-medium
|
47
|
+
- Ensure custom HTML can be used in PDF rendering by @dieter-medium
|
48
|
+
|
49
|
+
### ๐ Released
|
50
|
+
|
51
|
+
- [unreleased](https://github.com/dieter-medium/bidi2pdf-rails/compare/v0.1.0..HEAD)
|
52
|
+
- [0.1.1](https://github.com/dieter-medium/bidi2pdf-rails/compare/v0.1.0..v0.1.1)
|
53
|
+
- [0.1.0](https://github.com/dieter-medium/bidi2pdf-rails/compare/v0.0.1.alpha.1..v0.1.0)
|
54
|
+
|
data/README.md
CHANGED
@@ -1,75 +1,165 @@
|
|
1
1
|
[](https://github.com/dieter-medium/bidi2pdf-rails/blob/main/.github/workflows/ruby.yml)
|
2
2
|
[](https://codeclimate.com/github/dieter-medium/bidi2pdf-rails/maintainability)
|
3
|
-
[](https://badge.fury.io/rb/bidi2pdf-rails)
|
4
3
|
[](https://codeclimate.com/github/dieter-medium/bidi2pdf-rails/test_coverage)
|
4
|
+
[](https://badge.fury.io/rb/bidi2pdf-rails)
|
5
5
|
[](https://www.codetriage.com/dieter-medium/bidi2pdf-rails)
|
6
6
|
|
7
|
-
|
8
7
|
# ๐ Bidi2pdfRails
|
9
8
|
|
10
|
-
**Bidi2pdfRails** is the official Rails integration for [Bidi2pdf](https://github.com/dieter-medium/bidi2pdf)
|
11
|
-
|
12
|
-
|
13
|
-
> **โ ๏ธ Note:** This project is currently **under development** and **not yet recommended for production use**.
|
9
|
+
**Bidi2pdfRails** is the official Rails integration for [Bidi2pdf](https://github.com/dieter-medium/bidi2pdf) โ a
|
10
|
+
modern, headless-browser-based PDF rendering engine.
|
11
|
+
Generate high-fidelity PDFs directly from your Rails views or external URLs with minimal setup.
|
14
12
|
|
15
13
|
---
|
16
14
|
|
17
|
-
##
|
15
|
+
## โจ Features
|
18
16
|
|
19
|
-
-
|
20
|
-
-
|
21
|
-
-
|
17
|
+
- ๐ Accurate PDF rendering using a real browser engine
|
18
|
+
- ๐พ Supports both HTML string rendering and remote URL conversion
|
19
|
+
- ๐ Built-in support for authentication (Basic Auth, cookies, headers)
|
20
|
+
- ๐งฐ Full test suite with examples for Rails controller integration
|
21
|
+
- ๐ง Sensible defaults, yet fully configurable
|
22
22
|
|
23
23
|
---
|
24
24
|
|
25
25
|
## ๐ง Installation
|
26
26
|
|
27
|
-
Add
|
27
|
+
Add to your Gemfile:
|
28
28
|
|
29
29
|
```ruby
|
30
30
|
gem "bidi2pdf-rails"
|
31
|
-
#
|
32
|
-
gem "bidi2pdf-rails", github: "dieter-medium/bidi2pdf", branch: "main"
|
33
|
-
|
31
|
+
# for development only
|
32
|
+
# gem "bidi2pdf-rails", github: "dieter-medium/bidi2pdf-rails", branch: "main"
|
33
|
+
|
34
|
+
# Optional for performance:
|
35
|
+
# gem "websocket-native"
|
34
36
|
```
|
35
37
|
|
36
|
-
|
38
|
+
Install it:
|
37
39
|
|
38
40
|
```bash
|
39
|
-
bundle
|
41
|
+
bundle install
|
40
42
|
```
|
41
43
|
|
42
|
-
Generate the initializer:
|
44
|
+
Generate the config initializer:
|
43
45
|
|
44
46
|
```bash
|
45
47
|
bin/rails generate bidi2pdf_rails:initializer
|
46
48
|
```
|
47
49
|
|
48
|
-
|
50
|
+
---
|
51
|
+
|
52
|
+
## ๐ฆ Usage Examples
|
49
53
|
|
50
|
-
|
51
|
-
|
54
|
+
### ๐ Rendering a Rails View as PDF
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
# app/controllers/invoices_controller.rb
|
58
|
+
|
59
|
+
def show
|
60
|
+
render pdf: "invoice",
|
61
|
+
template: "invoices/show",
|
62
|
+
layout: "pdf",
|
63
|
+
locals: { invoice: @invoice },
|
64
|
+
print_options: { landscape: true },
|
65
|
+
wait_for_network_idle: true
|
66
|
+
end
|
67
|
+
```
|
68
|
+
|
69
|
+
### ๐ Rendering a Remote URL to PDF
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
|
73
|
+
def convert
|
74
|
+
render pdf: "external-report",
|
75
|
+
url: "https://example.com/dashboard",
|
76
|
+
wait_for_page_loaded: false,
|
77
|
+
print_options: { page: { format: :A4 } }
|
78
|
+
end
|
79
|
+
```
|
80
|
+
|
81
|
+
---
|
82
|
+
|
83
|
+
## ๐ก๏ธ Authentication Support
|
84
|
+
|
85
|
+
Need to convert pages that require authentication? No problem. Use:
|
86
|
+
|
87
|
+
- `auth: { username:, password: }`
|
88
|
+
- `cookies: { session_key: value }`
|
89
|
+
- `headers: { "Authorization" => "Bearer ..." }`
|
90
|
+
|
91
|
+
Example:
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
render pdf: "secure",
|
95
|
+
url: secure_report_url,
|
96
|
+
auth: { username: "admin", password: "secret" }
|
97
|
+
```
|
98
|
+
|
99
|
+
Or use global config in `bidi2pdf_rails.rb` initializer:
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
config.render_remote_settings.basic_auth_user = ->(_) { "admin" }
|
103
|
+
config.render_remote_settings.basic_auth_pass = ->(_) { Rails.application.credentials.dig(:pdf, :auth_pass) }
|
104
|
+
```
|
105
|
+
|
106
|
+
---
|
107
|
+
|
108
|
+
## ๐ Asset Access via CORS
|
109
|
+
|
110
|
+
When rendering HTML with `render_to_string`, Chromium needs access to your assets (CSS, images, fonts).
|
111
|
+
Enable CORS for `/assets` using `rack-cors`:
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
# Gemfile
|
115
|
+
gem 'rack-cors'
|
116
|
+
|
117
|
+
# config/initializers/cors.rb
|
118
|
+
Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
119
|
+
allow do
|
120
|
+
origins '*'
|
121
|
+
resource '/assets/*', headers: :any, methods: [:get, :options]
|
122
|
+
end
|
123
|
+
end
|
52
124
|
```
|
53
125
|
|
54
126
|
---
|
55
127
|
|
56
|
-
## ๐งช
|
128
|
+
## ๐งช Acceptance Examples
|
129
|
+
|
130
|
+
This repo includes **real integration tests** that serve as usage documentation:
|
131
|
+
|
132
|
+
- [Download PDF with `.pdf` format](spec/acceptance/user_can_download_report_pdf_spec.rb)
|
133
|
+
- [Render protected remote URLs using Basic Auth, cookies, and headers](spec/acceptance/user_can_generate_pdf_from_protected_remote_url_spec.rb)
|
134
|
+
- [Inject custom CSS into a Webpage before printing](spec/acceptance/user_can_inject_css_before_pdf_printing_spec.rb)
|
135
|
+
- [Inject custom JS into a Webpage before printing](spec/acceptance/user_can_inject_js_before_pdf_printing_spec.rb)
|
136
|
+
|
137
|
+
---
|
138
|
+
|
139
|
+
## ๐ง Configuration
|
140
|
+
|
141
|
+
Bidi2pdfRails is highly configurable.
|
142
|
+
|
143
|
+
See full config options in:
|
144
|
+
|
145
|
+
```bash
|
146
|
+
bin/rails generate bidi2pdf_rails:initializer
|
147
|
+
```
|
57
148
|
|
58
|
-
|
59
|
-
This demonstrates how to use `Bidi2pdfRails` in a realistic mini Rails application setup.
|
149
|
+
Or explore [Bidi2pdfRails::Config::CONFIG_OPTIONS](lib/bidi2pdf_rails/config.rb) in the source.
|
60
150
|
|
61
151
|
---
|
62
152
|
|
63
153
|
## ๐ Contributing
|
64
154
|
|
65
|
-
|
66
|
-
|
155
|
+
Pull requests, issues, and ideas are all welcome ๐
|
156
|
+
Want to contribute? Just fork, branch, and PR like a boss.
|
67
157
|
|
68
|
-
|
158
|
+
> Contribution guide coming soon!
|
69
159
|
|
70
160
|
---
|
71
161
|
|
72
162
|
## ๐ License
|
73
163
|
|
74
|
-
This gem is
|
75
|
-
|
164
|
+
This gem is released under the [MIT License](https://opensource.org/licenses/MIT).
|
165
|
+
Use freely โ and responsibly.
|