palapala_pdf 0.1.8 → 0.1.9
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/bin/chrome-headless-server +7 -29
- data/lib/palapala/chrome_process.rb +0 -1
- data/lib/palapala/version.rb +1 -1
- data/lib/palapala.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9359afef10584362d61be46353495ae97d4ee17a380912fac9ede823fc9d41b
|
4
|
+
data.tar.gz: 3c8fce8d86a1fa1e1a9394c7e46eb9fe487669f5d621eabf56cd0ae2c29dd33b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e026b00c0e48fc24a412314a51f612813c2ac6441bee5b48139999dc58ceeec0b9c2807edf0cd0c00cdffb99fbcd0bb6848b2fc53599ed8d51fe286ee3a77155
|
7
|
+
data.tar.gz: c759088c15ea39529b7cf9ccdb95dee9af3c7b8bb02c8bc3ab6aef73e59de4e93378cd12f85e7affd3c2c2a7c2c8a476449087d529ce98dfd1aa2806f9119adc
|
data/bin/chrome-headless-server
CHANGED
@@ -1,33 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
require
|
3
|
+
# $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
|
4
|
+
require "palapala"
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
output, status = Open3.capture2('npx --yes @puppeteer/browsers install chrome-headless-shell@stable')
|
9
|
-
|
10
|
-
if status.success?
|
11
|
-
# Extract the path from the output
|
12
|
-
result = output.lines.find { |line| line.include?("chrome-headless-shell@") }
|
13
|
-
if result.nil?
|
14
|
-
puts "Failed to install chrome-headless-shell"
|
15
|
-
exit 1
|
16
|
-
end
|
17
|
-
_, chrome_path = result.split(' ', 2).map(&:strip)
|
18
|
-
|
19
|
-
# Directory you want the relative path from (current working directory)
|
20
|
-
base_dir = Dir.pwd
|
21
|
-
|
22
|
-
# Convert absolute path to relative path
|
23
|
-
relative_path = Pathname.new(chrome_path).relative_path_from(Pathname.new(base_dir)).to_s
|
24
|
-
|
25
|
-
puts "Launching chrome-headless-shell at #{relative_path}"
|
26
|
-
# Display the version
|
27
|
-
system("#{chrome_path} --version")
|
28
|
-
# Launch chrome-headless-shell with the --remote-debugging-port parameter
|
29
|
-
exec("#{chrome_path} --remote-debugging-port=9222")
|
30
|
-
else
|
31
|
-
puts "Failed to install chrome-headless-shell"
|
32
|
-
exit 1
|
6
|
+
Palapala.setup do |config|
|
7
|
+
config.debug = true
|
33
8
|
end
|
9
|
+
|
10
|
+
pid = Palapala::ChromeProcess.spawn_chrome_headless_server
|
11
|
+
Process.wait(pid)
|
@@ -83,7 +83,6 @@ module Palapala
|
|
83
83
|
system("#{chrome_path} --version") if Palapala.debug
|
84
84
|
# Launch chrome-headless-shell with the --remote-debugging-port parameter
|
85
85
|
if Palapala.debug
|
86
|
-
puts "spawning with output"
|
87
86
|
spawn(chrome_path, "--remote-debugging-port=9222", "--disable-gpu")
|
88
87
|
else
|
89
88
|
spawn(chrome_path, "--remote-debugging-port=9222", "--disable-gpu", out: "/dev/null", err: "/dev/null")
|
data/lib/palapala/version.rb
CHANGED
data/lib/palapala.rb
CHANGED
@@ -25,10 +25,12 @@ module Palapala
|
|
25
25
|
# Chrome headless shell version to use
|
26
26
|
attr_accessor :chrome_headless_shell_version
|
27
27
|
end
|
28
|
-
|
28
|
+
puts "setting defaults on palapala"
|
29
29
|
self.debug = false
|
30
30
|
self.defaults = { displayHeaderFooter: true, encoding: :binary }
|
31
31
|
self.headless_chrome_path = nil
|
32
32
|
self.headless_chrome_url = "http://localhost:9222"
|
33
|
-
self.chrome_headless_shell_version = "stable"
|
33
|
+
self.chrome_headless_shell_version = ENV.fetch("CHROME_HEADLESS_SHELL_VERSION", "stable")
|
34
34
|
end
|
35
|
+
|
36
|
+
puts "hoo"
|