Skip to content

Commit

Permalink
Merge pull request #12 from creative-commoners/pulls/1.1/hardcode-ver…
Browse files Browse the repository at this point in the history
…sions

FIX Hardcode some module versions to installer version
  • Loading branch information
GuySartorelli authored Jul 11, 2022
2 parents be81f08 + dae4cd2 commit df0d941
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions consts.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,13 @@
'silverstripe-installer' => '5',
],
];

const INSTALLER_TO_REPO_MINOR_VERSIONS = [
'4.10' => [
'html5' => '2.3',
'silverstripe-elemental-bannerblock' => '2.4',
'silverstripe-session-manager' => '1.2',
'silverstripe-userforms' => '5.12',
'silverstripe-totp-authenticator' => '4.3',
]
];
8 changes: 8 additions & 0 deletions job_creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ public function getInstallerVersion(): string
return $cmsMajor . '.' . $portions[1] . '.x-dev';
}
}
// hardcoded installer version for repo version
foreach (array_keys(INSTALLER_TO_REPO_MINOR_VERSIONS) as $installerVersion) {
foreach (INSTALLER_TO_REPO_MINOR_VERSIONS[$installerVersion] as $_repo => $repoVersion) {
if ($repo === $_repo && $repoVersion === $branch) {
return $installerVersion . '.x-dev';
}
}
}
// fallback to use the latest minor version of installer
$installerVersions = array_keys(INSTALLER_TO_PHP_VERSIONS);
$installerVersions = array_filter($installerVersions, fn($version) => substr($version, 0, 1) === $cmsMajor);
Expand Down
4 changes: 4 additions & 0 deletions tests/JobCreatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ public function provideGetInstallerVersion(): array
['myaccount/silverstripe-tagfield', 'pulls/burger/myfeature', $latest],
['myaccount/silverstripe-tagfield', '2-release', $latest],
['myaccount/silverstripe-tagfield', '2.9-release', $latest],
// hardcoded repo version
['myaccount/silverstripe-session-manager', '1', $latest],
['myaccount/silverstripe-session-manager', '1.2', '4.10.x-dev'],
['myaccount/silverstripe-session-manager', 'burger', $latest],
];
}

Expand Down

0 comments on commit df0d941

Please sign in to comment.