Supply event dispatcher in Create Project Command
This update allows composer plugins to intercept the create-project command to inject additional functionality such as providing additional remote filesystem handling.pull/9057/head
parent
11892070d1
commit
b4ecca5d0b
|
@ -39,6 +39,7 @@ use Composer\Json\JsonFile;
|
|||
use Composer\Config\JsonConfigSource;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\EventDispatcher\EventDispatcher;
|
||||
|
||||
/**
|
||||
* Install a package as new project into new directory.
|
||||
|
@ -286,8 +287,12 @@ EOT
|
|||
$config->merge(array('config' => array('secure-http' => false)));
|
||||
}
|
||||
|
||||
$composer = Factory::create($io, $config->all(), $disablePlugins);
|
||||
$eventDispatcher = $composer->getEventDispatcher();
|
||||
|
||||
if (null === $repository) {
|
||||
$sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
|
||||
$rm = RepositoryFactory::manager($io, $config, $eventDispatcher, Factory::createRemoteFilesystem($io, $config));
|
||||
$sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm));
|
||||
} else {
|
||||
$sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
|
||||
}
|
||||
|
@ -384,7 +389,7 @@ EOT
|
|||
$package = $package->getAliasOf();
|
||||
}
|
||||
|
||||
$dm = $this->createDownloadManager($io, $config);
|
||||
$dm = $this->createDownloadManager($io, $config, $eventDispatcher);
|
||||
$dm->setPreferSource($preferSource)
|
||||
->setPreferDist($preferDist)
|
||||
->setOutputProgress(!$noProgress);
|
||||
|
@ -409,11 +414,11 @@ EOT
|
|||
return $installedFromVcs;
|
||||
}
|
||||
|
||||
protected function createDownloadManager(IOInterface $io, Config $config)
|
||||
protected function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher)
|
||||
{
|
||||
$factory = new Factory();
|
||||
|
||||
return $factory->createDownloadManager($io, $config);
|
||||
return $factory->createDownloadManager($io, $config, $eventDispatcher);
|
||||
}
|
||||
|
||||
protected function createInstallationManager()
|
||||
|
|
Loading…
Reference in New Issue