mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Allow requesting a particular vcs driver to bypass github/bitbucket ones
This commit is contained in:
parent
6c9f1f6f5b
commit
1d544630b6
3 changed files with 20 additions and 8 deletions
|
@ -20,20 +20,22 @@ class VcsRepository extends ArrayRepository
|
|||
protected $debug;
|
||||
protected $io;
|
||||
protected $versionParser;
|
||||
protected $type;
|
||||
|
||||
public function __construct(array $config, IOInterface $io, array $drivers = null)
|
||||
{
|
||||
$this->drivers = $drivers ?: array(
|
||||
'Composer\Repository\Vcs\GitHubDriver',
|
||||
'Composer\Repository\Vcs\GitBitbucketDriver',
|
||||
'Composer\Repository\Vcs\GitDriver',
|
||||
'Composer\Repository\Vcs\SvnDriver',
|
||||
'Composer\Repository\Vcs\HgBitbucketDriver',
|
||||
'Composer\Repository\Vcs\HgDriver',
|
||||
'github' => 'Composer\Repository\Vcs\GitHubDriver',
|
||||
'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
|
||||
'git' => 'Composer\Repository\Vcs\GitDriver',
|
||||
'svn' => 'Composer\Repository\Vcs\SvnDriver',
|
||||
'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
|
||||
'hg' => 'Composer\Repository\Vcs\HgDriver',
|
||||
);
|
||||
|
||||
$this->url = $config['url'];
|
||||
$this->io = $io;
|
||||
$this->type = $config['type'];
|
||||
}
|
||||
|
||||
public function setDebug($debug)
|
||||
|
@ -43,6 +45,13 @@ class VcsRepository extends ArrayRepository
|
|||
|
||||
public function getDriver()
|
||||
{
|
||||
if (isset($this->drivers[$this->type])) {
|
||||
$class = $this->drivers[$this->type];
|
||||
$driver = new $class($this->url, $this->io);
|
||||
$driver->initialize();
|
||||
return $driver;
|
||||
}
|
||||
|
||||
foreach ($this->drivers as $driver) {
|
||||
if ($driver::supports($this->url)) {
|
||||
$driver = new $driver($this->url, $this->io);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue