postdoc 0.3.3 → 0.3.7
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 +4 -4
- data/lib/postdoc/chrome_process.rb +5 -2
- data/lib/postdoc/client.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a8f25b2dcb78fb58ec199d021985eef4e9892c55cba5ad9b33b8a1aea14baba
|
|
4
|
+
data.tar.gz: f2ef8f9083917b3efbd212cdbc7a25c7f574db1a1a963bacf0a194151f2f8fbe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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 '
|
|
20
|
+
Process.kill 'INT', pid
|
|
20
21
|
Process.wait pid
|
|
22
|
+
rescue
|
|
23
|
+
true
|
|
21
24
|
end
|
|
22
25
|
|
|
23
26
|
def client
|
data/lib/postdoc/client.rb
CHANGED
|
@@ -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.
|
|
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-
|
|
11
|
+
date: 2021-07-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: chrome_remote
|