private function installRepositories($repositories, $input, $output)
{
chdir($input->getArgument('path'));
$path = getcwd();
$output->writeln(' > <info>Git init</info>');
exec('git init');
foreach ($repositories as $repository) {
$gitcommand = sprintf('git submodule add %s://%s %s', $input->getOption('protocol'), $repository->getSource(), $repository->getTarget());
$output->writeln(sprintf(' > <info>Git %s</info>', $repository->getSource()));
exec($gitcommand);
$targetPath = $path . '/' . $repository->getTarget();
chdir($targetPath);
$output->writeln(sprintf(' > <comment>Git revision %s %s</comment>', $repository->getType(), $repository->getRevision()));
if ('tag' === $repository->getType()) {
$gitcommand = sprintf('git checkout -b %s %s', $repository->getRevision(), $repository->getRevision());
exec($gitcommand);
} else {
if ('master' !== $repository->getRevision()) {
$gitcommand = sprintf('git checkout -b %s origin/%s', $repository->getRevision(), $repository->getRevision());
exec($gitcommand);
}
}
chdir($path);
}
exec('git submodule init');
}