1
0
Fork 0

Fix creation of ComposerRepository, refs #587

pull/585/merge
Jordi Boggiano 2012-04-17 10:51:44 +02:00
parent 24ca3e440e
commit 7837be0621
5 changed files with 11 additions and 7 deletions

View File

@ -82,12 +82,13 @@ EOT
$dm->setPreferSource(true);
}
$config = Factory::createConfig();
if (null === $repositoryUrl) {
$sourceRepo = new ComposerRepository(array('url' => 'http://packagist.org'), $io);
$sourceRepo = new ComposerRepository(array('url' => 'http://packagist.org'), $io, $config);
} elseif ("json" === pathinfo($repositoryUrl, PATHINFO_EXTENSION)) {
$sourceRepo = new FilesystemRepository(new JsonFile($repositoryUrl, new RemoteFilesystem($io)));
} elseif (0 === strpos($repositoryUrl, 'http')) {
$sourceRepo = new ComposerRepository(array('url' => $repositoryUrl), $io);
$sourceRepo = new ComposerRepository(array('url' => $repositoryUrl), $io, $config);
} else {
throw new \InvalidArgumentException("Invalid repository url given. Has to be a .json file or an http url.");
}
@ -112,7 +113,7 @@ EOT
$io->write('<info>Installing ' . $package->getName() . ' as new project.</info>', true);
$projectInstaller = new ProjectInstaller($directory, $dm);
$projectInstaller->install($package);
$projectInstaller->install(new FilesystemRepository(new JsonFile('php://memory')), $package);
$io->write('<info>Created project into directory ' . $directory . '</info>', true);
chdir($directory);

View File

@ -13,6 +13,7 @@
namespace Composer\Command;
use Composer\Json\JsonFile;
use Composer\Factory;
use Composer\Repository\CompositeRepository;
use Composer\Repository\PlatformRepository;
use Composer\Repository\ComposerRepository;
@ -229,7 +230,7 @@ EOT
if (!$this->repos) {
$this->repos = new CompositeRepository(array(
new PlatformRepository,
new ComposerRepository(array('url' => 'http://packagist.org'), $this->getIO())
new ComposerRepository(array('url' => 'http://packagist.org'), $this->getIO(), Factory::createConfig())
));
}

View File

@ -20,6 +20,7 @@ use Composer\Repository\PlatformRepository;
use Composer\Repository\ComposerRepository;
use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage;
use Composer\Factory;
/**
* @author Robert Schönthal <seroscho@googlemail.com>
@ -54,7 +55,7 @@ EOT
} else {
$output->writeln('No composer.json found in the current directory, showing packages from packagist.org');
$installedRepo = $platformRepo;
$packagist = new ComposerRepository(array('url' => 'http://packagist.org'), $this->getIO());
$packagist = new ComposerRepository(array('url' => 'http://packagist.org'), $this->getIO(), Factory::createConfig());
$repos = new CompositeRepository(array($installedRepo, $packagist));
}

View File

@ -13,6 +13,7 @@
namespace Composer\Command;
use Composer\Composer;
use Composer\Factory;
use Composer\Package\PackageInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
@ -65,7 +66,7 @@ EOT
} else {
$output->writeln('No composer.json found in the current directory, showing packages from packagist.org');
$installedRepo = $platformRepo;
$packagist = new ComposerRepository(array('url' => 'http://packagist.org'), $this->getIO());
$packagist = new ComposerRepository(array('url' => 'http://packagist.org'), $this->getIO(), Factory::createConfig());
$repos = new CompositeRepository(array($installedRepo, $packagist));
}

View File

@ -84,7 +84,7 @@ class Factory
}
// Configuration defaults
$config = $this->createConfig();
$config = static::createConfig();
$config->merge($localConfig);
$vendorDir = $config->get('vendor-dir');