gotenberg-ruby 1.0.3 → 1.0.4

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: 1731138f88801603e7ac087f4ca9c12946d0d78b73655f47b61af96002b43ff4
4
- data.tar.gz: f11fc54c6125da4e46eb35b8e7110f94f74a8f705f8331cc67aefbbc6aa4c138
3
+ metadata.gz: 2fa54cb50c0f1acb75b9f60323e2609a58e0dfd9dc24598ea329dfeec6903e26
4
+ data.tar.gz: 473d60ac2f1f4b70d8c53b59032df0fafae5d86ece2d4c5fca7a1e538e93954c
5
5
  SHA512:
6
- metadata.gz: 50b23ee43c4a9b87d704af9e044c14192f0dd2d15ea67048fca0eba328c1f627208ac383cc236e6fbeb1afee95f85998100524e4fa6433c1f54a4c10ce4abb86
7
- data.tar.gz: d7ce697873e1cff4f3d707eb3973c9829e64cff0f3fedd5e9a2fa362679c3bd949a19907ab481cbbde7a2980a2240f856ca22d7611ca048e9f990e9ee3409ca6
6
+ metadata.gz: 71c2f2768d00baad5f44238fb893b721dfe768f399396a6e750f343af49339a76619095d32471a827f21ed31b5fffbbe99d79fd8b536db9bd73185c64096bf23
7
+ data.tar.gz: c6facaf037d8ee62c8deb870565c39a70a5897b64241cdc868147eb117715bd54b20e91b17665fb7f4424de6bf986b9e42681bccbb779e77874e8a12fd5d0911
data/README.md CHANGED
@@ -23,6 +23,21 @@ gem "gotenberg-ruby"
23
23
  * [Send a request to the API](#send-a-request-to-the-api)
24
24
  * [Chromium](#chromium)
25
25
 
26
+ ### Run Gotenberg
27
+
28
+ Run microservice with docker-compose:
29
+
30
+ ```
31
+ version: "3"
32
+
33
+ services:
34
+ gotenberg:
35
+ image: gotenberg/gotenberg:7
36
+ restart: always
37
+ ports:
38
+ - 3000:3000
39
+ ```
40
+
26
41
  ### Send a request to the API
27
42
 
28
43
  After having created the HTTP request (see below), you have two options:
@@ -377,7 +392,7 @@ You may also wait until a given JavaScript expression returns true:
377
392
  ```ruby
378
393
  document = Gotenberg::Chromium.call(ENV['GOTENBERG_URL']) do |doc|
379
394
  doc.html index_html
380
- doc.wait_for_expression("window.status === 'ready'")
395
+ doc.wait_for_expression "window.status === 'ready'"
381
396
  end
382
397
  ```
383
398
 
@@ -6,25 +6,32 @@ module Gotenberg
6
6
 
7
7
  def initialize files
8
8
  @files = files
9
- @backtrace_location = build_backtrace_location
10
9
  end
11
10
 
12
11
  def call
13
- FileUtils.mkdir_p(@backtrace_location)
12
+ return unless index_available?
13
+
14
+ FileUtils.mkdir_p(backtrace_location)
14
15
 
15
16
  files.each do |file|
16
- File.open(File.join(@backtrace_location, file.original_filename), 'wb') do |f|
17
+ File.open(File.join(backtrace_location, file.original_filename), 'wb') do |f|
17
18
  f << file.io.read
18
19
  end
19
20
 
20
21
  file.io.rewind
21
22
  end
22
23
 
23
- ::Launchy.open(File.join(@backtrace_location, 'index.html'))
24
+ ::Launchy.open(File.join(backtrace_location, 'index.html'))
25
+ end
26
+
27
+ private
28
+
29
+ def index_available?
30
+ files.any? { |f| f.original_filename == 'index.html' }
24
31
  end
25
32
 
26
- def build_backtrace_location
27
- File.join(
33
+ def backtrace_location
34
+ @backtrace_location ||= File.join(
28
35
  Gotenberg.configuration.backtrace_dir,
29
36
  "#{Time.now.to_f.to_s.tr('.', '_')}_#{rand(0x100000000).to_s(36)}"
30
37
  )
@@ -1,3 +1,3 @@
1
1
  module Gotenberg
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gotenberg-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sanzstez