chromium-pdf 1.0.5 → 1.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 336b560ae2eaddc8c9f1cd78ee40c00ef7f23d28519389e22c39c7b416e17cd5
4
- data.tar.gz: 630e0e4d8216bda4f451145fca5489d95837a756305eecb68554545956cafbde
3
+ metadata.gz: afa7368ea8f9d35e2b64a1e8b19746e0197c5a78788693c6c8c193cf7a6b6095
4
+ data.tar.gz: bde5ed7f8ad0f0ef810466f9f3ff687e4087a6424acb9c01dff092e985a105ec
5
5
  SHA512:
6
- metadata.gz: edebaf29541cc7061c3d62b3640e301c71ba53ff7b8fe8eb1cc9c2d14ac9ec3a56a12177cf3d86b3332bf739fe391026995d404e064c8f11f240c2ce40b0f1b4
7
- data.tar.gz: 061ce9e949931e2b76a17672c001f4ef06164324749738165e7d88ee36ae9f7c77a3ae00954b52330ece6c5ff1b6cead31da2f2d4f87b687e17d61e550f31e28
6
+ metadata.gz: 6531912997d2a24850bb7d707d7464e71f26705a875e4ded22548e13310d55bf641c30d3cf28c73a00e2c87952e06dab1e9e6d8a17ed2c9eb9ca02bbc329e5a9
7
+ data.tar.gz: b3f8184f00a4a9f101a64d050a87708378227692614f806f26643d896d50ef10f3cad32d8c755499c9c2ff41415a67bae637443edca6b62735af783089b23eab
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Chromium
4
4
  module Pdf
5
- VERSION = '1.0.5'
5
+ VERSION = '1.0.6'
6
6
  end
7
7
  end
data/lib/chromium/pdf.rb CHANGED
@@ -29,7 +29,8 @@ module Chromium
29
29
 
30
30
  Dir.mktmpdir do |path|
31
31
  filepath = "#{path}/#{filename}"
32
- chrome_print(print_url, filepath, arguments)
32
+ chrome_print!(print_url, filepath, arguments)
33
+
33
34
  File.open(filepath) do |file|
34
35
  block&.call(file, filename)
35
36
  end
@@ -38,17 +39,16 @@ module Chromium
38
39
 
39
40
  protected
40
41
 
41
- def chrome_print(print_url, pdf_path, arguments)
42
+ def chrome_print!(print_url, pdf_path, arguments)
42
43
  chrome_path = ENV.fetch('GOOGLE_CHROME_BIN', 'chrome')
43
44
  Kernel.system(
44
45
  { 'LD_PRELOAD' => '' },
45
46
  chrome_path,
46
- "--print-to-pdf=#{pdf_path}",
47
47
  *arguments,
48
- print_url
48
+ "--print-to-pdf=#{pdf_path}",
49
+ print_url,
50
+ exception: true
49
51
  )
50
-
51
- sleep 0.1 until file_created?(pdf_path)
52
52
  end
53
53
 
54
54
  def file_created?(filepath)
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GeneratePdfJob < ApplicationJob
4
- JobTimeoutError = Class.new(StandardError)
4
+ class JobTimeoutError < StandardError
5
+ end
5
6
  include GoodJob::ActiveJobExtensions::Concurrency
6
7
  include Chromium::Pdf
7
8
 
@@ -16,9 +17,7 @@ class GeneratePdfJob < ApplicationJob
16
17
  )
17
18
 
18
19
  around_perform do |_job, block|
19
- Timeout.timeout(180.seconds, JobTimeoutError) do
20
- block.call
21
- end
20
+ Timeout.timeout(180.seconds, JobTimeoutError, &block)
22
21
  end
23
22
 
24
23
  def perform(model)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chromium-pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - RoleModel Software