1
0
Fork 0

Allow disabling of the default packagist repository in the main composer.json

Example:

{
    "repositories": {
        "packagist": false
    }
}
pull/61/head
Jordi Boggiano 2011-10-22 22:23:45 +02:00
parent aeab3c16fd
commit 35849ca227
1 changed files with 9 additions and 3 deletions

View File

@ -14,7 +14,6 @@ use Composer\Console\Application as ComposerApplication;
// initialize repository manager // initialize repository manager
$rm = new Repository\RepositoryManager(); $rm = new Repository\RepositoryManager();
$rm->setLocalRepository(new Repository\FilesystemRepository(new JsonFile('.composer/installed.json'))); $rm->setLocalRepository(new Repository\FilesystemRepository(new JsonFile('.composer/installed.json')));
$rm->addRepository(new Repository\ComposerRepository('http://packagist.org'));
$rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository'); $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
$rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository'); $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
$rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository'); $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
@ -31,8 +30,15 @@ $im->addInstaller(new Installer\LibraryInstaller('vendor', $dm, $rm->getLocalRep
$im->addInstaller(new Installer\LibraryInstaller('vendor/bundles', $dm, $rm->getLocalRepository(), 'symfony-bundle')); $im->addInstaller(new Installer\LibraryInstaller('vendor/bundles', $dm, $rm->getLocalRepository(), 'symfony-bundle'));
// load package // load package
$loader = new Package\Loader\JsonLoader(); $loader = new Package\Loader\ArrayLoader($rm);
$package = $loader->load(new JsonFile('composer.json')); $file = new JsonFile('composer.json');
$packageConfig = $file->read();
$package = $loader->load($packageConfig);
// load default repository unless it's explicitly disabled
if (!isset($packageConfig['repositories']['packagist']) || $packageConfig['repositories']['packagist'] !== false) {
$rm->addRepository(new Repository\ComposerRepository('http://packagist.org'));
}
// init locker // init locker
$locker = new Package\Locker(new JsonFile('composer.lock'), $rm); $locker = new Package\Locker(new JsonFile('composer.lock'), $rm);