grover 0.8.1 → 0.8.2

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 +15 -1
  3. data/lib/grover/version.rb +1 -1
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a0324b73710864e876853e8de3ffe71974b5544015b1f602d203b4b409cb6fc
4
- data.tar.gz: 7c27e1acd0b266a69f71c2c2af90d8f0c14ff103ccbc1a28ccf3248854081b56
3
+ metadata.gz: e232f932a73b47f7a830eaeebe3ab16c06dd419dce6fbc694e5cad7b441b922b
4
+ data.tar.gz: 62e570702af04e27975df691e7bbcced93cdb463ec66fa181483052edd2252b1
5
5
  SHA512:
6
- metadata.gz: df27ae8e1291e8d071afdbc7d6eb249776481c245b8f663261bb199f385e712132b6647d6a3e75c46508aec8dc6ed03a8a1b17b10adaaf08154bf97deef5875f
7
- data.tar.gz: 211d0e9eb2ac4d033e9a9bae46fc4319cf618e62f6c380e5f600f80968621bef40365bbebadf93b2451a7ea8964b6abda83b11278edc08426b952ec3e5f297db
6
+ metadata.gz: 46edb9edd4ed1b0b6ef9746eeb02b6961aa70bf94fabaea45c2192af5c60a27fcefd91d2c927297b51ddfa48c43f11052802e88094b51f1bcddd2acf9f3516aa
7
+ data.tar.gz: a3d53ae3abe6afe3a0e0086fe842f0092d9c3df0ed92836182039534ca7f603d7ee9af8e1b5b1a43b500a23f50c5f1dac1066b52fb95cef1b943ff5b6e469abb
@@ -11,6 +11,7 @@ require 'grover/configuration'
11
11
 
12
12
  require 'nokogiri'
13
13
  require 'schmooze'
14
+ require 'yaml'
14
15
 
15
16
  #
16
17
  # Grover interface for converting HTML to PDF
@@ -23,7 +24,7 @@ class Grover
23
24
  dependencies puppeteer: 'puppeteer'
24
25
 
25
26
  def self.launch_params
26
- ENV['GROVER_NO_SANDBOX'] == 'true' ? "{args: ['--no-sandbox', '--disable-setuid-sandbox']}" : '{}'
27
+ ENV['GROVER_NO_SANDBOX'] == 'true' ? "{args: ['--no-sandbox', '--disable-setuid-sandbox']}" : '{args: []}'
27
28
  end
28
29
 
29
30
  def self.convert_function(convert_action)
@@ -40,6 +41,12 @@ class Grover
40
41
  if (debug.devtools != undefined) { launchParams.devtools = debug.devtools; }
41
42
  }
42
43
 
44
+ // Configure additional launch arguments
45
+ const args = options.launchArgs; delete options.launchArgs;
46
+ if (Array.isArray(args)) {
47
+ launchParams.args = launchParams.args.concat(args);
48
+ }
49
+
43
50
  // Launch the browser and create a page
44
51
  browser = await puppeteer.launch(launchParams);
45
52
  const page = await browser.newPage();
@@ -234,6 +241,7 @@ class Grover
234
241
 
235
242
  fix_boolean_options! combined
236
243
  fix_numeric_options! combined
244
+ fix_array_options! combined
237
245
 
238
246
  combined
239
247
  end
@@ -278,6 +286,12 @@ class Grover
278
286
  options['scale'] = options['scale'].to_f
279
287
  end
280
288
 
289
+ def fix_array_options!(options)
290
+ return unless options['launch_args'].is_a? String
291
+
292
+ options['launch_args'] = YAML.safe_load options['launch_args']
293
+ end
294
+
281
295
  def normalized_options(path:)
282
296
  normalized_options = Utils.normalize_object @options
283
297
  normalized_options['path'] = path if path.is_a? ::String
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Grover
4
- VERSION = '0.8.1'
4
+ VERSION = '0.8.2'
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.1
4
+ version: 0.8.2
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-07-12 00:00:00.000000000 Z
11
+ date: 2019-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: combine_pdf
@@ -179,7 +179,7 @@ files:
179
179
  - lib/grover/middleware.rb
180
180
  - lib/grover/utils.rb
181
181
  - lib/grover/version.rb
182
- homepage: http://github.com/Studiosity/grover
182
+ homepage: https://github.com/Studiosity/grover
183
183
  licenses:
184
184
  - MIT
185
185
  metadata: {}
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  - !ruby/object:Gem::Version
199
199
  version: '0'
200
200
  requirements: []
201
- rubygems_version: 3.0.3
201
+ rubygems_version: 3.0.6
202
202
  signing_key:
203
203
  specification_version: 4
204
204
  summary: A Ruby gem to transform HTML into PDF, PNG or JPEG by wrapping the NodeJS