fix(main-config): manage versions
This commit is contained in:
parent
ddddfacb77
commit
3a1a8da810
@ -113,7 +113,8 @@ class Plugin extends ParentPlugin
|
||||
list(
|
||||
'projectName' => $projectName,
|
||||
'packageName'=>$packageName,
|
||||
'path'=>$path
|
||||
'path'=>$path,
|
||||
'version' =>$version
|
||||
) = $this->findUrlInCorrespondances($correspondances,$url);
|
||||
$repositoryManager->prependRepository(new PathRepository(
|
||||
[
|
||||
@ -122,7 +123,7 @@ class Plugin extends ParentPlugin
|
||||
'options' => [
|
||||
'name' => $packageName,
|
||||
'versions' => [
|
||||
$packageName => 'dev-master',
|
||||
$packageName => $version,
|
||||
'symlink' => true
|
||||
]
|
||||
]
|
||||
@ -137,13 +138,18 @@ class Plugin extends ParentPlugin
|
||||
/**
|
||||
* extract available folder from main-config.json
|
||||
* @param array $config
|
||||
* @return array [$projectName => ['packageName' => string, 'path' => string ],...]
|
||||
* @return array [$projectName => ['packageName' => string, 'path' => string, 'version' => string ],...]
|
||||
*/
|
||||
protected function extractAvailableCorrespondances(array $config): array
|
||||
{
|
||||
$correspondances = [];
|
||||
if (isset($config['local-repositories']) && is_array($config['local-repositories'])){
|
||||
foreach($config['local-repositories'] as $name => $packageName){
|
||||
$version = 'dev-master';
|
||||
if (is_array($packageName)){
|
||||
$version = (!empty($packageName['version']) && is_string($packageName['version'])) ? $packageName['version'] : $version;
|
||||
$packageName = $packageName['packageName'] ?? '';
|
||||
}
|
||||
if (is_string($name)
|
||||
&& !empty(basename($name))
|
||||
&& is_string($packageName)
|
||||
@ -154,7 +160,8 @@ class Plugin extends ParentPlugin
|
||||
if (is_dir($dirName)){
|
||||
$correspondances[$projectName] = [
|
||||
'packageName' => $packageName,
|
||||
'path' => $dirName
|
||||
'path' => $dirName,
|
||||
'version' => $version
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user