1
0
Fork 0

Merge pull request #739 from igorw/init-no-interaction

Fix normalization in init command with --no-interaction and --require
pull/740/merge
Nils Adermann 2012-05-27 17:56:22 -07:00
commit 6fa21ab41c
1 changed files with 7 additions and 1 deletions

View File

@ -259,7 +259,7 @@ EOT
if ($requires) {
foreach ($requires as $key => $requirement) {
$requires[$key] = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', $requirement);
$requires[$key] = $this->normalizeRequirement($requirement);
if (false === strpos($requires[$key], ' ') && $input->isInteractive()) {
$question = $dialog->getQuestion('Please provide a version constraint for the '.$requirement.' requirement');
if ($constraint = $dialog->ask($output, $question)) {
@ -328,6 +328,7 @@ EOT
{
$requires = array();
foreach ($requirements as $requirement) {
$requirement = $this->normalizeRequirement($requirement);
list($packageName, $packageVersion) = explode(" ", $requirement, 2);
$requires[$packageName] = $packageVersion;
@ -336,6 +337,11 @@ EOT
return empty($requires) ? new \stdClass : $requires;
}
protected function normalizeRequirement($requirement)
{
return preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', $requirement);
}
protected function getGitConfig()
{
if (null !== $this->gitConfig) {