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
MAJOR_MINOR_PATCH_REGEX = /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?/.freeze
MAJOR_MINOR_PATCH_REGEX = /^([^.,:]+)(?:\.([^.,:]+)(?:\.([^.,:]+))?)?/.freeze
INVALID_CHARACTERS = /[^0-9a-zA-Z\.\,\:\-\_]/.freeze

View File

@ -85,50 +85,50 @@ describe Cask::DSL::Version, :cask do
describe "string manipulation helpers" do
describe "#major" do
include_examples "version expectations hash", :major,
"1" => "1",
"1.2" => "1",
"1.2.3" => "1",
"1.2.3_4-5" => "1"
"1" => "1",
"1.2" => "1",
"1.2.3" => "1",
"1.2.3-4,5:6" => "1"
end
describe "#minor" do
include_examples "version expectations hash", :minor,
"1" => "",
"1.2" => "2",
"1.2.3" => "2",
"1.2.3_4-5" => "2"
"1" => "",
"1.2" => "2",
"1.2.3" => "2",
"1.2.3-4,5:6" => "2"
end
describe "#patch" do
include_examples "version expectations hash", :patch,
"1" => "",
"1.2" => "",
"1.2.3" => "3",
"1.2.3_4-5" => "3"
"1" => "",
"1.2" => "",
"1.2.3" => "3",
"1.2.3-4,5:6" => "3-4"
end
describe "#major_minor" do
include_examples "version expectations hash", :major_minor,
"1" => "1",
"1.2" => "1.2",
"1.2.3" => "1.2",
"1.2.3_4-5" => "1.2"
"1" => "1",
"1.2" => "1.2",
"1.2.3" => "1.2",
"1.2.3-4,5:6" => "1.2"
end
describe "#major_minor_patch" do
include_examples "version expectations hash", :major_minor_patch,
"1" => "1",
"1.2" => "1.2",
"1.2.3" => "1.2.3",
"1.2.3_4-5" => "1.2.3"
"1" => "1",
"1.2" => "1.2",
"1.2.3" => "1.2.3",
"1.2.3-4,5:6" => "1.2.3-4"
end
describe "#minor_patch" do
include_examples "version expectations hash", :minor_patch,
"1" => "",
"1.2" => "2",
"1.2.3" => "2.3",
"1.2.3_4-5" => "2.3"
"1" => "",
"1.2" => "2",
"1.2.3" => "2.3",
"1.2.3-4,5:6" => "2.3-4"
end
describe "#before_comma" do