grover 0.8.3 → 0.9.1

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 +19 -2
  3. data/lib/grover/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb63906ad329f2f7f882c1e08f0ea5e293256222c4bebd56763b640fde40009e
4
- data.tar.gz: 98fb4e5dae1915d46029035e2e6efbd95553f219825e634fb839e54b6bdb9cd5
3
+ metadata.gz: b14e29e5c34afb7a6e620c20bca6137757df229f8cfa6b34b7e5f21d7051bb83
4
+ data.tar.gz: 32d534d05af4fa9558bf152a42d564749f2dd839c5c1d4d9b6e0c757aee2ad08
5
5
  SHA512:
6
- metadata.gz: 44ba7d7afa0fcfea0402907a7508629af7c9b138fddd5ce6f256ae63e9ea598e0f6dd5ec4f1936b81e5156e973c60800859b35a6cb737110e73ab041a7e42299
7
- data.tar.gz: e5a356493ae64726a03b48b3de7bd39fb7bdf9f40ac4a5fd4449b892f1bed81cca18f36221b4bdcde28cdb84e26189b270f26c496c26f3119487e97441585faf
6
+ metadata.gz: b74b31f57bbb032f3022dd7638f1693adc4b9bc8a0474e7f9f8f8d8697d600b03b391690c28ed01672e5adbe323572541690543713c3490fa631bae1f8b50e6d
7
+ data.tar.gz: e2f91373d7f61d97374c4de1229984747a466b0bb771305b32113fc553b9fc1e9bd762c12d7b8972eca0db6ec001d3672d17bd840ce5487701f1c9df9687afa0
@@ -3,7 +3,7 @@
3
3
  require 'grover/version'
4
4
 
5
5
  require 'grover/utils'
6
- require 'active_support_ext/object/deep_dup'
6
+ require 'active_support_ext/object/deep_dup' unless defined?(ActiveSupport)
7
7
 
8
8
  require 'grover/html_preprocessor'
9
9
  require 'grover/middleware'
@@ -47,10 +47,23 @@ class Grover
47
47
  launchParams.args = launchParams.args.concat(args);
48
48
  }
49
49
 
50
+ // Set executable path if given
51
+ const executablePath = options.executablePath; delete options.executablePath;
52
+ if (executablePath) {
53
+ launchParams.executablePath = executablePath;
54
+ }
55
+
50
56
  // Launch the browser and create a page
51
57
  browser = await puppeteer.launch(launchParams);
52
58
  const page = await browser.newPage();
53
59
 
60
+ // Basic auth
61
+ const username = options.username; delete options.username
62
+ const password = options.password; delete options.password
63
+ if (username != undefined && password != undefined) {
64
+ await page.authenticate({ username, password });
65
+ }
66
+
54
67
  // Set caching flag (if provided)
55
68
  const cache = options.cache; delete options.cache;
56
69
  if (cache != undefined) {
@@ -92,7 +105,11 @@ class Grover
92
105
  // If specified, emulate the media type
93
106
  const emulateMedia = options.emulateMedia; delete options.emulateMedia;
94
107
  if (emulateMedia != undefined) {
95
- await page.emulateMedia(emulateMedia);
108
+ if (typeof page.emulateMediaType == 'function') {
109
+ await page.emulateMediaType(emulateMedia);
110
+ } else {
111
+ await page.emulateMedia(emulateMedia);
112
+ }
96
113
  }
97
114
 
98
115
  // If we're running puppeteer in headless mode, return the converted PDF
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Grover
4
- VERSION = '0.8.3'
4
+ VERSION = '0.9.1'
5
5
  end
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: 0.8.3
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bromwich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-31 00:00:00.000000000 Z
11
+ date: 2019-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: combine_pdf