postdoc 0.3.3 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 866cf4c6e0cfe521087c96c5aea85b003a139d55467ccd77e757c6c45084cb17
4
- data.tar.gz: c2789db75c33ede4a402e06c815d7e9a33689960d53773940fca96f350ec1f2c
3
+ metadata.gz: 4a8f25b2dcb78fb58ec199d021985eef4e9892c55cba5ad9b33b8a1aea14baba
4
+ data.tar.gz: f2ef8f9083917b3efbd212cdbc7a25c7f574db1a1a963bacf0a194151f2f8fbe
5
5
  SHA512:
6
- metadata.gz: d8fedb4b38ebc3fbb45577423c478211c7d801bb917742b2493c1f57869b51aaba1877efac94383e1fbdfb77bd07d3c0ec5eb9edb2a8e6f732453045e865a797
7
- data.tar.gz: af3070ea0e915b3f44349f926e5fe08d1c2270f4bc7143a1352145a679e0882392b5f1e02800e6a7240612c16fa182fa1282424262498e171d89a6b7726d656b
6
+ metadata.gz: 166ca4c618a7740e02edda59711e1b23a5555e2c4d479ac00b71d6d9dda9c613fdbbd125fe0053f75405881c21e7b31f9494ef5df997cd3afe32b1486b403997
7
+ data.tar.gz: 963c118d472a7d244fc4841bae66151f211804e796a1a1d8be3f3d1dae25a9f5274122c867abe99cd565a3bfc457a4516b94ce8065866fb929918226331816ce
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Postdoc
3
4
  class ChromeProcess
4
5
  attr_reader :pid, :port
@@ -11,13 +12,15 @@ module Postdoc
11
12
 
12
13
  def alive?
13
14
  @alive ||= test_socket!
14
- rescue
15
+ rescue Errno::ECONNREFUSED
15
16
  false
16
17
  end
17
18
 
18
19
  def kill
19
- Process.kill 'KILL', pid
20
+ Process.kill 'INT', pid
20
21
  Process.wait pid
22
+ rescue
23
+ true
21
24
  end
22
25
 
23
26
  def client
@@ -9,6 +9,7 @@ module Postdoc
9
9
  def initialize(port)
10
10
  @port = port
11
11
  100.times { setup_connection_or_wait && break }
12
+ raise 'ChromeClient couldn\'t launch' if @client.blank?
12
13
  end
13
14
 
14
15
  def print_pdf_from_html(file_path,
@@ -25,11 +26,15 @@ module Postdoc
25
26
  printBackground: true,
26
27
  marginTop: options[:margin_top] || 1,
27
28
  marginBottom: options[:margin_bottom] || 1,
29
+ marginLeft: options[:margin_left] || 1,
30
+ marginRight: options[:margin_right] || 1,
28
31
  displayHeaderFooter: !!(header_template || footer_template),
29
32
  headerTemplate: header_template || '',
30
33
  footerTemplate: footer_template || ''
31
34
  }
32
35
 
36
+ client.send_cmd 'Browser.close'
37
+
33
38
  Base64.decode64 response['data']
34
39
  end
35
40
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Groeneveld
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-03 00:00:00.000000000 Z
11
+ date: 2021-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chrome_remote