Browse Source

refactored param parsing

tags/2.0.0-beta
Tobias Munk 12 years ago
parent
commit
8264c5c51d
  1. 16
      extensions/composer/yii/composer/InstallHandler.php

16
extensions/composer/yii/composer/InstallHandler.php

@ -80,17 +80,17 @@ class InstallHandler
} }
} }
// prepare console application
require(__DIR__ . '/../../../yii2/yii/Yii.php'); require(__DIR__ . '/../../../yii2/yii/Yii.php');
$application = new \yii\console\Application($config);
$request = $application->getRequest();
foreach ((array)$options['run'] as $rawParams) { // run commands from extra.run
// TODO: we're doing about the same here like console\Request::resolve() foreach ((array)$options['run'] as $rawCommand) {
$command = $rawParams[0]; $opts = str_getcsv($rawCommand, ' '); // see http://stackoverflow.com/a/6609509/291573
unset($rawParams[0]); $request->setParams($opts);
$params[\yii\console\Request::ANONYMOUS_PARAMS] = $rawParams; list($command, $params) = $request->resolve();
// TODO end
echo "Running command: {$command}\n"; echo "Running command: {$command}\n";
$application = new \yii\console\Application($config);
$application->runAction($command, $params); $application->runAction($command, $params);
} }
} }

Loading…
Cancel
Save