1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 17:12:51 +00:00

Merge pull request #659 from Seldaek/github_https_fallback

Github https fallback
This commit is contained in:
Nils Adermann 2012-05-09 09:57:04 -07:00
commit 655588a5e0
14 changed files with 56 additions and 139 deletions

View file

@ -35,6 +35,7 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)\.git$#', $this->url, $match);
$this->owner = $match[1];
$this->repository = $match[2];
$this->originUrl = 'bitbucket.org';
}
/**

View file

@ -46,6 +46,7 @@ class GitHubDriver extends VcsDriver
preg_match('#^(?:https?|git)://github\.com/([^/]+)/(.+?)(?:\.git)?$#', $this->url, $match);
$this->owner = $match[1];
$this->repository = $match[2];
$this->originUrl = 'github.com';
$this->fetchRootIdentifier();
}
@ -245,7 +246,7 @@ class GitHubDriver extends VcsDriver
$this->io->write('Authentication required (<info>'.$this->url.'</info>):');
$username = $this->io->ask('Username: ');
$password = $this->io->askAndHideAnswer('Password: ');
$this->io->setAuthorization($this->url, $username, $password);
$this->io->setAuthorization($this->originUrl, $username, $password);
break;
default:

View file

@ -35,6 +35,7 @@ class HgBitbucketDriver extends VcsDriver
preg_match('#^https://bitbucket\.org/([^/]+)/([^/]+)/?$#', $this->url, $match);
$this->owner = $match[1];
$this->repository = $match[2];
$this->originUrl = 'bitbucket.org';
}
/**

View file

@ -26,6 +26,7 @@ use Composer\Util\RemoteFilesystem;
abstract class VcsDriver implements VcsDriverInterface
{
protected $url;
protected $originUrl;
protected $io;
protected $config;
protected $process;
@ -43,6 +44,7 @@ abstract class VcsDriver implements VcsDriverInterface
final public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null, $remoteFilesystem = null)
{
$this->url = $url;
$this->originUrl = $url;
$this->io = $io;
$this->config = $config;
$this->process = $process ?: new ProcessExecutor;
@ -86,7 +88,7 @@ abstract class VcsDriver implements VcsDriverInterface
*/
protected function getContents($url)
{
return $this->remoteFilesystem->getContents($this->url, $url, false);
return $this->remoteFilesystem->getContents($this->originUrl, $url, false);
}
protected static function isLocalUrl($url)