mjml-rails 4.7.1 → 4.8.0

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: ebd64fc82073044b83d2bd5096e1355b090787801ad1fb6c9b23249e231bd45f
4
- data.tar.gz: 886fdabc4294dfe23a5f6d19d1540461b167a6842fff7ea857c5e11439a5ea08
3
+ metadata.gz: 79d635939113a77bdcfa96934cafa71e52a13c71171eb36c138250952e0df2de
4
+ data.tar.gz: 5943d70d89ef0d1ce8ba63c32dd72e6837982938b4fbe59e6e4cf5088f04b16b
5
5
  SHA512:
6
- metadata.gz: d51cfa58a1add61294b64065073896162198037a31866f0642cf2b7203cbcdb29809ae1e02d2f7b307b0a1741b539c1d7d88162739de1105cc8ab70a32c45417
7
- data.tar.gz: 6f5ea97fbf1e47526fbf5c205ab72ef0cb91c567a44b64d8db62755056a2be4c699b951e49c9668ec6fbe18fd73cbb2947eaed6b423416d3fb0cb25326d5b3d5
6
+ metadata.gz: 00a5e9270464c12f16f0b7b8f3e32dc9c0c20413d34063c33c4b86bec08eb7df1c2d5ae20beb61d9f708242203c6c33b663652a207e135ef658cc6636497dcec
7
+ data.tar.gz: bab11c714982bca667864e180e9c6066c4a22221dff010a19ffd179b25f79dff8a9de4809af5217ec82d62291835aecf231d79b6ecd255f5bd71e4ba3829365e
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/mjml/parser.rb CHANGED
@@ -41,7 +41,12 @@ module Mjml
41
41
  command = "-r #{in_tmp_file} -o #{out_tmp_file.path} " \
42
42
  "--config.beautify #{beautify} --config.minify #{minify} --config.validationLevel #{validation_level}"
43
43
  _, stderr, status = Mjml.run_mjml(command)
44
- raise ParseError, stderr.chomp unless status.success?
44
+
45
+ unless status.success?
46
+ # The process status ist quite helpful in case of dying processes without STDERR output.
47
+ # Node exit codes are documented here: https://node.readthedocs.io/en/latest/api/process/#exit-codes
48
+ raise ParseError, "#{stderr.chomp}\n(process status: #{status})"
49
+ end
45
50
 
46
51
  Mjml.logger.warn(stderr.chomp) if stderr.present?
47
52
  out_tmp_file.read
data/lib/mjml/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mjml
4
4
  # Version number no longer matches MJML.io version
5
- VERSION = '4.7.1'
5
+ VERSION = '4.8.0'
6
6
  end
data/lib/mjml.rb CHANGED
@@ -71,9 +71,9 @@ module Mjml
71
71
 
72
72
  def self.check_for_yarn_mjml_binary
73
73
  yarn_bin = `which yarn`.chomp
74
- return if yarn_bin.blank?
74
+ return unless yarn_bin.present? && (installer_path = bin_path_from(yarn_bin)).present?
75
75
 
76
- mjml_bin = "#{yarn_bin} run mjml"
76
+ mjml_bin = File.join(installer_path, 'mjml')
77
77
  return mjml_bin if check_version(mjml_bin)
78
78
  end
79
79
 
data/test/parser_test.rb CHANGED
@@ -66,9 +66,16 @@ describe Mjml::Parser do
66
66
 
67
67
  describe '#run' do
68
68
  describe 'when shell command failed' do
69
+ let(:error_msg) do
70
+ expect { parser.run '/tmp/non_existent_file.mjml' }.must_raise(Mjml::Parser::ParseError).message
71
+ end
72
+
69
73
  it 'raises exception' do
70
- err = expect { parser.run '/tmp/non_existent_file.mjml' }.must_raise(Mjml::Parser::ParseError)
71
- expect(err.message).must_include 'Command line error'
74
+ expect(error_msg).must_include 'Command line error'
75
+ end
76
+
77
+ it 'includes process status' do
78
+ expect(error_msg).must_match(/\(process status: .+\)/)
72
79
  end
73
80
  end
74
81
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mjml-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.1
4
+ version: 4.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Loffler
@@ -35,7 +35,7 @@ cert_chain:
35
35
  R9NsaxhBfawJEJcYoPZflGkLjJU8pjSuvIW5+rNgAiqY8D37hTtZMu/n2Fz8Qp24
36
36
  7EZetZmcvBzARf8vQSJjga3y0Bftk8u7LmblOEWddzE=
37
37
  -----END CERTIFICATE-----
38
- date: 2021-12-21 00:00:00.000000000 Z
38
+ date: 2022-10-02 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: byebug
metadata.gz.sig CHANGED
Binary file