1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #!/usr/bin/env php
- <?php
- require __DIR__.'/../tests/bootstrap.php';
- use Composer\Composer;
- use Composer\Installer;
- use Composer\Downloader;
- use Composer\Repository;
- use Composer\Package;
- use Composer\Json\JsonFile;
- use Composer\Console\Application as ComposerApplication;
- // initialize repository manager
- $rm = new Repository\RepositoryManager();
- $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('pear', 'Composer\Repository\PearRepository');
- $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
- // initialize download manager
- $dm = new Downloader\DownloadManager($preferSource = false);
- $dm->setDownloader('git', new Downloader\GitDownloader());
- $dm->setDownloader('pear', new Downloader\PearDownloader());
- $dm->setDownloader('zip', new Downloader\ZipDownloader());
- // initialize installation manager
- $im = new Installer\InstallationManager();
- $im->addInstaller(new Installer\LibraryInstaller('vendor', $dm, $rm->getLocalRepository()));
- $im->addInstaller(new Installer\LibraryInstaller('vendor/bundles', $dm, $rm->getLocalRepository(), 'symfony-bundle'));
- // load package
- $loader = new Package\Loader\JsonLoader();
- $package = $loader->load(new JsonFile('composer.json'));
- // init locker
- $locker = new Package\Locker(new JsonFile('composer.lock'), $rm);
- // initialize composer
- $composer = new Composer();
- $composer->setPackage($package);
- $composer->setLocker($locker);
- $composer->setRepositoryManager($rm);
- $composer->setDownloadManager($dm);
- $composer->setInstallationManager($im);
- // run the command application
- $application = new ComposerApplication($composer);
- $application->run();
|