-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH Automatically create hardcoded list
- Loading branch information
1 parent
6ece91b
commit a5b5e40
Showing
5 changed files
with
190 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.phpunit.result.cache | ||
.cow.pat.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
// Used to generate data for consts.php INSTALLER_TO_REPO_MINOR_VERSIONS | ||
// Copy .cow.pat.json from the current release into the directory this script is being run from (file is .gitignored) | ||
|
||
include 'consts.php'; | ||
|
||
$filename = '.cow.pat.json'; | ||
if (!file_exists($filename)) { | ||
throw new \RuntimeException("Copy $filename into the directory this is being called from"); | ||
} | ||
|
||
$versions = []; | ||
|
||
function repoName(string $name) | ||
{ | ||
$prefix = ''; | ||
if (!preg_match('#^(cwp/)#', $name) && | ||
!preg_match('#(/recipe-|/silverstripe-|/comment-notifications$)#', $name) | ||
) { | ||
$prefix = 'silverstripe-'; | ||
} | ||
if (preg_match('#(/agency-extensions|/starter-theme|/watea-theme)$#', $name)) { | ||
$prefix = 'cwp-'; | ||
} | ||
$name = str_replace('/agency-extensions', '/agencyextensions', $name); | ||
return $prefix . explode('/', $name)[1]; | ||
} | ||
|
||
function parseNode(string $name, stdClass $node, array &$versions) | ||
{ | ||
$repoName = repoName($name); | ||
if (!in_array($repoName, LOCKSTEPPED_REPOS) && | ||
!in_array($repoName, NO_INSTALLER_LOCKSTEPPED_REPOS) && | ||
!in_array($repoName, NO_INSTALLER_UNLOCKSTEPPED_REPOS) | ||
) { | ||
preg_match('#^([0-9]+\.[0-9]+)#', $node->Version, $m); | ||
$versions[$repoName] = $m[1]; | ||
} | ||
foreach ((array) $node->Items as $itemName => $item) { | ||
parseNode($itemName, $item, $versions); | ||
} | ||
} | ||
|
||
foreach (json_decode(file_get_contents($filename)) as $itemName => $item) { | ||
parseNode($itemName, $item, $versions); | ||
} | ||
|
||
ksort($versions); | ||
foreach ($versions as $repoName => $version) { | ||
echo " '$repoName' => '$version',\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters