Allow disabling of the default packagist repository in the main composer.json
Example: { "repositories": { "packagist": false } }pull/61/head
parent
aeab3c16fd
commit
35849ca227
12
bin/composer
12
bin/composer
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue