Recognize '2.0' in compatibility inference and CLI badges

Extends the 1.7/1.8 compatibility machinery to treat a grav >= 2.0
dependency as ['2.0']. SelfupgradeCommand's preflight already keys off
the target package's major.minor, so upgrading 1.8 → 2.0 now correctly
flags plugins that only declare 1.7 or 1.8 as blocking.

- GPM/Local/Package::inferCompatibility(): grav >= 2.0 → ['2.0']
- Installer/Install::inferCompatibleVersions(): grav >= 2.0 → ['2.0']
- IndexCommand / InfoCommand / UpdateCommand: magenta '2.0' badge

Ships as part of the final 1.8 beta so the installed base has a clean
upgrade gate when users run `bin/gpm selfupgrade` against a Grav 2.0
release. The actual migration wizard is a 2.0-only deliverable and is
NOT backported here.
This commit is contained in:
Andy Miller
2026-04-13 16:55:12 +01:00
parent 3752a34407
commit 6324cca502
5 changed files with 17 additions and 0 deletions

View File

@@ -91,6 +91,10 @@ class Package extends BasePackage
continue;
}
if (version_compare($m[1], '2.0', '>=')) {
return ['grav' => ['2.0'], 'api' => []];
}
if (version_compare($m[1], '1.8', '>=')) {
return ['grav' => ['1.8'], 'api' => []];
}

View File

@@ -260,6 +260,9 @@ class IndexCommand extends GpmCommand
if (in_array('1.8', $compat['grav'], true)) {
$badges[] = '<green>1.8</green>';
}
if (in_array('2.0', $compat['grav'], true)) {
$badges[] = '<magenta>2.0</magenta>';
}
return implode(' ', $badges);
}

View File

@@ -150,6 +150,9 @@ class InfoCommand extends GpmCommand
if (in_array('1.8', $compat['grav'], true)) {
$badges[] = '<green>1.8</green>';
}
if (in_array('2.0', $compat['grav'], true)) {
$badges[] = '<magenta>2.0</magenta>';
}
$compatStr = implode(' ', $badges);
} else {
$compatStr = '<blue>1.7</blue>';

View File

@@ -222,6 +222,9 @@ class UpdateCommand extends GpmCommand
if (in_array('1.8', $compat['grav'], true)) {
$badges[] = '<green>1.8</green>';
}
if (in_array('2.0', $compat['grav'], true)) {
$badges[] = '<magenta>2.0</magenta>';
}
$compatStr = ' ' . implode(' ', $badges);
}

View File

@@ -1448,6 +1448,10 @@ ERR;
continue;
}
if (version_compare($m[1], '2.0', '>=')) {
return ['grav' => ['2.0'], 'api' => []];
}
if (version_compare($m[1], '1.8', '>=')) {
return ['grav' => ['1.8'], 'api' => []];
}