Browse Source

Fix for #1966, use the preferred-install from the rootPackage config to install the dependencies.

Sandy Pleyte 11 years ago
parent
commit
bc7c93ae85
1 changed files with 18 additions and 0 deletions
  1. 18 0
      src/Composer/Command/CreateProjectCommand.php

+ 18 - 0
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);