From 3224fc194cfe21a6a033e8b8b7566c5d6877a4f2 Mon Sep 17 00:00:00 2001 From: Martin Ficzel Date: Wed, 7 Nov 2018 13:33:57 +0100 Subject: [PATCH] FEATURE: Use localDistributionFolders on package:create If the composer file has a local distribution folder identified by type "path" and a local folder reference in the "url" the new package is created in the distributionFolder and the new package is required via composer require. --- Neos.Flow/Classes/Package/PackageManager.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Neos.Flow/Classes/Package/PackageManager.php b/Neos.Flow/Classes/Package/PackageManager.php index 5963394af5..1a30142270 100644 --- a/Neos.Flow/Classes/Package/PackageManager.php +++ b/Neos.Flow/Classes/Package/PackageManager.php @@ -340,6 +340,18 @@ public function createPackage($packageKey, array $manifest = [], $packagesPath = $manifest['type'] = PackageInterface::DEFAULT_COMPOSER_TYPE; } + $runComposerRequireForTheCreatedPackage = false; + if ($packagesPath === null) { + $composerManifestRepositories = ComposerUtility::getComposerManifest(FLOW_PATH_ROOT, 'repositories'); + foreach ($composerManifestRepositories as $repository) { + if ($repository['type'] == 'path' && substr($repository['url'], 0, 2) == './' && substr($repository['url'], -2) == '/*') { + $packagesPath = Files::getUnixStylePath(Files::concatenatePaths([FLOW_PATH_ROOT, substr($repository['url'], 0, -2)])); + $runComposerRequireForTheCreatedPackage = true; + break; + } + } + } + if ($packagesPath === null) { $packagesPath = 'Application'; if (is_array($this->settings['packagesPathByType']) && isset($this->settings['packagesPathByType'][$manifest['type']])) { @@ -365,6 +377,10 @@ public function createPackage($packageKey, array $manifest = [], $packagesPath = $manifest = ComposerUtility::writeComposerManifest($packagePath, $packageKey, $manifest); + if ($runComposerRequireForTheCreatedPackage) { + exec('composer require ' . $manifest['name'] . ' @dev'); + } + $refreshedPackageStatesConfiguration = $this->rescanPackages(); $this->packageStatesConfiguration = $refreshedPackageStatesConfiguration; $this->registerPackageFromStateConfiguration($manifest['name'], $this->packageStatesConfiguration['packages'][$manifest['name']]);