Merge pull request #4346 from commitay/version-minor_patch

cask dsl versions: add minor_patch
This commit is contained in:
Vítor Galvão 2018-06-16 13:18:21 +01:00 committed by GitHub
commit 9831e67452
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -84,6 +84,10 @@ module Hbc
version { [major, minor, patch].reject(&:empty?).join(".") }
end
def minor_patch
version { [minor, patch].reject(&:empty?).join(".") }
end
def before_comma
version { split(",", 2)[0] }
end

View File

@ -121,6 +121,14 @@ describe Hbc::DSL::Version, :cask do
"1.2.3_4-5" => "1.2.3"
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"
end
describe "#before_comma" do
include_examples "version expectations hash", :before_comma,
"1.2.3" => "1.2.3",