|
|
@ -13,31 +13,37 @@ class VcsRepository extends ArrayRepository
|
|
|
|
{
|
|
|
|
{
|
|
|
|
protected $url;
|
|
|
|
protected $url;
|
|
|
|
protected $packageName;
|
|
|
|
protected $packageName;
|
|
|
|
|
|
|
|
protected $debug;
|
|
|
|
|
|
|
|
|
|
|
|
public function __construct(array $config)
|
|
|
|
public function __construct(array $config, array $drivers = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!filter_var($config['url'], FILTER_VALIDATE_URL)) {
|
|
|
|
if (!filter_var($config['url'], FILTER_VALIDATE_URL)) {
|
|
|
|
throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$config['url']);
|
|
|
|
throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$config['url']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->drivers = $drivers ?: array(
|
|
|
|
|
|
|
|
'Composer\Repository\Vcs\GitHubDriver',
|
|
|
|
|
|
|
|
'Composer\Repository\Vcs\GitBitbucketDriver',
|
|
|
|
|
|
|
|
'Composer\Repository\Vcs\GitDriver',
|
|
|
|
|
|
|
|
'Composer\Repository\Vcs\HgBitbucketDriver',
|
|
|
|
|
|
|
|
'Composer\Repository\Vcs\HgDriver',
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
$this->url = $config['url'];
|
|
|
|
$this->url = $config['url'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function setDebug($debug)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->debug = $debug;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected function initialize()
|
|
|
|
protected function initialize()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
parent::initialize();
|
|
|
|
parent::initialize();
|
|
|
|
|
|
|
|
|
|
|
|
$debug = false;
|
|
|
|
$debug = $this->debug;
|
|
|
|
|
|
|
|
|
|
|
|
$drivers = array(
|
|
|
|
|
|
|
|
'Composer\Repository\Vcs\GitHubDriver',
|
|
|
|
|
|
|
|
'Composer\Repository\Vcs\GitBitbucketDriver',
|
|
|
|
|
|
|
|
'Composer\Repository\Vcs\GitDriver',
|
|
|
|
|
|
|
|
'Composer\Repository\Vcs\HgBitbucketDriver',
|
|
|
|
|
|
|
|
'Composer\Repository\Vcs\HgDriver',
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($drivers as $driver) {
|
|
|
|
foreach ($this->drivers as $driver) {
|
|
|
|
if ($driver::supports($this->url)) {
|
|
|
|
if ($driver::supports($this->url)) {
|
|
|
|
$driver = new $driver($this->url);
|
|
|
|
$driver = new $driver($this->url);
|
|
|
|
$driver->initialize();
|
|
|
|
$driver->initialize();
|
|
|
|