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