From bc7c93ae85ae524cee94b6dbb627eb156141515f Mon Sep 17 00:00:00 2001 From: Sandy Pleyte Date: Mon, 24 Feb 2014 13:34:50 +0100 Subject: [PATCH] Fix for #1966, use the preferred-install from the rootPackage config to install the dependencies. --- src/Composer/Command/CreateProjectCommand.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 5aab270ce..1b28f0e28 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -161,6 +161,24 @@ EOT $composer->getEventDispatcher()->dispatchCommandEvent(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages); } + // Update preferSource / preferDist with preferred-install from the root package if both vars still + // have their default initial value (false) + $config = $composer->getConfig(); + if ($config->has('preferred-install') && $preferDist === false && $preferSource === false) { + switch ($config->get('preferred-install')) { + case 'source': + $preferSource = true; + break; + case 'dist': + $preferDist = true; + break; + case 'auto': + default: + // noop + break; + } + } + // install dependencies of the created project if ($noInstall === false) { $installer = Installer::create($io, $composer);