chromium-pdf 1.0.4 → 1.0.5

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: 00ca3cc4b98adc752f0fc922ef246c613acfb35f915edc90ffb551803ba17d8c
4
- data.tar.gz: 6ac4d6928c6ef664e70b6429fa7b401a0b832a38cbdea17d94feaee3cefe7076
3
+ metadata.gz: 336b560ae2eaddc8c9f1cd78ee40c00ef7f23d28519389e22c39c7b416e17cd5
4
+ data.tar.gz: 630e0e4d8216bda4f451145fca5489d95837a756305eecb68554545956cafbde
5
5
  SHA512:
6
- metadata.gz: 547f1f46062417cdfa4d80da94ce0aa4b1134ebc1a619372380680ecd859861055d3f8aafcd9409bff129de212c8f37096bc07346bde7e21c5a221ae0d1c6528
7
- data.tar.gz: dfc587b51a40b3ec10d122ddb3c5c2dda8c9fb4f4be346ae895211901fd0e69861b738f047319ebf77a85d08e68cf326b5b2dfe0a02da3b57693a5f9a806d9d3
6
+ metadata.gz: edebaf29541cc7061c3d62b3640e301c71ba53ff7b8fe8eb1cc9c2d14ac9ec3a56a12177cf3d86b3332bf739fe391026995d404e064c8f11f240c2ce40b0f1b4
7
+ data.tar.gz: 061ce9e949931e2b76a17672c001f4ef06164324749738165e7d88ee36ae9f7c77a3ae00954b52330ece6c5ff1b6cead31da2f2d4f87b687e17d61e550f31e28
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Chromium
4
4
  module Pdf
5
- VERSION = '1.0.4'
5
+ VERSION = '1.0.5'
6
6
  end
7
7
  end
data/lib/chromium/pdf.rb CHANGED
@@ -29,20 +29,26 @@ module Chromium
29
29
 
30
30
  Dir.mktmpdir do |path|
31
31
  filepath = "#{path}/#{filename}"
32
- chrome_print(print_url, filename, filepath, arguments, &block)
32
+ chrome_print(print_url, filepath, arguments)
33
+ File.open(filepath) do |file|
34
+ block&.call(file, filename)
35
+ end
33
36
  end
34
37
  end
35
38
 
36
39
  protected
37
40
 
38
- def chrome_print(print_url, filename, filepath, arguments, &block)
41
+ def chrome_print(print_url, pdf_path, arguments)
39
42
  chrome_path = ENV.fetch('GOOGLE_CHROME_BIN', 'chrome')
40
- Kernel.system("LD_PRELOAD='' #{chrome_path} --print-to-pdf='#{filepath}' #{arguments.join(' ')} #{print_url}")
41
- sleep 0.1 until file_created?(filepath)
42
-
43
- File.open(filepath) do |file|
44
- block&.call(file, filename)
45
- end
43
+ Kernel.system(
44
+ { 'LD_PRELOAD' => '' },
45
+ chrome_path,
46
+ "--print-to-pdf=#{pdf_path}",
47
+ *arguments,
48
+ print_url
49
+ )
50
+
51
+ sleep 0.1 until file_created?(pdf_path)
46
52
  end
47
53
 
48
54
  def file_created?(filepath)
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.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - RoleModel Software