Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix semver regex #26

Merged
merged 2 commits into from
Jul 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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