Merge pull request #6820 from vitorgalvao/cask-version-mmp-regex

cask version MAJOR_MINOR_PATCH_REGEX: allow any word character instead of only digits
This commit is contained in:
Markus Reiter 2019-12-09 04:14:11 +01:00 committed by GitHub
commit 2fe99bd982
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 25 deletions

View File

@ -11,7 +11,7 @@ module Cask
DIVIDER_REGEX = /(#{DIVIDERS.keys.map { |v| Regexp.quote(v) }.join('|')})/.freeze DIVIDER_REGEX = /(#{DIVIDERS.keys.map { |v| Regexp.quote(v) }.join('|')})/.freeze
MAJOR_MINOR_PATCH_REGEX = /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?/.freeze MAJOR_MINOR_PATCH_REGEX = /^([^.,:]+)(?:\.([^.,:]+)(?:\.([^.,:]+))?)?/.freeze
INVALID_CHARACTERS = /[^0-9a-zA-Z\.\,\:\-\_]/.freeze INVALID_CHARACTERS = /[^0-9a-zA-Z\.\,\:\-\_]/.freeze

View File

@ -88,7 +88,7 @@ describe Cask::DSL::Version, :cask do
"1" => "1", "1" => "1",
"1.2" => "1", "1.2" => "1",
"1.2.3" => "1", "1.2.3" => "1",
"1.2.3_4-5" => "1" "1.2.3-4,5:6" => "1"
end end
describe "#minor" do describe "#minor" do
@ -96,7 +96,7 @@ describe Cask::DSL::Version, :cask do
"1" => "", "1" => "",
"1.2" => "2", "1.2" => "2",
"1.2.3" => "2", "1.2.3" => "2",
"1.2.3_4-5" => "2" "1.2.3-4,5:6" => "2"
end end
describe "#patch" do describe "#patch" do
@ -104,7 +104,7 @@ describe Cask::DSL::Version, :cask do
"1" => "", "1" => "",
"1.2" => "", "1.2" => "",
"1.2.3" => "3", "1.2.3" => "3",
"1.2.3_4-5" => "3" "1.2.3-4,5:6" => "3-4"
end end
describe "#major_minor" do describe "#major_minor" do
@ -112,7 +112,7 @@ describe Cask::DSL::Version, :cask do
"1" => "1", "1" => "1",
"1.2" => "1.2", "1.2" => "1.2",
"1.2.3" => "1.2", "1.2.3" => "1.2",
"1.2.3_4-5" => "1.2" "1.2.3-4,5:6" => "1.2"
end end
describe "#major_minor_patch" do describe "#major_minor_patch" do
@ -120,7 +120,7 @@ describe Cask::DSL::Version, :cask do
"1" => "1", "1" => "1",
"1.2" => "1.2", "1.2" => "1.2",
"1.2.3" => "1.2.3", "1.2.3" => "1.2.3",
"1.2.3_4-5" => "1.2.3" "1.2.3-4,5:6" => "1.2.3-4"
end end
describe "#minor_patch" do describe "#minor_patch" do
@ -128,7 +128,7 @@ describe Cask::DSL::Version, :cask do
"1" => "", "1" => "",
"1.2" => "2", "1.2" => "2",
"1.2.3" => "2.3", "1.2.3" => "2.3",
"1.2.3_4-5" => "2.3" "1.2.3-4,5:6" => "2.3-4"
end end
describe "#before_comma" do describe "#before_comma" do