palapala_pdf 0.1.8 → 0.1.9

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: 717b57250c5722d66ac2310681959abc3ef56498d026b797f13b293077369d2b
4
- data.tar.gz: cef8fc4f830a237020cfa6379add09c40da64c818b1758261d560e5ed3482fdc
3
+ metadata.gz: e9359afef10584362d61be46353495ae97d4ee17a380912fac9ede823fc9d41b
4
+ data.tar.gz: 3c8fce8d86a1fa1e1a9394c7e46eb9fe487669f5d621eabf56cd0ae2c29dd33b
5
5
  SHA512:
6
- metadata.gz: a31ddde9c4617397ff1a1ae13a708dbe4e54085c5d85043bf149bc602b0d6ebc3c1d9ee87d6fa42077146a159b045e398d599c0d3819b64eaeb4e31081afb0dc
7
- data.tar.gz: a064e6622c5eb1737a0baa43a56fff6fd896b69c850b2120a3441b214fd8165ade5988f8bc971a0ddb37a19c900631f6935337e2682a1b8071e5a8c33ecd167c
6
+ metadata.gz: e026b00c0e48fc24a412314a51f612813c2ac6441bee5b48139999dc58ceeec0b9c2807edf0cd0c00cdffb99fbcd0bb6848b2fc53599ed8d51fe286ee3a77155
7
+ data.tar.gz: c759088c15ea39529b7cf9ccdb95dee9af3c7b8bb02c8bc3ab6aef73e59de4e93378cd12f85e7affd3c2c2a7c2c8a476449087d529ce98dfd1aa2806f9119adc
@@ -1,33 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'open3'
4
- require 'pathname'
3
+ # $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
+ require "palapala"
5
5
 
6
- # Run the command and capture the output
7
- puts "Installing latest stable chrome-headless-shell..."
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")
@@ -1,3 +1,3 @@
1
1
  module Palapala
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
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"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: palapala_pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koen Handekyn