mjml-ruby 0.3.1 → 0.3.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mjml.rb +22 -2
  3. data/lib/mjml/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ba7fc3cc0aabe383a5e0bc9ab26d0db578c6be4
4
- data.tar.gz: 5abe4f8865c359ca7d48b8358a2d8e00072821c7
3
+ metadata.gz: 9c9e4150ac8fe5cb4bb08f9c2683c97475852ce5
4
+ data.tar.gz: 38c53d13d992ac0cf6b9658deea44534d7c4d7df
5
5
  SHA512:
6
- metadata.gz: e2e18a0b5b5c60a54852298608f526df2e33bf1b2f353367ce579f79b2294624092bc7c51484a0f674d92d5d8d8a6a21b3c32fbc51ecaadde6c4f130b1a65580
7
- data.tar.gz: b986c40bb3e890375ddcbaa62d6d5a745b127635b0d19cc19dbb7329a6315a2ca0ed2073506cd58fe774395f3f571b82321feb7141f7de274659799a6eb6deb0
6
+ metadata.gz: 00cbd9d6a0d94155cc57b6e5a9fc054500115523bb8a99e76a132f1b77d96879df654a25b34a9298fbed9f5ccd866280f40dc190d32453cd391f6d6832f849e5
7
+ data.tar.gz: 0a933ed31c1aed41956ff0f30b8af8197ebddcf138dcbbcc775d9bc900877dc84e1eb9e30ec85e0434ddf0e67623569e2c9cf87aabc561596bb48ef36cd0337c
@@ -8,7 +8,8 @@ module MJML
8
8
  # Constants
9
9
  MIME_TYPE = 'text/mjml'.freeze
10
10
  EXTENSION = '.mjml'.freeze
11
- VERSION_REGEX = /^\d\.\d\.\d/i
11
+ VERSION_3_REGEX = /^(\d\.\d\.\d)/i
12
+ VERSION_4_REGEX = /^mjml-cli: (\d\.\d\.\d)/i
12
13
 
13
14
  extend Dry::Configurable
14
15
  # Available settings
@@ -41,7 +42,26 @@ module MJML
41
42
 
42
43
  def self.extract_executable_version
43
44
  ver, _status = Open3.capture2(config.bin_path, '-V')
44
- (ver =~ VERSION_REGEX).nil? ? nil : ver
45
+
46
+ # mjml 3.x outputs version directly:
47
+ # 3.3.5
48
+ # --> just take this as the version
49
+
50
+ # mjml 4.x outputs two rows:
51
+ # mjml-core: 4.0.0
52
+ # mjml-cli: 4.0.0
53
+ # --> we take the second number as the version, since we call the cli
54
+
55
+ case ver.count("\n")
56
+ when 1
57
+ # one line, mjml 3.x
58
+ match = ver.match(VERSION_3_REGEX)
59
+ when 2
60
+ # two lines, might be 4.x
61
+ match = ver.match(VERSION_4_REGEX)
62
+ end
63
+
64
+ match.nil? ? nil : match[1]
45
65
  end
46
66
 
47
67
  def self.logger
@@ -1,3 +1,3 @@
1
1
  module MJML
2
- VERSION = '0.3.1'.freeze
2
+ VERSION = '0.3.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mjml-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mykola Basov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-25 00:00:00.000000000 Z
11
+ date: 2018-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable