pdfgen 0.4.1 → 0.4.2

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
  SHA1:
3
- metadata.gz: c60d3bdf99d2a23532c9087bdb757b7f8987a6e2
4
- data.tar.gz: 8a8b1dd3a3b8d7ce0b69109ff027eb6994bd8757
3
+ metadata.gz: 8e28174877f0b28647fd1653c187ecf4bd0fe3b7
4
+ data.tar.gz: 98e2bbed6e8f2d4bf6252432f612e2cabee4540f
5
5
  SHA512:
6
- metadata.gz: 774d4eaba9e179e1ab14cd04212232dceda6be0b82c0620174e17455eab4b9053910f0a149070ffc5af0fb7b54e3957575d45805d9ae12fb729a967b8df0be14
7
- data.tar.gz: dccd796d164aa84040e6a4acf8a9808819cc309b2fa0e41878d289865aada2574fd02c6ee4983dac0ba0eca6d83c1c1331000d65dd54545f4ddc42bde947e944
6
+ metadata.gz: a47ffc3ad2f07bee137731ec1187da17e3c5b601ba0797ff6cf3b6613037f096bf8ca217dcf23165fa3a9a16a24a861e810c281dab84279b972bf332247351ac
7
+ data.tar.gz: 4bdb05250de0ec74f63dbf913387957add058f2c82d693c5a12a5237cf324389631da9bb848d82f288a529f74117addaca8c73519937c927cbcb9c88aff1434e
@@ -1,3 +1,17 @@
1
+ ## Pdfgen 0.4.2 (June 8, 2018)
2
+
3
+ * Adds checking of minimum Node version required.
4
+
5
+ Need to soon add testing for different versions of Node to discover what the
6
+ compatible versions are.
7
+
8
+ * Adds handling of any unhandled rejection by logging the error and then exiting.
9
+
10
+ This change provides better error messaged from Node and also prevents the process
11
+ from hanging and not exiting when there was an error.
12
+
13
+ * Fixes bug where launch options were no longer being passed to the Javascript.
14
+
1
15
  ## Pdfgen 0.4.1 (May 15, 2018)
2
16
 
3
17
  * Fixes bug with regex that checks if a URL was passed.
data/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
  A tool for creating PDFs using [Puppeteer](https://github.com/GoogleChrome/puppeteer) and headless Chrome.
3
3
 
4
4
  # Dependencies
5
- This gem requires that node be installed along with puppeteer.
5
+ This gem requires:
6
+ * Node v7.6 or greater
7
+ * Puppeteer (tested with v1.3.0)
6
8
 
7
9
  ### OSX (Homebrew)
8
10
  To install node on OSX you can use Homebrew:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -4,6 +4,12 @@ var stdin = process.stdin,
4
4
  stdout = process.stdout,
5
5
  inputChunks = [];
6
6
 
7
+ // Exit if we have any unhandled rejections
8
+ process.on('unhandledRejection', (err) => {
9
+ console.error(err)
10
+ process.exit(1)
11
+ })
12
+
7
13
  stdin.resume();
8
14
  stdin.setEncoding('utf8');
9
15
 
@@ -58,7 +64,7 @@ stdin.on('end', function () {
58
64
  const pdf_output = await page.pdf(pdf_options);
59
65
  stdout.write(pdf_output);
60
66
  }
61
-
67
+
62
68
  await browser.close();
63
69
  })();
64
70
  });
@@ -3,8 +3,11 @@
3
3
  require 'open3'
4
4
  require 'json'
5
5
 
6
- _, status = Open3.capture2('node', '-v')
7
- raise 'This gem requires node be installed and available on the PATH' unless status.success?
6
+ MIN_REQUIRED_NODE_VERSION = '7.6'
7
+
8
+ node_version, status = Open3.capture2('node', '-v')
9
+ raise 'This gem requires Node be installed and available on the PATH' unless status.success?
10
+ raise "This gem requires Node v#{MIN_REQUIRED_NODE_VERSION} or greater but found Node #{node_version}" unless Gem::Version.new(node_version[1..-1]) > Gem::Version.new(MIN_REQUIRED_NODE_VERSION)
8
11
 
9
12
  MAKE_PDF_COMMAND = File.expand_path('../javascript_bin/make_pdf.js', __FILE__)
10
13
 
@@ -66,6 +69,8 @@ class Pdfgen
66
69
  stdin_options = stdin_options.merge(wait_for_timeout: @debug_time)
67
70
  stdin_options = stdin_options.merge(launch_options: @launch_options.merge(headless: false))
68
71
  stdin_options = stdin_options.merge(debug_mode: true)
72
+ else
73
+ stdin_options = stdin_options.merge(launch_options: @launch_options)
69
74
  end
70
75
 
71
76
  pdf_output = nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdfgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Fox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-15 00:00:00.000000000 Z
11
+ date: 2018-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest