cask dsl versions: add minor_patch

This commit is contained in:
commitay 2018-06-15 22:40:33 +10:00
parent 9b21422b72
commit c5bbf28dd6
2 changed files with 12 additions and 0 deletions

View File

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

View File

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