Skip to content

Commit

Permalink
Merge pull request #26 from m-basov/fix-mjml-regex
Browse files Browse the repository at this point in the history
Fix semver regex
  • Loading branch information
m-basov authored Jul 4, 2021
2 parents b6998b8 + 939b135 commit 6ae18dc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/mjml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class BinaryNotFound < StandardError; end
# Constants
MIME_TYPE = 'text/mjml'.freeze
EXTENSION = '.mjml'.freeze
VERSION_3_REGEX = /^(\d\.\d\.\d)/i
VERSION_4_REGEX = /^mjml-cli: (\d\.\d\.\d)/i
VERSION_3_REGEX = /^(\d+\.\d+\.\d+)/i
VERSION_4_REGEX = /^mjml-cli: (\d+\.\d+\.\d+)/i

# Available settings
module Config
Expand Down
2 changes: 1 addition & 1 deletion lib/mjml/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module MJML
VERSION = '0.4.0'.freeze
VERSION = '0.4.1'.freeze
end
8 changes: 8 additions & 0 deletions spec/mjml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,13 @@

MJML::Config.bin_path = bin_path
end

it 'should work with multi-digit versions' do
version = '3.10.235'.match(MJML::VERSION_3_REGEX)
_(version[1]).must_equal('3.10.235')

version = "mjml-core: 4.10.235\nmjml-cli: 4.10.235".match(MJML::VERSION_4_REGEX)
_(version[1]).must_equal('4.10.235')
end
end
end

0 comments on commit 6ae18dc

Please sign in to comment.