grover 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/grover.rb +11 -9
  3. data/lib/grover/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31b9ab92a300720d35d5637e2a2462ec6e7dd733
4
- data.tar.gz: b1cbe61e0db5eb406ed7991881c0702c14a059e4
3
+ metadata.gz: 3499ca1308bdc11b92605c7f1efb995f64f873ef
4
+ data.tar.gz: 4cf09e30a261f9f343369b954e7e51512fb11773
5
5
  SHA512:
6
- metadata.gz: 9ade3e9c3f35ea52efc2292a842645e7e3c7f46030bf1142c7cfddafa69588bf3ea13bcfcf469130c281c5c4050d01c3348e1c002a28cbb740f87586e61b9b51
7
- data.tar.gz: 4ec082e7a6cd7bce6e8d3dcf429ca86dc1b82a16d56f9fcb21f7b63b5f850e8e3033509da317c0833625d05ad9aa1da8524d730fd21ffc06e06895abf254f8f5
6
+ metadata.gz: f03c61dd07b4a9bd6698caad36fc9c60a1e2e07a7613c35b7e21166eacfe15c57ba65be64ce97045927b623075d4434d80d7e6bedbe17f79189dc5f90ed2b54a
7
+ data.tar.gz: ac097fe4fee335a54e06ed9cb12b1025463467fdddc918f8e113c6345fa73f72eb97f42bc8814e3cf29bb70f434b05afd674668706237e24c051778ee61b8c30
data/lib/grover.rb CHANGED
@@ -21,28 +21,30 @@ class Grover
21
21
  dependencies puppeteer: 'puppeteer'
22
22
 
23
23
  def self.launch_params
24
- ENV['CI'] == 'true' ? "{args: ['--no-sandbox', '--disable-setuid-sandbox']}" : '{}'
24
+ ENV['CI'] == 'true' ? "{args: ['--no-sandbox', '--disable-setuid-sandbox']}" : ''
25
25
  end
26
26
 
27
27
  method :convert_pdf, Utils.squish(<<-FUNCTION)
28
28
  async (url, options) => {
29
29
  let browser;
30
30
  try {
31
- let launch_params = #{launch_params};
32
- const timeout = options.timeout; delete options.timeout;
33
- if (timeout) {
34
- launch_params.timeout = timeout;
35
- }
36
- browser = await puppeteer.launch(launch_params);
31
+ browser = await puppeteer.launch(#{launch_params});
37
32
  const page = await browser.newPage();
38
33
 
39
34
  const cache = options.cache; delete options.cache;
40
35
  await page.setCacheEnabled(cache);
41
36
 
37
+ let request_options = {};
38
+ const timeout = options.timeout; delete options.timeout;
39
+ if (timeout) {
40
+ request_options.timeout = timeout;
41
+ }
42
42
  if (url.match(/^http/i)) {
43
- await page.goto(url, { waitUntil: 'networkidle2' });
43
+ request_options.waitUntil = 'networkidle2';
44
+ await page.goto(url, request_options);
44
45
  } else {
45
- await page.goto(`data:text/html,${url}`, { waitUntil: 'networkidle0' });
46
+ request_options.waitUntil = 'networkidle0';
47
+ await page.goto(`data:text/html,${url}`, request_options);
46
48
  }
47
49
 
48
50
  const emulateMedia = options.emulateMedia; delete options.emulateMedia;
@@ -1,3 +1,3 @@
1
1
  class Grover
2
- VERSION = '0.5.3'.freeze
2
+ VERSION = '0.5.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bromwich