grover 1.0.6 → 1.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b29220f00e289b012a01c83e1ac3a4d7fe70b034589760f3aea045069127e453
4
- data.tar.gz: f90bcb0e42bab405df3d296d4f70221684652d2e523970b9018b3a38737f8694
3
+ metadata.gz: b99e2ab2724c1384347e40dd33199bd943fd4ec371f0cbf1c539ce6e3cca81f7
4
+ data.tar.gz: eb96813f2e5ef10d50ce5b1dfe4bb0cfaffc54d7dd212c10901e7f85ff8b9fdf
5
5
  SHA512:
6
- metadata.gz: 2415a80b468c7bbe454cf622fbae3b2cef2b7450577f92845e30fbef54d602a3f46dbf4594258053f07badc847c7ab1f3ac53c72f04a385d993b85e054295448
7
- data.tar.gz: a928a1f0bc91ba18b7059fd60e44d2348d6727e4cd7d37fbc47e13cf56b1a5e9fa04d6136189a1a3e1a673ab3a86572d5ef58e7e2ca54cc797ab355327c2db37
6
+ metadata.gz: 633d31ee5053ec6d6c00f0e0ac2e68c0a5768cfbf201be61b56e35b6912d1f8f1720e56457eb8fb212bd85842a74a16e3a4d806f2dccfd166223df0ffae3163d
7
+ data.tar.gz: 714be51eb85beae33685cf8d11812fbb62fa3dfaec16a5da599ec96b26982c3dacdf916630eed9775567275cdee229c780a00a79435be9b1237ba38ec6e72381
@@ -61,9 +61,10 @@ const _processPage = (async (convertAction, urlOrHtml, options) => {
61
61
 
62
62
  // Setup timeout option (if provided)
63
63
  let requestOptions = {};
64
- const timeout = options.timeout; delete options.timeout;
65
- if (timeout !== undefined) {
66
- requestOptions.timeout = timeout;
64
+ let requestTimeout = options.requestTimeout; delete options.requestTimeout;
65
+ if (requestTimeout === undefined) requestTimeout = options.timeout;
66
+ if (requestTimeout !== undefined) {
67
+ requestOptions.timeout = requestTimeout;
67
68
  }
68
69
 
69
70
  // Setup user agent (if provided)
@@ -121,7 +122,7 @@ const _processPage = (async (convertAction, urlOrHtml, options) => {
121
122
  const raiseOnRequestFailure = options.raiseOnRequestFailure; delete options.raiseOnRequestFailure;
122
123
  if (raiseOnRequestFailure) {
123
124
  page.on('requestfinished', (request) => {
124
- if (request.response() && !(request.response().ok() || request.response().status() == 304) && !request.redirectChain().length > 0) {
125
+ if (request.response() && !(request.response().ok() || request.response().status() === 304) && !request.redirectChain().length > 0) {
125
126
  errors.push(request);
126
127
  }
127
128
  });
@@ -230,6 +231,12 @@ const _processPage = (async (convertAction, urlOrHtml, options) => {
230
231
  throw new RequestFailedError(errors);
231
232
  }
232
233
 
234
+ // Setup conversion timeout
235
+ if (options.convertTimeout !== undefined) {
236
+ options.timeout = options.convertTimeout;
237
+ delete options.convertTimeout;
238
+ }
239
+
233
240
  // If we're running puppeteer in headless mode, return the converted PDF
234
241
  if (debug === undefined || (typeof debug === 'object' && (debug.headless === undefined || debug.headless))) {
235
242
  return await page[convertAction](options);
@@ -117,7 +117,7 @@ class Grover
117
117
  end
118
118
  options[:cookies] = cookies if cookies.any?
119
119
 
120
- Grover.new(body, options)
120
+ Grover.new(body, **options)
121
121
  end
122
122
 
123
123
  def add_cover_content(grover)
@@ -33,7 +33,7 @@ class Grover
33
33
  def spawn_process
34
34
  @stdin, @stdout, @stderr, @wait_thr = Open3.popen3(
35
35
  'node',
36
- File.expand_path(File.join(__dir__, 'js/processor.js')),
36
+ File.expand_path(File.join(__dir__, 'js/processor.cjs')),
37
37
  chdir: app_root
38
38
  )
39
39
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Grover
4
- VERSION = '1.0.6'
4
+ VERSION = '1.1.2'
5
5
  end
data/lib/grover.rb CHANGED
@@ -32,7 +32,7 @@ class Grover
32
32
  # @param [Hash] options Optional parameters to pass to PDF processor
33
33
  # see https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions
34
34
  #
35
- def initialize(url, options = {})
35
+ def initialize(url, **options)
36
36
  @url = url.to_s
37
37
  @options = OptionsBuilder.new(options, @url)
38
38
  @root_path = @options.delete 'root_path'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grover
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bromwich
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-12 00:00:00.000000000 Z
11
+ date: 2022-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: combine_pdf
@@ -170,7 +170,7 @@ files:
170
170
  - lib/grover/configuration.rb
171
171
  - lib/grover/errors.rb
172
172
  - lib/grover/html_preprocessor.rb
173
- - lib/grover/js/processor.js
173
+ - lib/grover/js/processor.cjs
174
174
  - lib/grover/middleware.rb
175
175
  - lib/grover/options_builder.rb
176
176
  - lib/grover/options_fixer.rb
@@ -180,8 +180,10 @@ files:
180
180
  homepage: https://github.com/Studiosity/grover
181
181
  licenses:
182
182
  - MIT
183
- metadata: {}
184
- post_install_message:
183
+ metadata:
184
+ allowed_push_host: https://rubygems.org
185
+ rubygems_mfa_required: 'true'
186
+ post_install_message:
185
187
  rdoc_options: []
186
188
  require_paths:
187
189
  - lib
@@ -189,18 +191,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
189
191
  requirements:
190
192
  - - ">="
191
193
  - !ruby/object:Gem::Version
192
- version: 2.5.0
194
+ version: 2.6.0
193
195
  - - "<"
194
196
  - !ruby/object:Gem::Version
195
- version: 3.1.0
197
+ version: 3.2.0
196
198
  required_rubygems_version: !ruby/object:Gem::Requirement
197
199
  requirements:
198
200
  - - ">="
199
201
  - !ruby/object:Gem::Version
200
202
  version: '0'
201
203
  requirements: []
202
- rubygems_version: 3.0.6
203
- signing_key:
204
+ rubygems_version: 3.3.7
205
+ signing_key:
204
206
  specification_version: 4
205
207
  summary: A Ruby gem to transform HTML into PDF, PNG or JPEG by wrapping the NodeJS
206
208
  Google Puppeteer driver for Chromium