From 9c9ed281b34b5fff5465157a97e46d393ca822d1 Mon Sep 17 00:00:00 2001 From: Mitchell Chambers Date: Fri, 9 Jun 2023 12:19:06 +1000 Subject: [PATCH] add support for patchlevel_minor check in module version --- lib/onceover/controlrepo.rb | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/lib/onceover/controlrepo.rb b/lib/onceover/controlrepo.rb index cfc777d..31c8e06 100644 --- a/lib/onceover/controlrepo.rb +++ b/lib/onceover/controlrepo.rb @@ -241,17 +241,32 @@ def print_puppetfile_table row << mod.expected_version row << mod.v3_module.current_release.version - current = Versionomy.parse(mod.expected_version) - latest = Versionomy.parse(mod.v3_module.current_release.version) + # Configure a custom version format to support modern Puppet Forge versions. + # (major.minor.tiny-patchlevel-patchlevel_minor) + # e.g. 8.5.0-0-2 + puppet_format = Versionomy.default_format.modified_copy do + field(:patchlevel_minor) do + recognize_number(:default_value_optional => true, + :delimiter_regexp => '-', + :default_delimiter => '-') + end + end + + current = puppetforge_format.parse(mod.expected_version) + latest = puppetforge_format.parse(mod.v3_module.current_release.version) row << if current.major < latest.major - "Major".red - elsif current.minor < latest.minor - "Minor".yellow - elsif current.tiny < latest.tiny - "Tiny".green - else - "No".green - end + "Major".red + elsif current.minor < latest.minor + "Minor".yellow + elsif current.tiny < latest.tiny + "Tiny".green + elsif current.patchlevel < latest.patchlevel + "PatchLevel".green + elsif current.patchlevel_minor < latest.patchlevel_minor + "PatchLevel_minor".green + else + "No".green + end row << mod.v3_module.endorsement superseded_by = mod.v3_module.superseded_by